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.
12sr = 44100
13kr = 44100
14ksmps = 1
15nchnls = 1
16
17; Instrument #1 - oscillator with a high note.
18instr 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
33endin
34
35; Instrument #2 - oscillator with a low note.
36instr 2
37  ; Play a low note.
38  a1 oscils 10000, 220, 1
39  out a1
40endin
41
42
43</CsInstruments>
44<CsScore>
45
46; Table #1, a sine wave.
47f 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.
51i 1 0 0.5 0
52; Play Instrument #1 for half a second, trigger Instrument #2.
53i 1 1 0.5 1
54e
55
56
57</CsScore>
58</CsoundSynthesizer>
59