[linux-audio-dev] detune
mlang
mlang at delysid.org
Sun Jan 15 13:59:40 UTC 2006
Tim Goetze <tim at quitte.de> writes:
> [Hans Fugal]
>
>>I'm about to write a DSSI/LADSPA plugin that among other things, detunes
>>the signal by up to 15 cents. My understanding is that detuning is
>>accomplished by resampling. If that's the case, what do you do
>>with the time difference? Do you pad/truncate to get the same number of
>>samples you started out with? Wouldn't that introduce undesirables?
>
> It would. As far as I know, there are two common ways to do this:
>
> You can periodically window and granulate the signal, resample the
> grains and resynthesize -- that's the faster way, doing it all in the
> time domain. You'll get some comb filtering from the time-stretched
> phase cancelling out during grain overlap, but if you're only doing 15
> cent, it might turn out just fine. There's a library out there that
> does this, I can't seem to remember its name though. Anyone?
Probably libSoundTouch?
> The other way I know of is to use a phase vocoder. Basically, you
> periodically window and granulate and then FFT the signal, do a bit of
> math on the frequency content and resynthesize. The phase vocoder
> keeps track of signal phase so the comb filtering effect is no issue.
> The downside is the FFT and the math required to compute phase and
> amplitude; it's quite a bit heavier on the CPU. Some code that does it
> this way is at quitte.de/dsp/pvoc.html but for your intended use I'd
> first look at the simpler solution mentioned above.
I'd like to suggest this article:
http://www.dspdimension.com/data/html/pshiftstft.html
It is wonderfully detailed, includes all the necessary C source
code to take the basic idea and make it fly. I used this
method to write my instrument tuner by ripping out the last phase
of the algorithm (resynthesis) and only using the exact
frequency peak info. Its pretty useful, and I learned a lot
from this article. Actually, I think thats the single most useful
DSP tutorial I've ever read. It made me really grok FFT, which
is something by its own right :-)
Oh, and it is pretty simple to make this stuff work with libfftw3, just
read tuneit.c (http://delysid.org/tuneit.html).
--
CYa,
Mario
More information about the Linux-audio-dev
mailing list