[Csnd] python array in csound
Date | 2009-01-11 17:15 |
From | Chester Udell |
Subject | [Csnd] python array in csound |
Hi all, I am trying to use arrays generated by python in Csound... with no luck. I'm a beginner at this so it is probably a fundamental thing I am overlooking. Any Ideas? : I have a function where if I type this into the terminal: >>> def harmonic(fund, numPartials): ... li = [] ... numPartials = numPartials+1 ... for i in range(1, numPartials): ... li.append(fund*i) ... return li ... >>> harmonic(65.41, 15) I get: [65.409999999999997, 130.81999999999999, 196.22999999999999, 261.63999999999999, 327.04999999999995, 392.45999999999998, 457.87, 523.27999999999997, 588.68999999999994, 654.09999999999991, 719.50999999999999, 784.91999999999996, 850.32999999999993, 915.74000000000001, 981.14999999999998] An array of the harmonic sequence. I am attempting to call this function from a Csound instr lke this, but am getting an error: pyruni {{ def harmonic(fund, numPartials): li = [] numPartials = numPartials+1 for i in range(1, numPartials): li.append(fund*i) return li }} instr 1 ; call harmonic function ival init 0 ival1 pycall1 "harmonic", 65.41, 15.0 print ival endin Any Ideas? Thanks, Chet |
Date | 2009-01-11 19:18 |
From | "Andres Cabrera" |
Subject | [Csnd] Re: python array in csound |
Attachments | None |