Debian Codegraph @

src/Examples/FLOSS Manual Examples/03 Csound Language/03C07_Loops_with_if.csd

raw
1 <CsoundSynthesizer>
2 <CsOptions>
3 -odac
4 </CsOptions>
5 <CsInstruments>
6
7 instr 1 ;i-time loop: counts from 1 until 10 has been reached
8 icount = 1
9 count:
10 print icount
11 icount = icount + 1
12 if icount < 11 igoto count
13 prints "i-END!%n"
14 endin
15
16 instr 2 ;k-rate loop: counts in the 100th k-cycle from 1 to 11
17 kcount init 0
18 ktimek timeinstk ;counts k-cycle from the start of this instrument
19 if ktimek == 100 kgoto loop
20 kgoto noloop
21 loop:
22 printks "k-cycle %d reached!%n", 0, ktimek
23 kcount = kcount + 1
24 printk2 kcount
25 if kcount < 11 kgoto loop
26 printks "k-END!%n", 0
27 noloop:
28 endin
29
30 </CsInstruments>
31 <CsScore>
32 i 1 0 0
33 i 2 0 1
34 </CsScore>
35 </CsoundSynthesizer>
36 ;example by joachim heintz