1<CsoundSynthesizer>
2<CsOptions>
3; Select audio/midi flags here according to platform
4; Audio out   Audio in
5-odac           -iadc    -t60 ;;;RT audio I/O
6; For Non-realtime ouput leave only the line below:
7; -o tempo.wav -W -t60 ;;; for file output any platform
8</CsOptions>
9<CsInstruments>
10
11; Initialize the global variables.
12sr = 44100
13kr = 4410
14ksmps = 10
15nchnls = 1
16
17; Instrument #1.
18instr 1
19  kval tempoval
20
21  printk 0.1, kval
22
23  ; If the fourth p-field is 1, increase the tempo.
24  if (p4 == 1) kgoto speedup
25    kgoto playit
26
27speedup:
28  ; Increase the tempo to 150 beats per minute.
29  tempo 150, 60
30
31playit:
32
33  a1 oscil 10000, 440, 1
34  out a1
35endin
36
37</CsInstruments>
38<CsScore>
39
40; Table #1, a sine wave.
41f 1 0 16384 10 1
42
43; p4 = plays at a faster tempo (when p4=1).
44; Play Instrument #1 at the normal tempo, repeat 3 times.
45r3
46i 1 00.00 00.25 0
47i 1 00.25 00.25 0
48i 1 00.50 00.25 0
49i 1 00.75 00.25 0
50s
51
52; Play Instrument #1 at a faster tempo, repeat 3 times.
53r3
54i 1 00.00 00.25 1
55i 1 00.25 00.25 0
56i 1 00.50 00.25 0
57i 1 00.75 00.25 0
58s
59
60e
61
62</CsScore>
63</CsoundSynthesizer>
64