On Wed, Jun 11, 2014 at 07:55:13PM +0200, hermann meyer wrote:
I'm really unsure about how I could use this to
calculate it right,
could you give me some more hints, or best at all, a patch will be
very welcome, as most I've learned from reading source code.
There's a paper by Dolson and Laroche (1999) which is a 'must read'
for anyone dabbling with phase vocoders. See
<http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.131.8046>
which has a free download link from
columbia.edu.
Their method does the right calculations even without using
the computed frequencies (they wanted to avoid the atan2()
calls), but it's possible to do the same thing using them.
Hint: if you need the frequencies the Bernsee way, just
compute them using bin number as the unit instead of Hz -
it simplifies things quite a lot ans also shows much
clearer what's going on.
This is how it's done in some experimantal code I wrote
years ago:
for (i = 0; i <= hlen; i++)
{
x = _F [i][0];
y = _F [i][1];
p = atan2 (y, x) / twopi; // Phase in cycles.
d = p - _phase1 [i] - i / div; // Minus previous and expected difference.
d -= floorf (d + 0.5); // Reduce to [-0.5...+0.5]
_phase1 [i] = p; // Store for next iteration.
_freq [i] = i + d * div; // Frequency in bins.
_magn [i] = hypotf (x, y); // Magnitude.
}
where 'div' is the overlap factor, e.g. 4 for 75%. Note
this must be a float.
I'll let you work out the inverse operation by yourself,
you'll notice it's even simpler (as some terms cancel out).
But it's not needed when using D&L's method.
For code, maybe have a look at Rubberband which may contain
interesting things (I don't know, never dared to look as it
would probably have me hooked up for weeks experimenting
with this sort of algorithms...)
Ciao,
--
FA
A world of exhaustive, reliable metadata would be an utopia.
It's also a pipe-dream, founded on self-delusion, nerd hubris
and hysterically inflated market opportunities. (Cory Doctorow)