src/Examples/FLOSS Manual Examples/12 Csound and other Languages/12B06_pycall.csd
raw| 1 | <CsoundSynthesizer> |
| 2 | <CsOptions> |
| 3 | -dnm0 |
| 4 | </CsOptions> |
| 5 | <CsInstruments> |
| 6 | |
| 7 | pyinit |
| 8 | |
| 9 | pyruni {{ |
| 10 | def average(a,b): |
| 11 | ave = (a + b)/2 |
| 12 | return ave |
| 13 | }} ;Define function "average" |
| 14 | |
| 15 | instr 1 ;call it |
| 16 | iave pycall1i "average", p4, p5 |
| 17 | prints "a = %i\n", iave |
| 18 | endin |
| 19 | |
| 20 | </CsInstruments> |
| 21 | <CsScore> |
| 22 | i 1 0 1 100 200 |
| 23 | i 1 1 1 1000 2000 |
| 24 | </CsScore> |
| 25 | </CsoundSynthesizer> |
| 26 | ;example by andrés cabrera and joachim heintz |