For a small change in pitch/speed,
force-srate will work well. It is generally faster than
resample, and for small changes I find that it subjectively sounds better. For down-sampling more than few tones,
resample should be used so as to avoid aliasing distortion.
guranbanan wrote:The problem is it only accepts sample rates as input values - and I don't know how to convert between steps and sample rates
Very easy - it's just a matter of ratios, but there's a catch.
To raise the pitch by "N" semitones, the speed must be increased by 2^(N/12). However, (the catch), Nyquist does not control the sample rate of the track. When the audio is returned to the track, the samples are positioned according to the sample rate of the track.
As a simple example, if you double the sample rate in Nyquist, then Nyquist will return twice as many samples as their were originally. When returned to the track, they will occupy twice the original duration and play at half the speed - in other words, it's the opposite of what one might intuitively expect.
So, to increase the speed and pitch, you must
reduce the sample rate in Nyquist, and to decrease the speed and pitch you must increase the sample rate in Nyquist.
To write that in Nyquist:
Code: Select all
(setq N 0.4) ;increase pitch by 0.4 semitones
(force-srate (/ *sound-srate* (power 2.0 (/ N 12.0))) s)
Code: Select all
(setq N 0.4) ;decrease pitch by 0.4 semitones
(force-srate (* *sound-srate* (power 2.0 (/ N 12.0))) s)
*sound-srate* is a special Nyquist variable that is set to the sample rate of the track.