Debian Codegraph @

examples/schedkwhen.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 schedkwhen.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 - oscillator with a high note.
18 instr 1
19 ; Use the fourth p-field as the trigger.
20 ktrigger = p4
21 kmintim = 0
22 kmaxnum = 2
23 kinsnum = 2
24 kwhen = 0
25 kdur = 0.5
26
27 ; Play Instrument #2 at the same time, if the trigger is set.
28 schedkwhen ktrigger, kmintim, kmaxnum, kinsnum, kwhen, kdur
29
30 ; Play a high note.
31 a1 oscils 10000, 880, 1
32 out a1
33 endin
34
35 ; Instrument #2 - oscillator with a low note.
36 instr 2
37 ; Play a low note.
38 a1 oscils 10000, 220, 1
39 out a1
40 endin
41
42
43 </CsInstruments>
44 <CsScore>
45
46 ; Table #1, a sine wave.
47 f 1 0 16384 10 1
48
49 ; p4 = trigger for Instrument #2 (when p4 > 0).
50 ; Play Instrument #1 for half a second, no trigger.
51 i 1 0 0.5 0
52 ; Play Instrument #1 for half a second, trigger Instrument #2.
53 i 1 1 0.5 1
54 e
55
56
57 </CsScore>
58 </CsoundSynthesizer>