Debian Codegraph @

examples/copya2ftab.csd

raw
1 <CsoundSynthesizer>
2 <CsOptions>
3 ; Select audio/midi flags here according to platform
4 -n
5 </CsOptions>
6 <CsInstruments>
7
8 sr = 44100
9 ksmps = 32
10 nchnls = 2
11 0dbfs = 1
12
13 ;an 'empty' function table with 10 points
14 giTable ftgen 0, 0, -10, 2, 0
15
16
17 instr 1
18
19 ;print inital values of giTable
20 puts "\nInitial table content:", 1
21 indx = 0
22 until indx == ftlen(giTable) do
23 iVal table indx, giTable
24 printf_i "Table index %d = %f\n", 1, indx, iVal
25 indx += 1
26 od
27
28 ;create array
29 kArr[] init 10
30
31 ;fill in values
32 kArr genarray 1, 10
33
34 ;print array values
35 printf "%s", 1, "\nArray content:\n"
36 kndx = 0
37 until kndx == lenarray(kArr) do
38 printf "kArr[%d] = %f\n", kndx+1, kndx, kArr[kndx]
39 kndx += 1
40 od
41
42 ;copy array values to table
43 copya2ftab kArr, giTable
44
45 ;print modified values of giTable
46 printf "%s", 1, "\nModified table content after copya2ftab:\n"
47 kndx = 0
48 until kndx == ftlen(giTable) do
49 kVal table kndx, giTable
50 printf "Table index %d = %f\n", kndx+1, kndx, kVal
51 kndx += 1
52 od
53
54 ;turn instrument off
55 turnoff
56 endin
57
58 </CsInstruments>
59 <CsScore>
60 i 1 0 0.1
61 </CsScore>
62 </CsoundSynthesizer>