Debian Codegraph @

examples/tempo.csd

raw
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.
12 sr = 44100
13 kr = 4410
14 ksmps = 10
15 nchnls = 1
16
17 ; Instrument #1.
18 instr 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
27 speedup:
28 ; Increase the tempo to 150 beats per minute.
29 tempo 150, 60
30
31 playit:
32
33 a1 oscil 10000, 440, 1
34 out a1
35 endin
36
37 </CsInstruments>
38 <CsScore>
39
40 ; Table #1, a sine wave.
41 f 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.
45 r3
46 i 1 00.00 00.25 0
47 i 1 00.25 00.25 0
48 i 1 00.50 00.25 0
49 i 1 00.75 00.25 0
50 s
51
52 ; Play Instrument #1 at a faster tempo, repeat 3 times.
53 r3
54 i 1 00.00 00.25 1
55 i 1 00.25 00.25 0
56 i 1 00.50 00.25 0
57 i 1 00.75 00.25 0
58 s
59
60 e
61
62 </CsScore>
63 </CsoundSynthesizer>