Debian Codegraph @

examples/greaterthan.csd

raw
1 <CsoundSynthesizer>
2 <CsOptions>
3 ; Select audio/midi flags here according to platform
4 ; Audio out Audio in
5 -odac -iadc ;;;RT audio I/O
6 ; For Non-realtime ouput leave only the line below:
7 ; -o greaterthan.wav -W ;;; for file output any platform
8 </CsOptions>
9 <CsInstruments>
10
11 ; Initialize the global variables.
12 sr = 44100
13 kr = 44100
14 ksmps = 1
15 nchnls = 1
16
17 ; Instrument #1.
18 instr 1
19 ; Get the 4th p-field from the score.
20 k1 = p4
21
22 ; Is it greater than 3? (1 = true, 0 = false)
23 k2 = (p4 > 3 ? 1 : 0)
24
25 ; Print the values of k1 and k2.
26 printks "k1 = %f, k2 = %f\\n", 1, k1, k2
27 endin
28
29
30 </CsInstruments>
31 <CsScore>
32
33 ; Call Instrument #1 with a p4 = 2.
34 i 1 0 0.5 2
35 ; Call Instrument #1 with a p4 = 3.
36 i 1 1 0.5 3
37 ; Call Instrument #1 with a p4 = 4.
38 i 1 2 0.5 4
39 e
40
41
42 </CsScore>
43 </CsoundSynthesizer>