Debian Codegraph @

examples/rounding-group.csd

raw
1 <CsoundSynthesizer>
2 <CsOptions>
3 -odac ;
4 </CsOptions>
5 <CsInstruments>
6
7 sr = 44100
8 ksmps = 32
9
10 ; by tgrey 2020
11 instr 1
12
13 iLoopStart = p4
14 iLoopEnd = p5
15 iOffset = p6
16
17 iCount init iLoopStart
18
19
20 if(iLoopStart<iLoopEnd) then ; loop going up
21 while iCount <= iLoopEnd do
22 iVal = iCount+iOffset
23 iRound = round(iVal)
24 iInt = int(iVal)
25 iFloor = floor(iVal)
26 iCeil = ceil(iVal)
27 print iVal, iRound, iInt, iFloor, iCeil
28 iCount = iCount + 1
29 od
30
31 elseif(iLoopEnd<iLoopStart) then ; loop going down
32 while iCount >= iLoopEnd do
33 iVal = iCount+iOffset
34 iRound = round(iVal)
35 iInt = int(iVal)
36 iFloor = floor(iVal)
37 iCeil = ceil(iVal)
38 print iVal, iRound, iInt, iFloor, iCeil
39 iCount = iCount - 1
40 od
41 endif
42 endin
43 </CsInstruments>
44 <CsScore>
45 i1 0 .1 0 10 .5
46 i1 .2 .1 0 -10 .5
47 e
48 </CsScore>
49 </CsoundSynthesizer>