Debian Codegraph @

examples/event_named.csd

raw
1 <CsoundSynthesizer>
2 <CsOptions>
3 ; Select audio/midi flags here according to platform
4 ; Audio out Audio in No messages
5 -odac -iadc -d ;;;RT audio I/O
6 ; For Non-realtime ouput leave only the line below:
7 ; -o event_named.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 - an oscillator with a high note.
18 instr 1
19 ; Create a trigger and set its initial value to 1.
20 ktrigger init 1
21
22 ; If the trigger is equal to 0, continue playing.
23 ; If not, schedule another event.
24 if (ktrigger == 0) goto contin
25 ; kscoreop="i", an i-statement.
26 ; kinsnum="low_note", instrument named "low_note".
27 ; kwhen=1, start at 1 second.
28 ; kdur=0.5, play for a half-second.
29 event "i", "low_note", 1, 0.5
30
31 ; Make sure the event isn't triggered again.
32 ktrigger = 0
33
34 contin:
35 a1 oscils 10000, 440, 1
36 out a1
37 endin
38
39 ; Instrument "low_note" - an oscillator with a low note.
40 instr low_note
41 a1 oscils 10000, 220, 1
42 out a1
43 endin
44
45
46 </CsInstruments>
47 <CsScore>
48
49 ; Make sure the score plays for two seconds.
50 f 0 2
51
52 ; Play Instrument #1 for a half-second.
53 i 1 0 0.5
54 e
55
56
57 </CsScore>
58 </CsoundSynthesizer>