aboutsummaryrefslogtreecommitdiff
path: root/examples/01-example.csd
blob: 55e13274746a47a0a812aa934c76d5156ddd4dd4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
<CsoundSynthesizer>
<CsOptions>
-odac
</CsOptions>
<CsInstruments>
sr = 48000
kr = 4800
nchnls = 2
0dbfs = 1
seed 0

ifreqmin = 50
ifreqmax = 1000 ; was 1000
gifreqrange ftgen 0, 0, 48, -2,ifreqmin,ifreqmax,ifreqmin,ifreqmax,ifreqmin,ifreqmax,ifreqmin,ifreqmax,ifreqmin,ifreqmax,ifreqmin,ifreqmax,ifreqmin,ifreqmax,ifreqmin,ifreqmax,ifreqmin,ifreqmax,ifreqmin,ifreqmax,ifreqmin,ifreqmax,ifreqmin,ifreqmax,ifreqmin,ifreqmax,ifreqmin,ifreqmax,ifreqmin,ifreqmax,ifreqmin,ifreqmax,ifreqmin,ifreqmax,ifreqmin,ifreqmax,ifreqmin,ifreqmax,ifreqmin,ifreqmax,ifreqmin,ifreqmax,ifreqmin,ifreqmax,ifreqmin,ifreqmax,ifreqmin,ifreqmax
giqrange ftgen 0, 0, 48, -2,10,500,10,500,10,500,10,500,10,500,10,500,10,500,10,500,10,500,10,500,10,500,10,500,10,500,10,500,10,500,10,500,10,500,10,500,10,500,10,500,10,500,10,500,10,500,10,500

instr gui
    iy = 0
    FLpanel "Gutter", 800, 800
            gkgamma, ih1 FLslider "Gamma", 0, 10, 0, 1, -1, 200, 30, 0, iy
            gkomega, ih2 FLslider "Omega", 0, 1, 0, 1, -1, 200, 30, 0, iy+50
            gkc, ih3 FLslider "C", 0, 2, 0, 1, -1, 200, 30, 0, iy+100
            gkdt, ih4 FLslider "DT", 0, 1000, 0, 1, -1, 200, 30, 0, iy+150
            gksgain, ih5 FLslider "SGain", 0, 2, 0, 1, -1, 200, 30, 0, iy+200

            gkfindex, ih6 FLslider "GIndex", 0, 24, 0, 1, -1, 200, 30, 0, iy+300
            gkfvalue, ih7 FLslider "GVal", 0, 1, 0, 1, -1, 200, 30, 0, iy+350

            kb1, ih8 FLbutton "Randomise", 1, 0, 1, 100, 50, 0, iy+450, 0, nstrnum("randomisefilters"), 0, 1

            FLvslidBnk " ", 24, 1, 500, 100, 250, 0
            FLvslidBnk " ", 24, 2, 500, 100, 250, 100, 0, 0, 0, gifreqrange
            FLvslidBnk " ", 24, 3, 500, 100, 250, 200, 0, 0, 0, giqrange

            FLvslidBnk " ", 24, 4, 500, 100, 250, 350
            FLvslidBnk " ", 24, 5, 500, 100, 250, 450, 0, 0, 0, gifreqrange
            FLvslidBnk " ", 24, 6, 500, 100, 250, 550, 0, 0, 0, giqrange
    FLpanelEnd
    FLrun
endin

gigaintbls[] fillarray 1, 4
gifreqtbls[] fillarray 2, 5
giqtables[] fillarray 3, 6


