| 1 |
<CsoundSynthesizer> |
| 2 |
<CsOptions> |
| 3 |
-o dac |
| 4 |
-d |
| 5 |
-i adc |
| 6 |
</CsOptions> |
| 7 |
<CsInstruments> |
| 8 |
|
| 9 |
sr = 44100 |
| 10 |
ksmps = 64 |
| 11 |
nchnls = 2 |
| 12 |
0dbfs = 1 |
| 13 |
|
| 14 |
giWet ftgen 0,0,1024,-7,0,512,1,512,1 |
| 15 |
giDry ftgen 0,0,1024,-7,1,512,1,512,0 |
| 16 |
|
| 17 |
turnon 1 |
| 18 |
|
| 19 |
opcode PitchShifter, aa, aakkk |
| 20 |
|
| 21 |
aL, aR, kpitch, kfine, kfeedback xin |
| 22 |
|
| 23 |
setksmps 64 |
| 24 |
|
| 25 |
ifftsize = 1024 |
| 26 |
ihopsize = 256 |
| 27 |
kscal = octave((int(kpitch)/12)+kfine) |
| 28 |
|
| 29 |
aOutL init 0 |
| 30 |
aOutR init 0 |
| 31 |
|
| 32 |
fsig1L pvsanal aL+(aOutL*kfeedback), ifftsize, ihopsize, ifftsize, 0 |
| 33 |
fsig1R pvsanal aR+(aOutR*kfeedback), ifftsize, ihopsize, ifftsize*2, 0 |
| 34 |
fsig2L pvscale fsig1L, kscal |
| 35 |
fsig2R pvscale fsig1R, kscal |
| 36 |
aOutL pvsynth fsig2L |
| 37 |
aOutR pvsynth fsig2R |
| 38 |
|
| 39 |
xout aOutL, aOutR |
| 40 |
endop |
| 41 |
|
| 42 |
instr 1 ;PITCH SHIFTER |
| 43 |
|
| 44 |
a1, a2 ins |
| 45 |
|
| 46 |
kmix chnget "mix" |
| 47 |
kpitch chnget "pitch" |
| 48 |
kpitch scale kpitch, 12, -12 |
| 49 |
kfine = 0 ;chnget "pitchshifter_fine" |
| 50 |
kfine scale kfine, 0.083333, -0.083333 |
| 51 |
kfeedback = 0 ;chnget "pitchshifter_feedback" |
| 52 |
|
| 53 |
kWet table kmix, giWet, 100 |
| 54 |
kDry table kmix, giDry, 100 |
| 55 |
|
| 56 |
aOutL, aOutR PitchShifter a1, a2, kpitch, kfine, kfeedback |
| 57 |
|
| 58 |
aOutL = (aOutL * kmix) + (a1 * (1.0 - kmix)) |
| 59 |
aOutR = (aOutR * kmix) + (a2 * (1.0 - kmix)) |
| 60 |
|
| 61 |
outs aOutL, aOutR |
| 62 |
|
| 63 |
endin |
| 64 |
|
| 65 |
|
| 66 |
</CsInstruments> |
| 67 |
<CsScore> |
| 68 |
f0 36000 |
| 69 |
|
| 70 |
</CsScore> |
| 71 |
</CsoundSynthesizer> |