| Sorry, didn’t realize one could attach files in emails to the listserv.
Csound mailing list
Csound@listserv.heanet.ie
https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
Send bugs reports to
https://github.com/csound/csound/issues
Discussions of bugs and features can be posted here
Robert
> On Jul 6, 2016, at 7:29 AM, C. R. Craig wrote:
>
> Okay, I’ve puzzled over this one for several months now and I still can’t figure out why the results produced by the two instruments are not the same. The first instrument, “TEST1”, plays a note consisting of the fundamental and 5 partials with amplitudes, one after another. The second instrument, “TEST2”, uses recursion to achieve its results, but employs the same fundamental, partials, and amplitudes. I’ve tried to make the example as simple as possible.
>
>
>
> ;-odac
>
>
> sr = 44100
> ksmps = 32
> nchnls = 2
> 0dbfs = 1
>
> opcode NOTE_RECURSIVE, a, iiiio
> ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
> idur,ifreq,iPartialTable,iAmplitudes,index xin
> itablesize = ftlen(iPartialTable)
> iPartial tab_i index,iPartialTable
> iAmp tab_i index,iAmplitudes
> if (index < (itablesize - 1)) then
> iNextPartial tab_i (index+1),iPartialTable
> if iNextPartial != 0 then
> aN NOTE_RECURSIVE ifreq,idur,iPartialTable,iAmplitudes,index+1
> endif
> endif
> aA poscil iAmp,ifreq*iPartial
> xout aA+aN
> endop
>
> opcode NOTE,a,iiii
> idur,ifreq,ipartials,iamps xin
>
> ix init 0
>
> ip1 tab_i ix,ipartials
> ia1 tab_i ix,iamps
> asig1 poscil ia1,ifreq*ip1
>
> ip2 tab_i (ix+1),ipartials
> ia2 tab_i (ix+1),iamps
> asig2 poscil ia2,ifreq*ip2
>
> ip3 tab_i (ix+2),ipartials
> ia3 tab_i (ix+2),iamps
> asig3 poscil ia3,ifreq*ip3
>
> ip4 tab_i (ix+3),ipartials
> ia4 tab_i (ix+3),iamps
> asig4 poscil ia4,ifreq*ip4
>
> ip5 tab_i (ix+4),ipartials
> ia5 tab_i (ix+4),iamps
> asig5 poscil ia5,ifreq*ip5
>
> ip6 tab_i (ix+5),ipartials
> ia6 tab_i (ix+5),iamps
> asig6 poscil ia6,ifreq*ip6
>
> aout = asig1+asig2+asig3+asig4+asig5+asig6
> xout aout
> endop
>
> instr TEST1
> idur = p3
> ifreq = p4
> inumpartials = p5
>
> iPartials ftgenonce 0,0,-6,-2, 1, 2.89,4.95,6.99,8.01,9.02
> iAmplitudes ftgenonce 0,0,-6,-2,1, 1/2, 1/3, 1/2, 1/3, 1/4
>
> asig NOTE idur,ifreq,iPartials,iAmplitudes
> outs asig*0.1,asig*0.1
> endin
>
> instr TEST2
> idur = p3
> ifreq = p4
> inumpartials = p5
>
> iPartials ftgenonce 0,0,-6,-2, 1, 2.89,4.95,6.99,8.01,9.02
> iAmplitudes ftgenonce 0,0,-6,-2,1, 1/2, 1/3, 1/2, 1/3, 1/4
>
> asig NOTE_RECURSIVE idur,ifreq,iPartials,iAmplitudes
> outs asig*0.1,asig*0.1
> endin
>
>
>
> i "TEST1" 0 10 220 6
> i "TEST2" 10 10 220 6
> e
>
>
>
> Invoke this with "csound -W -o test_recursion.wav test_recursion.csd” then examine the results with audacity. The results are strikingly different.
>
> thanks,
> Robert
>
> Csound mailing list
> Csound@listserv.heanet.ie
> https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
> Send bugs reports to
> https://github.com/csound/csound/issues
> Discussions of bugs and features can be posted here
Csound mailing list
Csound@listserv.heanet.ie
https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
Send bugs reports to
https://github.com/csound/csound/issues
Discussions of bugs and features can be posted here
|