[Csnd] kind of harmonizer with delays
Date | 2011-03-24 13:50 |
From | Stefan Thomas |
Subject | [Csnd] kind of harmonizer with delays |
Dear community, is it possible to make a kind of harmonizer by using delayr and delayw opcodes? I've understood that for my purpose the delaytime must be variable. But how can I calculate the resulting pitch of the delayed signal? I've made experiments with: <CsoundSynthesizer> ;<CsOptions> ;</CsOptions> ; ============================================== <CsInstruments> sr = 48000 ksmps = 100 nchnls = 2 0dbfs = 1 giwave ftgen 0,0,2^10, 10, 1, 0.5, 0.33, 0.25, 0.2, 0.1667, 0.1429, 0.125 gisine ftgen 0,0,2^10, 10, 1 gadelay init 0 instr 1 iamp ampmidi 1 icps cpsmidi iein = 0.01 iab = 1 iend = 0 imax = 1 aenv linsegr 0,iein, imax, iab, iend, 0.1, iend asig oscil iamp*aenv, icps, giwave outs asig, asig gadelay = asig endin instr 2 idelay = 2 icps cpsmidi abufout delayr idelay act11 phasor idelay adelaytime oscil 1/idelay, 1/idelay, gisine atap deltapi adelaytime delayw gadelay;+(atap*0.4) aout = gadelay+atap outs aout, aout gadelay = 0 endin </CsInstruments> ; ============================================== <CsScore> f 0 36 i2 0 36 </CsScore> </CsoundSynthesizer> |
Date | 2011-03-24 15:16 |
From | Victor Lazzarini |
Subject | Re: [Csnd] kind of harmonizer with delays |
Hi Stefan, a pitch shifter (for the harmoniser) needs to have 2 taps instead of one, so that you get a continuous sound. Also you will need to crossfade the taps so there are no nasty discontinuities when the delay goes from max to 0. The phasor will then be set to run at a rate that is proportional to the amount of pitch shift you need. This can be used to control the delay time of the taps and to index the crossfading windows. The rate of delay change is (pitch_shift - 1)/max_delay pitch_shift being the transposition interval ratio. Here's an example as a UDO: opcode PitchShifter, a, akkii setksmps 1 ; kr=sr asig,kpitch,idel,iwin xin kdelrate = (kpitch-1)/idel 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 idel atap1 deltapi avdel*idel ; variable delay taps atap2 deltapi avdel2*idel amix = atap1*afade + atap2*afade2 ; fade in/out the delay taps delayw asig+amix ; in endop On 24 Mar 2011, at 13:50, Stefan Thomas wrote: > Dear community, > is it possible to make a kind of harmonizer by using delayr and > delayw opcodes? > I've understood that for my purpose the delaytime must be variable. > But how can I calculate the resulting pitch of the delayed signal? > I've made experiments with: > > |
Date | 2011-03-24 15:19 |
From | Victor Lazzarini |
Subject | Re: [Csnd] kind of harmonizer with delays |
Slight typo: > opcode PitchShifter, a, akkii needs to be opcode PitchShifter, a, akii and > delayw asig+amix ; in needs to be delayw asig xout amix Victor On 24 Mar 2011, at 15:16, Victor Lazzarini wrote: > Hi Stefan, > > a pitch shifter (for the harmoniser) needs to have 2 taps instead of > one, so that > you get a continuous sound. Also you will need to crossfade the taps > so there > are no nasty discontinuities when the delay goes from max to 0. > > The phasor will then be set to run at a rate that is proportional to > the amount of > pitch shift you need. This can be used to control the delay time of > the taps and > to index the crossfading windows. > > The rate of delay change is (pitch_shift - 1)/max_delay > pitch_shift being the transposition interval ratio. > > Here's an example as a UDO: > > opcode PitchShifter, a, akkii > setksmps 1 ; kr=sr > asig,kpitch,idel,iwin xin > kdelrate = (kpitch-1)/idel > 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 idel > atap1 deltapi avdel*idel ; variable delay taps > atap2 deltapi avdel2*idel > amix = atap1*afade + atap2*afade2 ; fade in/out the delay taps > delayw asig+amix ; in > endop > > > > > > > On 24 Mar 2011, at 13:50, Stefan Thomas wrote: > >> Dear community, >> is it possible to make a kind of harmonizer by using delayr and >> delayw opcodes? >> I've understood that for my purpose the delaytime must be variable. >> But how can I calculate the resulting pitch of the delayed signal? >> I've made experiments with: >> >> |
Date | 2011-03-24 20:21 |
From | Stefan Thomas |
Subject | Re: [Csnd] kind of harmonizer with delays |
Dear Victor, thanks very much for Your help! I try to better understand (sorry, I'm a little dump with this) Your code. There are two things which are not quite clear: Is iwin a windows-function that should be generated by a function table? If so, which kind of window-function would You recommand? And, how will this opcode be invoked? Am I right with aout PitchShifter ain, kpitch, idel, iwin ? Thanks again for Your patience.Stefan 2011/3/24 Victor Lazzarini <Victor.Lazzarini@nuim.ie> Slight typo: |