Debian Codegraph @

examples/ftsave.csd

raw
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 ftsave.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 ; Table #1, make a sine wave using the GEN10 routine.
18 gitmp1 ftgen 1, 0, 32768, 10, 1
19 ; Table #2, create an empty table.
20 gitmp2 ftgen 2, 0, 32768, 7, 0, 32768, 0
21
22 ; Instrument #1 - a basic oscillator.
23 instr 1
24 kamp = 20000
25 kcps = 440
26 ; Use Table #1.
27 ifn = 1
28
29 a1 oscil kamp, kcps, ifn
30 out a1
31 endin
32
33
34 ; Instrument #2 - Load Table #1 into Table #2.
35 instr 2
36 ; Save Table #1 to a file called "table1.ftsave".
37 ftsave "table1.ftsave", 0, 1
38
39 ; Load the "table1.ftsave" file into Table #2.
40 ftload "table1.ftsave", 0, 2
41
42 kamp = 20000
43 kcps = 440
44 ; Use Table #2, it should contain Table #1's sine wave now.
45 ifn = 2
46
47 a1 oscil kamp, kcps, ifn
48 out a1
49 endin
50
51
52 </CsInstruments>
53 <CsScore>
54
55 ; Play Instrument #1 for 1 second.
56 i 1 0 1
57 ; Play Instrument #2 for 1 second.
58 i 2 2 1
59 e
60
61
62 </CsScore>
63 </CsoundSynthesizer>