Debian Codegraph @

examples/hvs2.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 hvs2.wav -W ;;; for file output any platform
8 </CsOptions>
9 <CsInstruments>
10
11 ; updated example by Stefano Cucchi and Menno Knevel (original creators unknown)
12
13 sr = 44100
14 ksmps = 32
15 nchnls = 2
16 0dbfs = 1
17
18 instr 1
19
20 inumLinesX init 4 ; number of LINES - matrix - 16 POINTS
21 inumLinesY init 4 ; numeber of COLOUMNS
22 inumParms init 3 ; 3 PARAMETERS every ponint of the matrix - take a look at iSnapTab
23 iOutTab ftgen 5,0,8, -2, 0 ;
24 iPosTab ftgen 6,0,32, -2, 3,2,1,0,4,5,6,7,8,9,10, 11, 15, 14, 13, 12
25 iSnapTab ftgen 8,0,64, -2, 1,1,1, 2,0,0, 3,2,0, 2,2,2, 5,2,1, 2,3,4, 6,1,7, 0,0,0, \
26 1,3,5, 1,4,4, 1,5,8, 1,1,5, 4,3,2, 3,4,5, 7,6,5, 7,8,9
27
28 kx linseg 0, p3*0.3, 1, p3*0.3, 0, p3*0.4, 1
29 ky linseg 1, p3, 0
30
31
32 ; kx, ky, inumParms, inumlinesX, inumlinesY, iOutTab, iPosTab, iSnapTab
33 hvs2 kx, ky, inumParms, inumLinesX, inumLinesY, iOutTab, iPosTab, iSnapTab
34
35 k0 tab 0, 5 ; init first value of 3 of iSnapTab
36 k1 tab 1, 5 ; init second value of 3 of iSnapTab
37 k2 tab 2, 5 ; init third value of 3 of iSnapTab
38
39 printk2 k0, 10
40 printk2 k1, 10
41 printk2 k2, 10
42
43 ; Make parameters of synthesis depend on the table values produced by hvs
44 ; k0 = first value of group of three in iSnapTab
45 ; k1 = second value of group of three in iSnapTab
46 ; k2 = first value of group of three in iSnapTab
47
48 ares1 fof 0.2, k0*100 + 50, k1*100 + 200, 0, k2 * 10 + 50, 0.003, 0.02, 0.007, 20, \
49 1, 2, p3
50 ares2 fof 0.2, k1*100 + 50, k2*100 + 200, 0, k0 * 10 + 50, 0.003, 0.02, 0.007, 20, \
51 1, 2, p3
52 kdeclik linseg 0, 0.3, 1, p3-0.6, 1, 0.3, 0
53 outs ares1*kdeclik, ares2*kdeclik
54 endin
55
56 </CsInstruments>
57 <CsScore>
58
59 f 1 0 1024 10 1 ;Sine wave
60 f 2 0 1024 19 0.5 0.5 270 0.5 ;Grain envelope table
61
62 i1 0 10
63 e
64 </CsScore>
65 </CsoundSynthesizer>