09 May 2007

pitchShifter~

pitchShifter~

This block shifts the pitch over some halftones, up or down according to the sign of the first inlet. There is a variable delay between the minimum delay,
corresponding to the third inlet and the the minimum delay + the size of the window, corresponding to the second inlet.

version

v1.0: built 8/05/2007 with Pd v0.40-2 [pd][pdf]

interface

Input1: incoming mono audio signal
Input2: number of halftones up or down depending on sign of the input
Input3: the size of the window in ms
Input4: the minimum delay in ms

Output 1: original signal shifted over a number of halftones specified by input2

implementation

The desired pitch shift in halftones(num) is converted into a transposition factor t= 2^(num/12)= e^(num*log(2)/12) = e^(0.05776*num).
In the tape head rotation speed part f is calculated with f = [(t-1)*Fs]/s (Fs= samplerate and s= size window). This f is used to calculate
the saw tooth signals and corresponding envelopes.
The minimum delay (input3) is added to both sawtooth signals to make the delay input for the vd~ blocks.
The fact that two copies are made (one is shifted in phase with respect to the other one --> 0.5 correspondig to 180 degrees)
is to avoid discontinuities due to sampling.
Finally both vd~ block outputs are then multiplied by the corresponding envelopes and summed.

No comments: