Hey friends, I have tried to port Miller Pucket’s pitchshifter here to csound:
opcode StanyDelay, a, akk
ain, kx1, kx2 xin
kcout init 0
kPortTime linseg 0, 0.2, 0.0
kinT portk kx1 , kPortTime
aDel delayr 4
aT deltapi a(kinT)
delayw ain+(aT * kx2)
xout aT ; write output
endop
opcode MPitch, a, akkkkk
ain, kt, kwin,kdel, kmix, kz xin
kwm max kwin, .001
kdm max kdel, .0015
ares atone ain, 300
kval = ((exp(kt*.05776)-1)*-1)/kwm
aphas phasor kval
apw = aphas +.5
apa = cos((aphas-.5)*.5)
aw wrap apw, 0, 1
awa = cos((aw-.5)*.5)
kPortTime linseg 0, 0.2, 0
ksig = k(aphas*kwm+kdm)
ksigb = k(aw*kwm+kdm)
kinT portk ksig, kPortTime
kinTb portk ksigb, kPortTime
awm StanyDelay ares,kinT,kz
ada StanyDelay ares,kinTb,kz
ai = apa*awm
aj = awa*ada
apshift = (ai+aj)
amix ntrpol ain, apshift, kmix
xout amix
endop
I am having difficulty with the delay lines and despite interpolating the incoming values, there seems to be a bad click on the delay line when the phasor wraps, maybe im assuming similarities of some of the names of the pd and csound library but any help would be appreciated. I did look at this as well (might be a bad rabbit hole) but im wondering if pd’s phasor c code handles multiplying by zero on the audio thread and maybe i need to account for this: