User-Defined Opcode Database


Delay-line pitchshifter

Download UDO File


PitchShifter transposes a signal by a given ratio using variable delay lines.


asig PitchShifter ain, kpitch, kfdb, kdel, iwin


iwin - function table containg a window used to crossfade between two delay line taps. A triangular window or similar is indicated.


asig - pitch shifted output
ain - input signal
kpitch - pitch shift ratio
kfdb - feedback amount (0-1]. Feedback can be used for arpeggiation effects.
kdel - delay line length (s). It is often useful to set the delaytime as 1/(f0*0.5) when pitchshifting monophonic pitched signals, to avoid artifacts


opcode  PitchShifter, a, akkki 
        setksmps  1                   ; kr=sr 
asig,kpitch,kfdb,kdel,iwin  xin 
kdelrate = (kpitch-1)/kdel 
avdel   phasor -kdelrate               ; 1 to 0 
avdel2  phasor -kdelrate, 0.5          ; 1/2 buffer offset  
afade  tablei avdel, iwin, 1, 0, 1     ; crossfade windows 
afade2 tablei avdel2,iwin, 1, 0, 1 
adump  delayr 1                  
atap1  deltapi avdel*kdel     ; variable delay taps 
atap2  deltapi avdel2*kdel 
amix   =   atap1*afade + atap2*afade2  ; fade in/out the delay taps 
       delayw  asig+amix*kfdb          ; in+feedback signals 
       xout  amix 


instr 1
kl line 1.4, 5, 1 
a1  diskin2 "flutec3.wav",kl,0,1

k1, ka ptrack a1, 1024
printk2 k1
if k1 < 100 then
k1 = 100
k1 = 1/(k1*0.5)
k1 port k1, 0.01, 1/6
a2 PitchShifter a1,1.5,0,k1,3

outs a2,a1


Previous Home Next
StrayNumToFt   StrayNumSum