Post by Bob MastaOn Sun, 20 Mar 2005 22:12:18 -0500, "Steve Russell"
Post by Steve RussellI have not yet moved to DirectX and am have never succeeded in doing
anything effects with waveXXX, e.g., waveOutSetPitch,
waveOutSetPlaybackRate. My question is, Until I start using DirectX, are
there reliable methods for manipulating sound playback to change pitch
and/or tempo?
I think most (all?) Windows systems use sample rate conversion these
days, so you may be able to simply set a different sample rate. Just
ignore the "supported" rates returned by waveOutGetCaps and use
whatever you want; Windows will take care of it from there. (You
may need to fake the values in the WAV header for this.) I have had
no problems doing this even on an old clunker Win95 laptop with a
junky sound chipset, setting sample rates from hundreds of Hertz
to MHz. The output does indeed match the settings.
waveOutSetPitch & waveOutSetPlaybackRate only ever worked if the hardware
supported it. When WDM audio drivers came along these were more or less
dropped.
If you want to stay with the waveOut interface you change the samplerate as
Bob describes to change the pitch and tempo together. You will have to
reopen the wave device each time you want to change. DirectSound will
allow you to do the same thing but you can make changes on the fly by
calling SetFrequency().
If you need to change pitch and tempo independently then you will have to
write your own time stretching code. Changing tempo without changing pitch
is very difficult especially for music. The WSOLA algorithm is very
effective on voice but artifacts are created in music due to the higher
frequency range.