Debian Codegraph @

examples/cngoto.csd

raw
1 <CsoundSynthesizer>
2 <CsOptions>
3 ; Audio out Audio in
4 -odac -iadc ;;;RT audio I/O
5 ; -o cngoto.wav -W ;;; for file output any platform
6 </CsOptions>
7 <CsInstruments>
8
9 ; Initialize the global variables.
10 sr = 44100
11 ksmps = 10
12 nchnls = 1
13
14 ; Instrument #1.
15 instr 1
16 ; Change kval linearly from 0 to 2 over
17 ; the period set by the third p-field.
18 kval line 0, p3, 2
19
20 ; If kval *is not* greater than or equal to 1 then play
21 ; the high note. Otherwise, play the low note.
22 cngoto (kval >= 1), highnote
23 kgoto lownote
24
25 highnote:
26 kfreq = 880
27 goto playit
28
29 lownote:
30 kfreq = 440
31 goto playit
32
33 playit:
34 ; Print the values of kval and kfreq.
35 printks "kval = %f, kfreq = %f\\n", 1, kval, kfreq
36
37 a1 oscil 10000, kfreq, 1
38 out a1
39 endin
40
41
42 </CsInstruments>
43 <CsScore>
44
45 ; Table: a simple sine wave.
46 f 1 0 32768 10 1
47
48 ; Play Instrument #1 for two seconds.
49 i 1 0 2
50 e
51
52 </CsScore>
53 </CsoundSynthesizer>