| 1 |
<CsoundSynthesizer> |
| 2 |
<CsOptions> |
| 3 |
-odac |
| 4 |
</CsOptions> |
| 5 |
<CsInstruments> |
| 6 |
|
| 7 |
sr = 44100 |
| 8 |
ksmps = 32 |
| 9 |
nchnls = 2 |
| 10 |
|
| 11 |
; Demonstarion of Qt integration with csound over CsoundQt python API |
| 12 |
; Tarmo Johannes [email protected] |
| 13 |
|
| 14 |
; run color-controller.py to launch the color dialog |
| 15 |
|
| 16 |
; instruments from Richard Bolanger's "Trapped in convert" (slightly changed) |
| 17 |
|
| 18 |
garvb init 0 |
| 19 |
alwayson "_reverb" |
| 20 |
|
| 21 |
;============================================================================; |
| 22 |
;==================================== RED ===================================; |
| 23 |
;============================================================================; |
| 24 |
; parameters from original score |
| 25 |
;i 8 15.5 3.1 3 50 4000 129 8 2.6 0.3 |
| 26 |
instr red |
| 27 |
ifuncl = 16 |
| 28 |
|
| 29 |
p4 = 2.2 ; amp |
| 30 |
p5 = 50 ; FilterSweep StartFreq |
| 31 |
p6 = 4000 ; FilterSweep EndFreq |
| 32 |
p7= 129 ; bandwidth |
| 33 |
p8 = 8 ; cps of rand1 |
| 34 |
p9 = 2.6 ; cps of rand2 |
| 35 |
p10 = 0.3 ; reverb send factor |
| 36 |
|
| 37 |
k1 expon p5, p3, p6 |
| 38 |
k2 line p8, p3, p8 * .93 |
| 39 |
k3 phasor k2 |
| 40 |
k4 table k3 * ifuncl, 20 |
| 41 |
anoise rand 8000 |
| 42 |
aflt1 reson anoise, k1, 20 + (k4 * k1 / p7), 1 |
| 43 |
|
| 44 |
k5 linseg p6 * .9, p3 * .8, p5 * 1.4, p3 * .2, p5 * 1.4 |
| 45 |
k6 expon p9 * .97, p3, p9 |
| 46 |
k7 phasor k6 |
| 47 |
k8 tablei k7 * ifuncl, 21 |
| 48 |
aflt2 reson anoise, k5, 30 + (k8 * k5 / p7 * .9), 1 |
| 49 |
|
| 50 |
abal oscil 1000, 1000, 1 |
| 51 |
a3 balance aflt1, abal |
| 52 |
a5 balance aflt2, abal |
| 53 |
|
| 54 |
|
| 55 |
k11 linen p4, .15, p3, .5 |
| 56 |
a3 = a3 * k11 |
| 57 |
a5 = a5 * k11 |
| 58 |
|
| 59 |
k9 randh 1, k2 |
| 60 |
aleft = ((a3 * k9) * .7) + ((a5 * k9) * .3) |
| 61 |
k10 randh 1, k6 |
| 62 |
aright = ((a3 * k10) * .3)+((a5 * k10) * .7) |
| 63 |
klevel invalue "red" |
| 64 |
klevel port klevel,0.05 |
| 65 |
outs aleft*klevel, aright*klevel |
| 66 |
garvb = garvb + (a3 * p10)*klevel |
| 67 |
endin |
| 68 |
|
| 69 |
;============================================================================; |
| 70 |
;==================================== BLUE ==================================; |
| 71 |
;============================================================================; |
| 72 |
;i 2 80.7 8 0 8.077 830 0.7 24 19 0.13 |
| 73 |
instr blue ; p6 = amp |
| 74 |
|
| 75 |
p5 = 8.077 ; pitch |
| 76 |
p6 = 830 ; amp |
| 77 |
p7 = 0.7 ; reverb send factor |
| 78 |
p8 = 24 ; lfo freq |
| 79 |
p9 = 19 ; number of harmonic |
| 80 |
p10 = 0.1+rnd(0.2) ;0.5 ; sweep rate |
| 81 |
|
| 82 |
ifreq random 500,1000;cpspch(p5) |
| 83 |
k1 randi 1, 30 |
| 84 |
k2 linseg 0, p3 * .5, 1, p3 * .5, 0 |
| 85 |
k3 linseg .005, p3 * .71, .015, p3 * .29, .01 |
| 86 |
k4 oscil k2, p8, 1,.2 |
| 87 |
k5 = k4 + 2 |
| 88 |
|
| 89 |
ksweep linseg p9, p3 * p10, 1, p3 * (p3 - (p3 * p10)), 1 |
| 90 |
|
| 91 |
kenv expseg .001, p3 * .01, p6, p3 * .99, .001 |
| 92 |
asig gbuzz kenv, ifreq + k3, k5, ksweep, k1, 15 |
| 93 |
|
| 94 |
klevel invalue "blue" |
| 95 |
klevel port klevel,0.05 |
| 96 |
asig = asig*klevel |
| 97 |
outs asig, asig |
| 98 |
garvb = garvb + (asig * p7) |
| 99 |
endin |
| 100 |
|
| 101 |
|
| 102 |
;============================================================================; |
| 103 |
;==================================== GREEN =================================; |
| 104 |
;============================================================================; |
| 105 |
; i 5 43 1.1 9.6 3.106 2500 0.4 1.0 8 3 17 34 |
| 106 |
|
| 107 |
instr green ; p6 = amp |
| 108 |
p5 = 3.106 ; pitch |
| 109 |
p6 = 2500 ; amp |
| 110 |
p7 = 0.4 ; reverb send |
| 111 |
p8 = 0.5 ; pan direction |
| 112 |
p9 = 8 ; carrier freq |
| 113 |
p10 = 3 ; modulator freq |
| 114 |
p11 = 17 ; modulation index |
| 115 |
p12 = 34 ; rand freq |
| 116 |
|
| 117 |
ifreq = cpspch(p5) ; p7 = reverb send factor |
| 118 |
; p8 = pan direction |
| 119 |
k1 line p9, p3, 1 ; ... (1.0 = L -> R, 0.1 = R -> L) |
| 120 |
k2 line 1, p3, p10 ; p9 = carrier freq |
| 121 |
k4 expon 2, p3, p12 ; p10 = modulator freq |
| 122 |
k5 linseg 0, p3 * .8, 8, p3 * .2, 8 ; p11 = modulation index |
| 123 |
k7 randh p11, k4 ; p12 = rand freq |
| 124 |
k6 oscil k4, k5, 1, .3 |
| 125 |
|
| 126 |
kenv1 linen p6, .03, p3, .2 |
| 127 |
a1 foscil kenv1, ifreq + k6, k1, k2, k7, 1 |
| 128 |
|
| 129 |
kenv2 linen p6, .1, p3, .1 |
| 130 |
a2 oscil kenv2, ifreq * 1.001, 1 |
| 131 |
|
| 132 |
amix = a1 + a2 |
| 133 |
kpan linseg int(p8), p3 * .7, frac(p8), p3 * .3, int(p8) |
| 134 |
klevel invalue "green" |
| 135 |
klevel port klevel,0.05 |
| 136 |
amix = amix*klevel |
| 137 |
outs amix * kpan, amix * (1 - kpan) |
| 138 |
garvb = garvb + (amix * p7) |
| 139 |
endin |
| 140 |
|
| 141 |
|
| 142 |
instr _reverb |
| 143 |
p4 = 1/10 ; p4 = panrate |
| 144 |
k1 oscil .5, p4, 1 |
| 145 |
k2 = .5 + k1 |
| 146 |
k3 = 1 - k2 |
| 147 |
asig reverb garvb, 2.1 |
| 148 |
outs asig * k2, (asig * k3) * (-1) |
| 149 |
garvb = 0 |
| 150 |
endin |
| 151 |
|
| 152 |
</CsInstruments> |
| 153 |
<CsScore> |
| 154 |
;============================================================================; |
| 155 |
;========================= FUNCTIONS ========================================; |
| 156 |
;============================================================================; |
| 157 |
f1 0 8192 10 1 |
| 158 |
; 15 - vaja |
| 159 |
f15 0 8192 9 1 1 90 |
| 160 |
;kasutusel red |
| 161 |
f16 0 2048 9 1 3 0 3 1 0 6 1 0 |
| 162 |
f20 0 16 -2 0 30 40 45 50 40 30 20 10 5 4 3 2 1 0 0 0 |
| 163 |
f21 0 16 -2 0 20 15 10 9 8 7 6 5 4 3 2 1 0 0 |
| 164 |
|
| 165 |
r 3 COUNT |
| 166 |
i "red" 0 20 |
| 167 |
i "green" 0 20 |
| 168 |
i "blue" 0 6 |
| 169 |
i . + 3 |
| 170 |
i . + 4 |
| 171 |
i . + 7 |
| 172 |
s |
| 173 |
|
| 174 |
f 0 1800 |
| 175 |
|
| 176 |
</CsScore> |
| 177 |
|
| 178 |
</CsoundSynthesizer> |
| 179 |
|
| 180 |
|
| 181 |
<bsbPanel> |
| 182 |
<label>Widgets</label> |
| 183 |
<objectName/> |
| 184 |
<x>0</x> |
| 185 |
<y>22</y> |
| 186 |
<width>318</width> |
| 187 |
<height>529</height> |
| 188 |
<visible>true</visible> |
| 189 |
<uuid/> |
| 190 |
<bgcolor mode="nobackground"> |
| 191 |
<r>231</r> |
| 192 |
<g>46</g> |
| 193 |
<b>255</b> |
| 194 |
</bgcolor> |
| 195 |
<bsbObject version="2" type="BSBController"> |
| 196 |
<objectName>hor0</objectName> |
| 197 |
<x>10</x> |
| 198 |
<y>10</y> |
| 199 |
<width>30</width> |
| 200 |
<height>80</height> |
| 201 |
<uuid>{4c105ed3-3b95-4237-b413-994af2ec8a22}</uuid> |
| 202 |
<visible>true</visible> |
| 203 |
<midichan>0</midichan> |
| 204 |
<midicc>0</midicc> |
| 205 |
<objectName2>red</objectName2> |
| 206 |
<xMin>0.00000000</xMin> |
| 207 |
<xMax>1.00000000</xMax> |
| 208 |
<yMin>0.00000000</yMin> |
| 209 |
<yMax>1.00000000</yMax> |
| 210 |
<xValue>0.00000000</xValue> |
| 211 |
<yValue>1.00000000</yValue> |
| 212 |
<type>fill</type> |
| 213 |
<pointsize>1</pointsize> |
| 214 |
<fadeSpeed>0.00000000</fadeSpeed> |
| 215 |
<mouseControl act="press">jump</mouseControl> |
| 216 |
<color> |
| 217 |
<r>255</r> |
| 218 |
<g>0</g> |
| 219 |
<b>0</b> |
| 220 |
</color> |
| 221 |
<randomizable mode="both" group="0">false</randomizable> |
| 222 |
<bgcolor> |
| 223 |
<r>0</r> |
| 224 |
<g>0</g> |
| 225 |
<b>0</b> |
| 226 |
</bgcolor> |
| 227 |
</bsbObject> |
| 228 |
<bsbObject version="2" type="BSBController"> |
| 229 |
<objectName>hor1</objectName> |
| 230 |
<x>50</x> |
| 231 |
<y>10</y> |
| 232 |
<width>30</width> |
| 233 |
<height>80</height> |
| 234 |
<uuid>{dc792769-7e79-4210-a648-a39be5fa1d6b}</uuid> |
| 235 |
<visible>true</visible> |
| 236 |
<midichan>0</midichan> |
| 237 |
<midicc>0</midicc> |
| 238 |
<objectName2>green</objectName2> |
| 239 |
<xMin>0.00000000</xMin> |
| 240 |
<xMax>1.00000000</xMax> |
| 241 |
<yMin>0.00000000</yMin> |
| 242 |
<yMax>1.00000000</yMax> |
| 243 |
<xValue>0.00000000</xValue> |
| 244 |
<yValue>0.20833143</yValue> |
| 245 |
<type>fill</type> |
| 246 |
<pointsize>1</pointsize> |
| 247 |
<fadeSpeed>0.00000000</fadeSpeed> |
| 248 |
<mouseControl act="press">jump</mouseControl> |
| 249 |
<color> |
| 250 |
<r>0</r> |
| 251 |
<g>234</g> |
| 252 |
<b>0</b> |
| 253 |
</color> |
| 254 |
<randomizable mode="both" group="0">false</randomizable> |
| 255 |
<bgcolor> |
| 256 |
<r>0</r> |
| 257 |
<g>0</g> |
| 258 |
<b>0</b> |
| 259 |
</bgcolor> |
| 260 |
</bsbObject> |
| 261 |
<bsbObject version="2" type="BSBController"> |
| 262 |
<objectName>hor2</objectName> |
| 263 |
<x>90</x> |
| 264 |
<y>10</y> |
| 265 |
<width>30</width> |
| 266 |
<height>80</height> |
| 267 |
<uuid>{3307953d-ad3f-4ca6-bf80-c152442139a0}</uuid> |
| 268 |
<visible>true</visible> |
| 269 |
<midichan>0</midichan> |
| 270 |
<midicc>0</midicc> |
| 271 |
<objectName2>blue</objectName2> |
| 272 |
<xMin>0.00000000</xMin> |
| 273 |
<xMax>1.00000000</xMax> |
| 274 |
<yMin>0.00000000</yMin> |
| 275 |
<yMax>1.00000000</yMax> |
| 276 |
<xValue>0.00000000</xValue> |
| 277 |
<yValue>0.25552758</yValue> |
| 278 |
<type>fill</type> |
| 279 |
<pointsize>1</pointsize> |
| 280 |
<fadeSpeed>0.00000000</fadeSpeed> |
| 281 |
<mouseControl act="press">jump</mouseControl> |
| 282 |
<color> |
| 283 |
<r>0</r> |
| 284 |
<g>0</g> |
| 285 |
<b>255</b> |
| 286 |
</color> |
| 287 |
<randomizable mode="both" group="0">false</randomizable> |
| 288 |
<bgcolor> |
| 289 |
<r>0</r> |
| 290 |
<g>0</g> |
| 291 |
<b>0</b> |
| 292 |
</bgcolor> |
| 293 |
</bsbObject> |
| 294 |
</bsbPanel> |
| 295 |
<bsbPresets> |
| 296 |
</bsbPresets> |