| 1 |
;Written by Iain McCurdy, 2006 |
| 2 |
|
| 3 |
;Modified for QuteCsound by René, November 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 = 100 ;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 |
ktrig metro 10 |
| 41 |
if (ktrig == 1) then |
| 42 |
|
| 43 |
Sfile_new strcpy "" ;INIT TO EMPTY STRING |
| 44 |
|
| 45 |
khp invalue "Filter_Cutoff" |
| 46 |
gkhp tablei khp, giExp20000, 1 |
| 47 |
outvalue "Filter_Cutoff_Value", gkhp |
| 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 STEREO 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 tone asigL, khp, i(gkskip) |
| 78 |
aresR tone 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 ;GUI |
| 86 |
</CsScore> |
| 87 |
</CsoundSynthesizer> |
| 88 |
|
| 89 |
<bsbPanel> |
| 90 |
<label>Widgets</label> |
| 91 |
<objectName/> |
| 92 |
<x>329</x> |
| 93 |
<y>354</y> |
| 94 |
<width>937</width> |
| 95 |
<height>195</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>190</height> |
| 109 |
<uuid>{aa607456-d368-4d59-8497-d16d608404c3}</uuid> |
| 110 |
<visible>true</visible> |
| 111 |
<midichan>0</midichan> |
| 112 |
<midicc>0</midicc> |
| 113 |
<label>tone</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>418</width> |
| 137 |
<height>190</height> |
| 138 |
<uuid>{74928ed2-b701-4668-9a11-74763d317e9b}</uuid> |
| 139 |
<visible>true</visible> |
| 140 |
<midichan>0</midichan> |
| 141 |
<midicc>0</midicc> |
| 142 |
<label>tone</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>519</x> |
| 164 |
<y>19</y> |
| 165 |
<width>414</width> |
| 166 |
<height>173</height> |
| 167 |
<uuid>{d4bdb5ce-87d8-4c8c-9c64-40ec2eed6f5a}</uuid> |
| 168 |
<visible>true</visible> |
| 169 |
<midichan>0</midichan> |
| 170 |
<midicc>0</midicc> |
| 171 |
<label>---------------------------------------------------------------------------------------------------- |
| 172 |
tone is an implementation of a second-order low-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. As its name suggests, the audible effect of the tone opcode on an audio signal is similar to that of a tone control. Multiple iterations of the tone opcode applied to the signal path in series can be used to create a sharper cutoff curve.</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>6</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>true</latched> |
| 209 |
</bsbObject> |
| 210 |
<bsbObject version="2" type="BSBDisplay"> |
| 211 |
<objectName>Filter_Cutoff_Value</objectName> |
| 212 |
<x>448</x> |
| 213 |
<y>63</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>389.991</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>46</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.43000000</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>63</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="BSBHSlider"> |
| 287 |
<objectName>Amplitude</objectName> |
| 288 |
<x>8</x> |
| 289 |
<y>84</y> |
| 290 |
<width>500</width> |
| 291 |
<height>27</height> |
| 292 |
<uuid>{42fe25e5-e98f-4f00-872c-f791822a1b3e}</uuid> |
| 293 |
<visible>true</visible> |
| 294 |
<midichan>0</midichan> |
| 295 |
<midicc>0</midicc> |
| 296 |
<minimum>0.00000000</minimum> |
| 297 |
<maximum>2.00000000</maximum> |
| 298 |
<value>0.69200000</value> |
| 299 |
<mode>lin</mode> |
| 300 |
<mouseControl act="jump">continuous</mouseControl> |
| 301 |
<resolution>-1.00000000</resolution> |
| 302 |
<randomizable group="0">false</randomizable> |
| 303 |
</bsbObject> |
| 304 |
<bsbObject version="2" type="BSBDisplay"> |
| 305 |
<objectName>Amplitude</objectName> |
| 306 |
<x>448</x> |
| 307 |
<y>101</y> |
| 308 |
<width>60</width> |
| 309 |
<height>30</height> |
| 310 |
<uuid>{a8f35453-f236-447d-88d9-1a0b135383b6}</uuid> |
| 311 |
<visible>true</visible> |
| 312 |
<midichan>0</midichan> |
| 313 |
<midicc>0</midicc> |
| 314 |
<label>0.692</label> |
| 315 |
<alignment>right</alignment> |
| 316 |
<font>Arial</font> |
| 317 |
<fontsize>9</fontsize> |
| 318 |
<precision>3</precision> |
| 319 |
<color> |
| 320 |
<r>0</r> |
| 321 |
<g>0</g> |
| 322 |
<b>0</b> |
| 323 |
</color> |
| 324 |
<bgcolor mode="nobackground"> |
| 325 |
<r>255</r> |
| 326 |
<g>255</g> |
| 327 |
<b>255</b> |
| 328 |
</bgcolor> |
| 329 |
<bordermode>noborder</bordermode> |
| 330 |
<borderradius>1</borderradius> |
| 331 |
<borderwidth>1</borderwidth> |
| 332 |
</bsbObject> |
| 333 |
<bsbObject version="2" type="BSBButton"> |
| 334 |
<objectName>Initialisation</objectName> |
| 335 |
<x>380</x> |
| 336 |
<y>6</y> |
| 337 |
<width>130</width> |
| 338 |
<height>30</height> |
| 339 |
<uuid>{88395e38-ecab-4818-bef3-1a18b504f914}</uuid> |
| 340 |
<visible>true</visible> |
| 341 |
<midichan>0</midichan> |
| 342 |
<midicc>0</midicc> |
| 343 |
<type>value</type> |
| 344 |
<pressedValue>1.00000000</pressedValue> |
| 345 |
<stringvalue/> |
| 346 |
<text> No Initialisation</text> |
| 347 |
<image>/</image> |
| 348 |
<eventLine/> |
| 349 |
<latch>true</latch> |
| 350 |
<latched>false</latched> |
| 351 |
</bsbObject> |
| 352 |
<bsbObject version="2" type="BSBButton"> |
| 353 |
<objectName>_Browse</objectName> |
| 354 |
<x>8</x> |
| 355 |
<y>153</y> |
| 356 |
<width>170</width> |
| 357 |
<height>30</height> |
| 358 |
<uuid>{43341095-bc3a-4607-bd0e-01254da7bc67}</uuid> |
| 359 |
<visible>true</visible> |
| 360 |
<midichan>0</midichan> |
| 361 |
<midicc>0</midicc> |
| 362 |
<type>value</type> |
| 363 |
<pressedValue>1.00000000</pressedValue> |
| 364 |
<stringvalue>Seashore.wav</stringvalue> |
| 365 |
<text>Browse Audio File</text> |
| 366 |
<image>/</image> |
| 367 |
<eventLine/> |
| 368 |
<latch>false</latch> |
| 369 |
<latched>false</latched> |
| 370 |
</bsbObject> |
| 371 |
<bsbObject version="2" type="BSBLineEdit"> |
| 372 |
<objectName>_Browse</objectName> |
| 373 |
<x>177</x> |
| 374 |
<y>154</y> |
| 375 |
<width>330</width> |
| 376 |
<height>28</height> |
| 377 |
<uuid>{b66f3878-dfd0-4290-9b9d-73be88197222}</uuid> |
| 378 |
<visible>true</visible> |
| 379 |
<midichan>0</midichan> |
| 380 |
<midicc>0</midicc> |
| 381 |
<label>Seashore.wav</label> |
| 382 |
<alignment>left</alignment> |
| 383 |
<font>Arial</font> |
| 384 |
<fontsize>10</fontsize> |
| 385 |
<precision>3</precision> |
| 386 |
<color> |
| 387 |
<r>0</r> |
| 388 |
<g>0</g> |
| 389 |
<b>0</b> |
| 390 |
</color> |
| 391 |
<bgcolor mode="nobackground"> |
| 392 |
<r>229</r> |
| 393 |
<g>229</g> |
| 394 |
<b>229</b> |
| 395 |
</bgcolor> |
| 396 |
<background>nobackground</background> |
| 397 |
</bsbObject> |
| 398 |
<bsbObject version="2" type="BSBLabel"> |
| 399 |
<objectName/> |
| 400 |
<x>8</x> |
| 401 |
<y>131</y> |
| 402 |
<width>160</width> |
| 403 |
<height>30</height> |
| 404 |
<uuid>{7e1e7af4-88dd-4046-a781-fa2dc828b980}</uuid> |
| 405 |
<visible>true</visible> |
| 406 |
<midichan>0</midichan> |
| 407 |
<midicc>0</midicc> |
| 408 |
<label>File Input</label> |
| 409 |
<alignment>left</alignment> |
| 410 |
<font>Arial</font> |
| 411 |
<fontsize>10</fontsize> |
| 412 |
<precision>3</precision> |
| 413 |
<color> |
| 414 |
<r>0</r> |
| 415 |
<g>0</g> |
| 416 |
<b>0</b> |
| 417 |
</color> |
| 418 |
<bgcolor mode="nobackground"> |
| 419 |
<r>255</r> |
| 420 |
<g>255</g> |
| 421 |
<b>255</b> |
| 422 |
</bgcolor> |
| 423 |
<bordermode>noborder</bordermode> |
| 424 |
<borderradius>1</borderradius> |
| 425 |
<borderwidth>1</borderwidth> |
| 426 |
</bsbObject> |
| 427 |
<bsbObject version="2" type="BSBLabel"> |
| 428 |
<objectName/> |
| 429 |
<x>8</x> |
| 430 |
<y>101</y> |
| 431 |
<width>180</width> |
| 432 |
<height>30</height> |
| 433 |
<uuid>{027163fb-bbfe-488e-9351-1c1cd9a9d626}</uuid> |
| 434 |
<visible>true</visible> |
| 435 |
<midichan>0</midichan> |
| 436 |
<midicc>0</midicc> |
| 437 |
<label>Output Amplitude Scaling</label> |
| 438 |
<alignment>left</alignment> |
| 439 |
<font>Arial</font> |
| 440 |
<fontsize>10</fontsize> |
| 441 |
<precision>3</precision> |
| 442 |
<color> |
| 443 |
<r>0</r> |
| 444 |
<g>0</g> |
| 445 |
<b>0</b> |
| 446 |
</color> |
| 447 |
<bgcolor mode="nobackground"> |
| 448 |
<r>255</r> |
| 449 |
<g>255</g> |
| 450 |
<b>255</b> |
| 451 |
</bgcolor> |
| 452 |
<bordermode>noborder</bordermode> |
| 453 |
<borderradius>1</borderradius> |
| 454 |
<borderwidth>1</borderwidth> |
| 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="true" loopStart="0" loopEnd="0"> </EventPanel> |