Debian Codegraph @

examples/ihold.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 ihold.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.
18 instr 1
19 ; A simple oscillator with its note held indefinitely.
20 a1 oscil 10000, 440, 1
21 ihold
22
23 ; If p4 equals 0, turn the note off.
24 if (p4 == 0) kgoto offnow
25 kgoto playit
26
27 offnow:
28 ; Turn the note off now.
29 turnoff
30
31 playit:
32 ; Play the note.
33 out a1
34 endin
35
36
37 </CsInstruments>
38 <CsScore>
39
40 ; Table #1: an ordinary sine wave.
41 f 1 0 32768 10 1
42
43 ; p4 = turn the note off (if it is equal to 0).
44 ; Start playing Instrument #1.
45 i 1 0 1 1
46 ; Turn Instrument #1 off after 3 seconds.
47 i 1 3 1 0
48 e
49
50
51 </CsScore>
52 </CsoundSynthesizer>