| Very nicely done!
John Clements
cell: 401-835-6050
http://www.clementsaudio.com
On Mar 14, 2013, at 10:53 AM, Hans and Laurel Mikelson wrote:
> I combined several pendulums into a single instrument and set the overtone length change rate to a variable. Tried to play a scale.
>
> Hans Mikelson
>
>
>
> ;-RWfo pendula.wav
>
>
> ;---------------------------------------------------------
> ; Pendula
> ; Hans Mikelson March 2013
> ;---------------------------------------------------------
> sr = 44100 ; Sample rate
> kr = 44100 ; Kontrol rate
> ksmps = 1 ; Samples/Kontrol period This must be 1 to make sure to update time appropriately
> nchnls = 2 ; Normal stereo
> ;---------------------------------------------------------
> ; Pendula
> ;---------------------------------------------------------
> instr 50
> idur = p3 ; Duration
> iamp = p4 ; Amplitude
> il0 = p5 ; Length of pendulum
> ib = p6 ; Damping factor for pendulum (smaller damping will ring longer)
> ig = p7 ; Gravity
> kdclk linseg 0, .005, 1, idur-.01, 1, .005, 0
> atime init 0 ; Need to start time at 0
> atime = atime + .1 ; Time is incremented each sample
> ialpha0 = ib/2/il0 ; Calculate alpha exponential decay factor
> aamp0 = 1*exp(-ialpha0*atime) ; Calculate exponetial decay
> aout0 = aamp0*cos(sqrt(ig/il0-ib/il0/il0)*atime) ; Calculate the oscillator times amplitude
> apan = .5 + aout0/2
> outs aout0*iamp*apan*kdclk, aout0*iamp*(1-apan)*kdclk ; Amplify and output
> ;outs aout0*iamp*sqrt(apan)*kdclk, aout0*iamp*sqrt(1-apan)*kdclk ; Amplify and output
> ;outs aout0*iamp*kdclk, -aout0*iamp*kdclk ; Amplify and output
> endin
> ;---------------------------------------------------------
> ; Pendula 2
> ;---------------------------------------------------------
> instr 51
> idur = p3 ; Duration
> iamp = p4 ; Amplitude
> il0 = p5 ; Length of pendulum
> ib = p6 ; Damping factor for pendulum (smaller damping will ring longer)
> ig = p7 ; Gravity
> imult = p8 ; Scale each overtone by this factor
> kdclk linseg 0, .005, 1, idur-.01, 1, .005, 0
> atime init 0 ; Need to start time at 0
> atime = atime + .1 ; Time is incremented each sample
> ialpha0 = ib/2/il0 ; Calculate alpha exponential decay factor
> aamp0 = 1*exp(-ialpha0*atime) ; Calculate exponential decay
> aout0 = aamp0*cos(sqrt(ig/il0-ib/il0/il0)*atime) ; Calculate the oscillator times amplitude
> il1 = il0*imult
> ialpha1 = ib/2/il1 ; Calculate alpha exponential decay factor
> aamp1 = 1*exp(-ialpha1*atime) ; Calculate exponetial decay
> aout1 = aamp1*cos(sqrt(ig/il1-ib/il1/il1)*atime) ; Calculate the oscillator times amplitude
> il2 = il1*imult
> ialpha2 = ib/2/il2 ; Calculate alpha exponential decay factor
> aamp2 = 1*exp(-ialpha2*atime) ; Calculate exponetial decay
> aout2 = aamp2*cos(sqrt(ig/il2-ib/il2/il2)*atime) ; Calculate the oscillator times amplitude
> il3 = il2*imult
> ialpha3 = ib/2/il3 ; Calculate alpha exponential decay factor
> aamp3 = 1*exp(-ialpha3*atime) ; Calculate exponetial decay
> aout3 = aamp3*cos(sqrt(ig/il3-ib/il3/il3)*atime) ; Calculate the oscillator times amplitude
> il4 = il3*imult
> ialpha4 = ib/2/il4 ; Calculate alpha exponential decay factor
> aamp4 = 1*exp(-ialpha4*atime) ; Calculate exponetial decay
> aout4 = aamp4*cos(sqrt(ig/il4-ib/il4/il4)*atime) ; Calculate the oscillator times amplitude
> il5 = il4*imult
> ialpha5 = ib/2/il5 ; Calculate alpha exponential decay factor
> aamp5 = 1*exp(-ialpha5*atime) ; Calculate exponetial decay
> aout5 = aamp5*cos(sqrt(ig/il5-ib/il5/il5)*atime) ; Calculate the oscillator times amplitude
> outs (aout0+aout1+aout2+aout3+aout4+aout5)*iamp*kdclk, (aout0+aout1+aout2+aout3+aout4+aout5)*iamp*kdclk ; Amplify and output
> endin
>
>
> ;-------------------------------------------------------------------------
> ; Pendula
> ; by Hans Mikelson March 2013
> ;-------------------------------------------------------------------------
> f1 0 65536 10 1
> ; 200, 178.2, 158.7, 141.4, 126, 112.2, 100, 89.1, 79.4, 70.7, 63, 56.1, 50
> ; 2^(1/6) since sqrt is applied to length
> ; Pendula
> ; Sta Dur Amp PendL Damp Gravity MultFactor (.2-.99)
> i51 0.0 5 3000 200 0.1 9.81 0.3
> i51 0.4 . . 158.74 . . .
> i51 0.8 . . 126 . . .
> i51 1.2 . . 112.25 . . .
> i51 1.6 . . 89.09 . . .
> i51 2.0 . . 70.71 . . .
> i51 2.4 . . 56.123 . . .
> i51 2.8 . . 50 . . .
> i51 3.2 . . 200 . . .
> s1
> ; Pendula
> ; Sta Dur Amp PendL Damp Gravity MultFactor (.2-.99)
> i51 0.0 5 3000 200 0.1 9.81 0.5
> i51 0.4 . . 158.74 . . .
> i51 0.8 . . 126 . . .
> i51 1.2 . . 112.25 . . .
> i51 1.6 . . 89.09 . . .
> i51 2.0 . . 70.71 . . .
> i51 2.4 . . 56.123 . . .
> i51 2.8 . . 50 . . .
> i51 3.2 . . 200 . . .
> s2
> ; Pendula
> ; Sta Dur Amp PendL Damp Gravity MultFactor (.2-.99)
> i51 0.0 5 3000 200 0.1 9.81 0.8
> i51 0.4 . . 158.74 . . .
> i51 0.8 . . 126 . . .
> i51 1.2 . . 112.25 . . .
> i51 1.6 . . 89.09 . . .
> i51 2.0 . . 70.71 . . .
> i51 2.4 . . 56.123 . . .
> i51 2.8 . . 50 . . .
> i51 3.2 . . 200 . . .
>
>
>
>
> Send bugs reports to the Sourceforge bug tracker
> https://sourceforge.net/tracker/?group_id=81968&atid=564599
> Discussions of bugs and features can be posted here
> To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe csound"
>
|