Debian Codegraph @

src/Examples/FLOSS Manual Examples/03 Csound Language/03C13_while_until_k-rate.csd

raw
1 <CsoundSynthesizer>
2 <CsOptions>
3 -nm0
4 </CsOptions>
5 <CsInstruments>
6 ksmps = 32
7
8 ;create and fill an array
9 gkArray[] fillarray 1, 2, 3, 4, 5
10
11 instr 1
12 ;count performance cycles and print it
13 kCycle timeinstk
14 printks "kCycle = %d\n", 0, kCycle
15 ;set index to zero
16 kIndex = 0
17 ;perform the loop
18 while kIndex < lenarray(gkArray) do
19 ;print array value
20 printf " gkArray[%d] = %d\n", kIndex+1, kIndex, gkArray[kIndex]
21 ;square array value
22 gkArray[kIndex] = gkArray[kIndex] * gkArray[kIndex]
23 ;increment index
24 kIndex += 1
25 od
26 ;stop after third control cycle
27 if kCycle == 3 then
28 turnoff
29 endif
30 endin
31
32 </CsInstruments>
33 <CsScore>
34 i 1 0 1
35 </CsScore>
36 </CsoundSynthesizer>
37 ;example by joachim heintz