| 1 |
;Written by Iain McCurdy, 2006 |
| 2 |
|
| 3 |
;Modified for QuteCsound by René, October 2010, updated Feb 2011 |
| 4 |
;Tested on Ubuntu 10.04 with csound-float 5.13.0 and QuteCsound svn rev 817 |
| 5 |
|
| 6 |
;Notes on modifications from original csd: |
| 7 |
; Add table(s) for exp slider |
| 8 |
; Add Browser for audio file and use of FilePlay2 udo, now accept mono or stereo wav files |
| 9 |
|
| 10 |
|
| 11 |
;my flags on Ubuntu: -iadc -odac -b1024 -B2048 -+rtaudio=alsa -+rtmidi=null -m0 |
| 12 |
<CsoundSynthesizer> |
| 13 |
<CsOptions> |
| 14 |
--env:SSDIR+=../../SourceMaterials |
| 15 |
</CsOptions> |
| 16 |
<CsInstruments> |
| 17 |
sr = 44100 ;SAMPLE RATE |
| 18 |
ksmps = 2 ;NUMBER OF AUDIO SAMPLES IN EACH CONTROL CYCLE |
| 19 |
nchnls = 2 ;NUMBER OF CHANNELS (2=STEREO) |
| 20 |
|
| 21 |
|
| 22 |
giExp20000 ftgen 0, 0, 129, -25, 0, 20.0, 128, 20000.0 ;TABLE FOR EXP SLIDER |
| 23 |
|
| 24 |
|
| 25 |
opcode FilePlay2, aa, Skoo ; Credit to Joachim Heintz |
| 26 |
;gives stereo output regardless your soundfile is mono or stereo |
| 27 |
Sfil, kspeed, iskip, iloop xin |
| 28 |
ichn filenchnls Sfil |
| 29 |
if ichn == 1 then |
| 30 |
aL diskin2 Sfil, kspeed, iskip, iloop |
| 31 |
aR = aL |
| 32 |
else |
| 33 |
aL, aR diskin2 Sfil, kspeed, iskip, iloop |
| 34 |
endif |
| 35 |
xout aL, aR |
| 36 |
endop |
| 37 |
|
| 38 |
|
| 39 |
instr 1 ;GUI |
| 40 |
|
| 41 |
Sfile_new strcpy "" ;INIT TO EMPTY STRING |
| 42 |
|
| 43 |
ktrig metro 10 |
| 44 |
if (ktrig == 1) then |
| 45 |
khp invalue "Filter_Cutoff" |
| 46 |
gkhp tablei khp, giExp20000, 1 |
| 47 |
outvalue "Filter_Cutoff_Value", gkhp ;init 20.0 |
| 48 |
gkgain invalue "Amplitude" |
| 49 |
|
| 50 |
gkskip invalue "Initialisation" |
| 51 |
|
| 52 |
gSfile invalue "_Browse" |
| 53 |
Sfile_old strcpyk Sfile_new |
| 54 |
Sfile_new strcpyk gSfile |
| 55 |
gkfile strcmpk Sfile_new, Sfile_old |
| 56 |
endif |
| 57 |
endin |
| 58 |
|
| 59 |
instr 2 |
| 60 |
kporttime linseg 0,0.001,0.005,1,0.005 ;CREATE A VARIABLE FUNCTION THAT RAPIDLY RAMPS UP TO A SET VALUE |
| 61 |
khp portk gkhp, kporttime ;SMOOTH MOVEMENT OF SLIDER VARIABLE |
| 62 |
|
| 63 |
kNew_file changed gkfile ;GENERATE A MOMENTARY '1' PULSE IN OUTPUT 'kSwitch' IF ANY OF THE SCANNED INPUT VARIABLES CHANGE. (OUTPUT 'kSwitch' IS NORMALLY ZERO) |
| 64 |
if kNew_file=1 then ;IF I-RATE VARIABLE CHANGE TRIGGER IS '1'... |
| 65 |
reinit NEW_FILE ;BEGIN A REINITIALISATION PASS FROM LABEL 'START' |
| 66 |
endif |
| 67 |
NEW_FILE: |
| 68 |
;OUTPUTS OPCODE FILE | SPEED | INSKIP | LOOPING (0=OFF 1=ON) |
| 69 |
asigL, asigR FilePlay2 gSfile, 1, 0, 1 ;GENERATE 2 AUDIO SIGNALS FROM A SOUND FILE |
| 70 |
rireturn ;RETURN FROM REINITIALISATION PASS TO PERFORMANCE TIME PASSES |
| 71 |
|
| 72 |
kSwitch changed gkskip ;GENERATE A MOMENTARY '1' PULSE IN OUTPUT 'kSwitch' IF ANY OF THE SCANNED INPUT VARIABLES CHANGE. (OUTPUT 'kSwitch' IS NORMALLY ZERO) |
| 73 |
if kSwitch=1 then ;IF I-RATE VARIABLE CHANGE TRIGGER IS '1'... |
| 74 |
reinit START ;BEGIN A REINITIALISATION PASS FROM LABEL 'START' |
| 75 |
endif |
| 76 |
START: |
| 77 |
aresL atone asigL, khp, i(gkskip) |
| 78 |
aresR atone asigR, khp, i(gkskip) |
| 79 |
rireturn ;RETURN FROM REINITIALISATION PASS TO PERFORMANCE TIME PASSES |
| 80 |
outs aresL * gkgain, aresR * gkgain ;SEND FILTER OUTPUT TO THE AUDIO OUTPUTS, RESCALE USING SLIDER VARIABLE gkgain |
| 81 |
endin |
| 82 |
</CsInstruments> |
| 83 |
<CsScore> |
| 84 |
;INSTR | START | DURATION |
| 85 |
i 1 0 3600 ;INSTRUMENT 1 PLAYS FOR 1 HOUR |
| 86 |
</CsScore> |
| 87 |
</CsoundSynthesizer> |
| 88 |
|
| 89 |
<bsbPanel> |
| 90 |
<label>Widgets</label> |
| 91 |
<objectName/> |
| 92 |
<x>72</x> |
| 93 |
<y>179</y> |
| 94 |
<width>400</width> |
| 95 |
<height>200</height> |
| 96 |
<visible>true</visible> |
| 97 |
<uuid/> |
| 98 |
<bgcolor mode="background"> |
| 99 |
<r>241</r> |
| 100 |
<g>226</g> |
| 101 |
<b>185</b> |
| 102 |
</bgcolor> |
| 103 |
<bsbObject version="2" type="BSBLabel"> |
| 104 |
<objectName/> |
| 105 |
<x>2</x> |
| 106 |
<y>2</y> |
| 107 |
<width>512</width> |
| 108 |
<height>240</height> |
| 109 |
<uuid>{aa607456-d368-4d59-8497-d16d608404c3}</uuid> |
| 110 |
<visible>true</visible> |
| 111 |
<midichan>0</midichan> |
| 112 |
<midicc>0</midicc> |
| 113 |
<label>atone</label> |
| 114 |
<alignment>center</alignment> |
| 115 |
<font>Liberation Sans</font> |
| 116 |
<fontsize>18</fontsize> |
| 117 |
<precision>3</precision> |
| 118 |
<color> |
| 119 |
<r>0</r> |
| 120 |
<g>0</g> |
| 121 |
<b>0</b> |
| 122 |
</color> |
| 123 |
<bgcolor mode="background"> |
| 124 |
<r>106</r> |
| 125 |
<g>117</g> |
| 126 |
<b>150</b> |
| 127 |
</bgcolor> |
| 128 |
<bordermode>border</bordermode> |
| 129 |
<borderradius>5</borderradius> |
| 130 |
<borderwidth>2</borderwidth> |
| 131 |
</bsbObject> |
| 132 |
<bsbObject version="2" type="BSBLabel"> |
| 133 |
<objectName/> |
| 134 |
<x>515</x> |
| 135 |
<y>2</y> |
| 136 |
<width>263</width> |
| 137 |
<height>240</height> |
| 138 |
<uuid>{74928ed2-b701-4668-9a11-74763d317e9b}</uuid> |
| 139 |
<visible>true</visible> |
| 140 |
<midichan>0</midichan> |
| 141 |
<midicc>0</midicc> |
| 142 |
<label>atone</label> |
| 143 |
<alignment>center</alignment> |
| 144 |
<font>Liberation Sans</font> |
| 145 |
<fontsize>18</fontsize> |
| 146 |
<precision>3</precision> |
| 147 |
<color> |
| 148 |
<r>0</r> |
| 149 |
<g>0</g> |
| 150 |
<b>0</b> |
| 151 |
</color> |
| 152 |
<bgcolor mode="background"> |
| 153 |
<r>106</r> |
| 154 |
<g>117</g> |
| 155 |
<b>150</b> |
| 156 |
</bgcolor> |
| 157 |
<bordermode>border</bordermode> |
| 158 |
<borderradius>5</borderradius> |
| 159 |
<borderwidth>2</borderwidth> |
| 160 |
</bsbObject> |
| 161 |
<bsbObject version="2" type="BSBLabel"> |
| 162 |
<objectName/> |
| 163 |
<x>516</x> |
| 164 |
<y>19</y> |
| 165 |
<width>261</width> |
| 166 |
<height>218</height> |
| 167 |
<uuid>{d4bdb5ce-87d8-4c8c-9c64-40ec2eed6f5a}</uuid> |
| 168 |
<visible>true</visible> |
| 169 |
<midichan>0</midichan> |
| 170 |
<midicc>0</midicc> |
| 171 |
<label>-------------------------------------------------------------- |
| 172 |
atone is an implementation of a second-order high-pass filter Its input arguments are for cutoff frequency (half-power point) and a 2-way switch selecting whether the data space for feedback within the filter is initially cleared or allowed to retain previously held information. Multiple iterations of the atone opcode applied to the signal path in series can be used to create a sharper cutoff slope.</label> |
| 173 |
<alignment>left</alignment> |
| 174 |
<font>Arial</font> |
| 175 |
<fontsize>14</fontsize> |
| 176 |
<precision>3</precision> |
| 177 |
<color> |
| 178 |
<r>0</r> |
| 179 |
<g>0</g> |
| 180 |
<b>0</b> |
| 181 |
</color> |
| 182 |
<bgcolor mode="nobackground"> |
| 183 |
<r>255</r> |
| 184 |
<g>255</g> |
| 185 |
<b>255</b> |
| 186 |
</bgcolor> |
| 187 |
<bordermode>noborder</bordermode> |
| 188 |
<borderradius>1</borderradius> |
| 189 |
<borderwidth>1</borderwidth> |
| 190 |
</bsbObject> |
| 191 |
<bsbObject version="2" type="BSBButton"> |
| 192 |
<objectName/> |
| 193 |
<x>8</x> |
| 194 |
<y>8</y> |
| 195 |
<width>100</width> |
| 196 |
<height>30</height> |
| 197 |
<uuid>{24979132-c53f-4414-ac6b-6b4f503ecfe8}</uuid> |
| 198 |
<visible>true</visible> |
| 199 |
<midichan>0</midichan> |
| 200 |
<midicc>0</midicc> |
| 201 |
<type>event</type> |
| 202 |
<pressedValue>1.00000000</pressedValue> |
| 203 |
<stringvalue/> |
| 204 |
<text> ON / OFF</text> |
| 205 |
<image>/</image> |
| 206 |
<eventLine>i 2 0 -1</eventLine> |
| 207 |
<latch>true</latch> |
| 208 |
<latched>false</latched> |
| 209 |
</bsbObject> |
| 210 |
<bsbObject version="2" type="BSBDisplay"> |
| 211 |
<objectName>Filter_Cutoff_Value</objectName> |
| 212 |
<x>448</x> |
| 213 |
<y>77</y> |
| 214 |
<width>60</width> |
| 215 |
<height>30</height> |
| 216 |
<uuid>{745d6bee-b951-4a03-9fe8-9e10d5ae4556}</uuid> |
| 217 |
<visible>true</visible> |
| 218 |
<midichan>0</midichan> |
| 219 |
<midicc>0</midicc> |
| 220 |
<label>582.355</label> |
| 221 |
<alignment>right</alignment> |
| 222 |
<font>Arial</font> |
| 223 |
<fontsize>9</fontsize> |
| 224 |
<precision>3</precision> |
| 225 |
<color> |
| 226 |
<r>0</r> |
| 227 |
<g>0</g> |
| 228 |
<b>0</b> |
| 229 |
</color> |
| 230 |
<bgcolor mode="nobackground"> |
| 231 |
<r>255</r> |
| 232 |
<g>255</g> |
| 233 |
<b>255</b> |
| 234 |
</bgcolor> |
| 235 |
<bordermode>noborder</bordermode> |
| 236 |
<borderradius>1</borderradius> |
| 237 |
<borderwidth>1</borderwidth> |
| 238 |
</bsbObject> |
| 239 |
<bsbObject version="2" type="BSBHSlider"> |
| 240 |
<objectName>Filter_Cutoff</objectName> |
| 241 |
<x>8</x> |
| 242 |
<y>60</y> |
| 243 |
<width>500</width> |
| 244 |
<height>27</height> |
| 245 |
<uuid>{06814721-6151-4baa-84e2-8f39843b07a4}</uuid> |
| 246 |
<visible>true</visible> |
| 247 |
<midichan>0</midichan> |
| 248 |
<midicc>0</midicc> |
| 249 |
<minimum>0.00000000</minimum> |
| 250 |
<maximum>1.00000000</maximum> |
| 251 |
<value>0.48800000</value> |
| 252 |
<mode>lin</mode> |
| 253 |
<mouseControl act="jump">continuous</mouseControl> |
| 254 |
<resolution>-1.00000000</resolution> |
| 255 |
<randomizable group="0">false</randomizable> |
| 256 |
</bsbObject> |
| 257 |
<bsbObject version="2" type="BSBLabel"> |
| 258 |
<objectName/> |
| 259 |
<x>8</x> |
| 260 |
<y>77</y> |
| 261 |
<width>180</width> |
| 262 |
<height>30</height> |
| 263 |
<uuid>{c6d7165c-6730-426f-b293-52b411bc73cf}</uuid> |
| 264 |
<visible>true</visible> |
| 265 |
<midichan>0</midichan> |
| 266 |
<midicc>0</midicc> |
| 267 |
<label>Filter Cutoff</label> |
| 268 |
<alignment>left</alignment> |
| 269 |
<font>Arial</font> |
| 270 |
<fontsize>10</fontsize> |
| 271 |
<precision>3</precision> |
| 272 |
<color> |
| 273 |
<r>0</r> |
| 274 |
<g>0</g> |
| 275 |
<b>0</b> |
| 276 |
</color> |
| 277 |
<bgcolor mode="nobackground"> |
| 278 |
<r>255</r> |
| 279 |
<g>255</g> |
| 280 |
<b>255</b> |
| 281 |
</bgcolor> |
| 282 |
<bordermode>noborder</bordermode> |
| 283 |
<borderradius>1</borderradius> |
| 284 |
<borderwidth>1</borderwidth> |
| 285 |
</bsbObject> |
| 286 |
<bsbObject version="2" type="BSBButton"> |
| 287 |
<objectName>_Browse</objectName> |
| 288 |
<x>8</x> |
| 289 |
<y>197</y> |
| 290 |
<width>170</width> |
| 291 |
<height>30</height> |
| 292 |
<uuid>{b9431a61-61f7-432b-bf6f-c47ddc7f9050}</uuid> |
| 293 |
<visible>true</visible> |
| 294 |
<midichan>0</midichan> |
| 295 |
<midicc>0</midicc> |
| 296 |
<type>value</type> |
| 297 |
<pressedValue>1.00000000</pressedValue> |
| 298 |
<stringvalue>Seashore.wav</stringvalue> |
| 299 |
<text>Browse Audio File</text> |
| 300 |
<image>/</image> |
| 301 |
<eventLine/> |
| 302 |
<latch>false</latch> |
| 303 |
<latched>false</latched> |
| 304 |
</bsbObject> |
| 305 |
<bsbObject version="2" type="BSBLineEdit"> |
| 306 |
<objectName>_Browse</objectName> |
| 307 |
<x>179</x> |
| 308 |
<y>198</y> |
| 309 |
<width>330</width> |
| 310 |
<height>28</height> |
| 311 |
<uuid>{68b5f90b-b78e-4581-b434-232db5f4c40f}</uuid> |
| 312 |
<visible>true</visible> |
| 313 |
<midichan>0</midichan> |
| 314 |
<midicc>0</midicc> |
| 315 |
<label>Seashore.wav</label> |
| 316 |
<alignment>left</alignment> |
| 317 |
<font>Arial</font> |
| 318 |
<fontsize>10</fontsize> |
| 319 |
<precision>3</precision> |
| 320 |
<color> |
| 321 |
<r>0</r> |
| 322 |
<g>0</g> |
| 323 |
<b>0</b> |
| 324 |
</color> |
| 325 |
<bgcolor mode="nobackground"> |
| 326 |
<r>229</r> |
| 327 |
<g>229</g> |
| 328 |
<b>229</b> |
| 329 |
</bgcolor> |
| 330 |
<background>nobackground</background> |
| 331 |
</bsbObject> |
| 332 |
<bsbObject version="2" type="BSBLabel"> |
| 333 |
<objectName/> |
| 334 |
<x>8</x> |
| 335 |
<y>176</y> |
| 336 |
<width>150</width> |
| 337 |
<height>30</height> |
| 338 |
<uuid>{936f6eb0-5225-4bd7-a5fe-a49df1c9c5ac}</uuid> |
| 339 |
<visible>true</visible> |
| 340 |
<midichan>0</midichan> |
| 341 |
<midicc>0</midicc> |
| 342 |
<label>Audio File</label> |
| 343 |
<alignment>left</alignment> |
| 344 |
<font>Arial</font> |
| 345 |
<fontsize>10</fontsize> |
| 346 |
<precision>3</precision> |
| 347 |
<color> |
| 348 |
<r>0</r> |
| 349 |
<g>0</g> |
| 350 |
<b>0</b> |
| 351 |
</color> |
| 352 |
<bgcolor mode="nobackground"> |
| 353 |
<r>255</r> |
| 354 |
<g>255</g> |
| 355 |
<b>255</b> |
| 356 |
</bgcolor> |
| 357 |
<bordermode>noborder</bordermode> |
| 358 |
<borderradius>1</borderradius> |
| 359 |
<borderwidth>1</borderwidth> |
| 360 |
</bsbObject> |
| 361 |
<bsbObject version="2" type="BSBLabel"> |
| 362 |
<objectName/> |
| 363 |
<x>8</x> |
| 364 |
<y>138</y> |
| 365 |
<width>180</width> |
| 366 |
<height>30</height> |
| 367 |
<uuid>{2e52a7a7-dc13-405e-896d-db2a7431d8dd}</uuid> |
| 368 |
<visible>true</visible> |
| 369 |
<midichan>0</midichan> |
| 370 |
<midicc>0</midicc> |
| 371 |
<label>Output Amplitude Scaling</label> |
| 372 |
<alignment>left</alignment> |
| 373 |
<font>Arial</font> |
| 374 |
<fontsize>10</fontsize> |
| 375 |
<precision>3</precision> |
| 376 |
<color> |
| 377 |
<r>0</r> |
| 378 |
<g>0</g> |
| 379 |
<b>0</b> |
| 380 |
</color> |
| 381 |
<bgcolor mode="nobackground"> |
| 382 |
<r>255</r> |
| 383 |
<g>255</g> |
| 384 |
<b>255</b> |
| 385 |
</bgcolor> |
| 386 |
<bordermode>noborder</bordermode> |
| 387 |
<borderradius>1</borderradius> |
| 388 |
<borderwidth>1</borderwidth> |
| 389 |
</bsbObject> |
| 390 |
<bsbObject version="2" type="BSBHSlider"> |
| 391 |
<objectName>Amplitude</objectName> |
| 392 |
<x>8</x> |
| 393 |
<y>121</y> |
| 394 |
<width>500</width> |
| 395 |
<height>27</height> |
| 396 |
<uuid>{6ab84e0f-82a7-4b9c-af23-35bd7d9b7fa2}</uuid> |
| 397 |
<visible>true</visible> |
| 398 |
<midichan>0</midichan> |
| 399 |
<midicc>0</midicc> |
| 400 |
<minimum>0.00000000</minimum> |
| 401 |
<maximum>1.00000000</maximum> |
| 402 |
<value>0.60400000</value> |
| 403 |
<mode>lin</mode> |
| 404 |
<mouseControl act="jump">continuous</mouseControl> |
| 405 |
<resolution>-1.00000000</resolution> |
| 406 |
<randomizable group="0">false</randomizable> |
| 407 |
</bsbObject> |
| 408 |
<bsbObject version="2" type="BSBDisplay"> |
| 409 |
<objectName>Amplitude</objectName> |
| 410 |
<x>448</x> |
| 411 |
<y>138</y> |
| 412 |
<width>60</width> |
| 413 |
<height>30</height> |
| 414 |
<uuid>{99d6bf8b-3c85-4911-a29a-7dd678a940ed}</uuid> |
| 415 |
<visible>true</visible> |
| 416 |
<midichan>0</midichan> |
| 417 |
<midicc>0</midicc> |
| 418 |
<label>0.604</label> |
| 419 |
<alignment>right</alignment> |
| 420 |
<font>Arial</font> |
| 421 |
<fontsize>9</fontsize> |
| 422 |
<precision>3</precision> |
| 423 |
<color> |
| 424 |
<r>0</r> |
| 425 |
<g>0</g> |
| 426 |
<b>0</b> |
| 427 |
</color> |
| 428 |
<bgcolor mode="nobackground"> |
| 429 |
<r>255</r> |
| 430 |
<g>255</g> |
| 431 |
<b>255</b> |
| 432 |
</bgcolor> |
| 433 |
<bordermode>noborder</bordermode> |
| 434 |
<borderradius>1</borderradius> |
| 435 |
<borderwidth>1</borderwidth> |
| 436 |
</bsbObject> |
| 437 |
<bsbObject version="2" type="BSBButton"> |
| 438 |
<objectName>Initialisation</objectName> |
| 439 |
<x>380</x> |
| 440 |
<y>8</y> |
| 441 |
<width>130</width> |
| 442 |
<height>29</height> |
| 443 |
<uuid>{b6345774-7938-4e62-9d8b-0ada81f7bcc5}</uuid> |
| 444 |
<visible>true</visible> |
| 445 |
<midichan>0</midichan> |
| 446 |
<midicc>0</midicc> |
| 447 |
<type>value</type> |
| 448 |
<pressedValue>1.00000000</pressedValue> |
| 449 |
<stringvalue/> |
| 450 |
<text> No Initialisation</text> |
| 451 |
<image>/</image> |
| 452 |
<eventLine/> |
| 453 |
<latch>true</latch> |
| 454 |
<latched>false</latched> |
| 455 |
</bsbObject> |
| 456 |
</bsbPanel> |
| 457 |
<bsbPresets> |
| 458 |
</bsbPresets> |
| 459 |
<EventPanel name="" tempo="60.00000000" loop="8.00000000" x="913" y="162" width="655" height="346" visible="false" loopStart="0" loopEnd="0"> </EventPanel> |