Debian Codegraph @

examples/igoto.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 igoto.wav -W ;;; for file output any platform
8 </CsOptions>
9 <CsInstruments>
10
11 ; Initialize the global variables.
12 sr = 44100
13 kr = 4410
14 ksmps = 10
15 nchnls = 1
16
17 ; Instrument #1.
18 instr 1
19 ; Get the value of the 4th p-field from the score.
20 iparam = p4
21
22 ; If iparam is 1 then play the high note.
23 ; If not then play the low note.
24 if (iparam == 1) igoto highnote
25 igoto lownote
26
27 highnote:
28 ifreq = 880
29 goto playit
30
31 lownote:
32 ifreq = 440
33 goto playit
34
35 playit:
36 ; Print the values of iparam and ifreq.
37 print iparam
38 print ifreq
39
40 a1 oscil 10000, ifreq, 1
41 out a1
42 endin
43
44
45 </CsInstruments>
46 <CsScore>
47
48 ; Table #1: a simple sine wave.
49 f 1 0 32768 10 1
50
51 ; p4: 1 = high note, anything else = low note
52 ; Play Instrument #1 for one second, a low note.
53 i 1 0 1 0
54 ; Play a Instrument #1 for one second, a high note.
55 i 1 1 1 1
56 e
57
58
59 </CsScore>
60 </CsoundSynthesizer>