// ibankcount, ifiltercount, igaintbls[], ifreqtbls[], iqtables[], kgamma, komega, kc, kdt, ksinglegain, kfiltersOn, ksmoothing, kdistmethod
gigutter init 0
instr play
    ifilteron = 1
    idistmethod = 2 ;5 ;2
    ismoothing = 1 ; 0

    ibankcount = 2
    ifiltercount = 24
    
    aout gutter ibankcount, ifiltercount, gigaintbls, gifreqtbls, giqtables, gkgamma, gkomega, gkc, gkdt, gksgain, ifilteron, ismoothing, idistmethod
    aout2 gutter ibankcount, ifiltercount, gigaintbls, gifreqtbls, giqtables, gkgamma*0.9, gkomega*0.9, gkc*0.9, gkdt*0.9, gksgain, ifilteron, ismoothing, idistmethod
    aout dcblock aout*0.2
    aout butterhp aout, 10

    aout2 dcblock aout2*0.2
    aout2 butterhp aout2, 10

    outs aout*0.2, aout2*0.2
    ;aL, aR freeverb aout*0.3, aout2*0.3, 1, 0.3
    ;outs aL, aR
endin

opcode randtbls, 0, i[]ii
    itbls[], imin, imax xin
    index = 0
    while (index < lenarray(itbls)) do
        ifn = itbls[index]
        index2 = 0
        while (index2 < ftlen(ifn)) do
            tablew random(imin, imax), index2, ifn
            index2 += 1
        od
        index += 1
    od
endop

instr randomisefilters
    randtbls gigaintbls, 0, 1
    randtbls gifreqtbls, 100, 4000
    randtbls giqtables, 10, 500
endin

instr updatetbls
    tablew 100+(gkfvalue*2000), gkfindex, 2
    tablew 100+(gkfvalue*2000), gkfindex, 5
endin


instr rndtbls
    tablew random:k(0, 1), int:k(random:k(0, 24)), 1
    tablew random:k(100, 5000), int:k(random:k(0, 24)), 2
    tablew random:k(10, 500), int:k(random:k(0, 24)), 3
    tablew random:k(0, 1), int:k(random:k(0, 24)), 4
    tablew random:k(100, 5000), int:k(random:k(0, 24)), 5
    tablew random:k(10, 500), int:k(random:k(0, 24)), 6
endin


instr rndtbls2
    tablew abs:k(oscil:k(0.5, 0.1)) + 0.5, int:k(random:k(0, 24)), 1
    tablew abs:k(oscil:k(1000, 0.2)) + 200, int:k(random:k(0, 24)), 2
    tablew abs:k(oscil:k(50, 0.3)) + 10, int:k(random:k(0, 24)), 3
    tablew abs:k(oscil:k(0.5, 0.4)) + 0.5, int:k(random:k(0, 24)), 4
    tablew abs:k(oscil:k(3000, 0.5)) + 200, int:k(random:k(0, 24)), 5
    tablew abs:k(oscil:k(50, 0.6)) + 10, int:k(random:k(0, 24)), 6
endin

instr rndtbls3
    kmetro metro 1
    schedkwhen kmetro, 0, 0, "rndtbls", 0, 0.1
endin

</CsInstruments>
<CsScore>
f1 0 -24 -2 0.319 0.785 0.335 0.908 0.209 0.445 0.851 0.664 0.513 0.977 0.805 0.593 0.487 0.128 0.24 0.196 0.587 0.594 0.705 0.308 0.925 0.447 0.965 0.497
f2 0 -24 -2 1390 792 375 3061 2953 3088 934 280 2014 992 3736 1372 3563 1850 2653 1598 3010 779 253 678 2322 3361 563 2577
f3 0 -24 -2 374 276 159 383 371 414 282 293 245 336 277 98 60 400 185 353 161 251 56 261 16 390 439 305

f4 0 -24 -2 0.8 0.989 0.617 0.231 0.548 0.943 0.065 0.419 0.829 0.941 0.95 0.5 0.102 0.55 0.628 0.985 0.779 0.789 0.649 0.098 0.543 0.035 0.647 0.634
f5 0 -24 -2 1601 2692 940 2642 3764 1339 902 1124 632 595 2951 2324 1787 495 907 1751 1862 2963 3341 3990 231 400 613 3838
f6 0 -24 -2 374 276 159 383 371 414 282 293 245 336 277 98 60 400 185 353 161 251 56 261 16 390 439 305

i"gui" 0 z
i"play" 0 z
;i"rndtbls3" 10 z
</CsScore>
</CsoundSynthesizer>