Debian Codegraph @

examples/ifthen.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 ifthen.wav -W ;;; for file output any platform
8 </CsOptions>
9 <CsInstruments>
10
11 sr = 44100
12 kr = 4410
13 ksmps = 10
14 nchnls = 1
15
16 ; Instrument #1.
17 instr 1
18 ; Get the note value from the fourth p-field.
19 knote = p4
20
21 ; Does the user want a low note?
22 if (knote == 0) then
23 kcps = 220
24 ; Does the user want a middle note?
25 elseif (knote == 1) then
26 kcps = 440
27 ; Does the user want a high note?
28 elseif (knote == 2) then
29 kcps = 880
30 endif
31
32 ; Create the note.
33 kamp init 25000
34 ifn = 1
35 a1 oscili kamp, kcps, ifn
36
37 out a1
38 endin
39
40
41 </CsInstruments>
42 <CsScore>
43
44 ; Table #1, a sine wave.
45 f 1 0 16384 10 1
46
47 ; p4: 0=low note, 1=middle note, 2=high note.
48 ; Play Instrument #1 for one second, low note.
49 i 1 0 1 0
50 ; Play Instrument #1 for one second, middle note.
51 i 1 1 1 1
52 ; Play Instrument #1 for one second, high note.
53 i 1 2 1 2
54 e
55
56
57 </CsScore>
58 </CsoundSynthesizer>