Debian Codegraph @

src/Examples/FLOSS Manual Examples/12 Csound and other Languages/12B02_python_global.csd

raw
1 <CsoundSynthesizer>
2 <CsOptions>
3 -ndm0
4 </CsOptions>
5 <CsInstruments>
6
7 pyinit
8
9 ;Execute a python script in the header
10 pyruni {{
11 a = 2
12 b = 3
13 c = a + b
14 }}
15
16 instr 1 ;print the value of c
17 prints "Instrument %d reports:\n", p1
18 pyruni "print 'a + b = c = %d' % c"
19 endin
20
21 instr 2 ;calculate d
22 prints "Instrument %d calculates the value of d!\n", p1
23 pyruni "d = c**2"
24 endin
25
26 instr 3 ;print the value of d
27 prints "Instrument %d reports:\n", p1
28 pyruni "print 'c squared = d = %d' % d"
29 endin
30
31 </CsInstruments>
32 <CsScore>
33 i 1 1 0
34 i 2 3 0
35 i 3 5 0
36 </CsScore>
37 </CsoundSynthesizer>
38 ;Example by Andrés Cabrera and Joachim Heintz