| 1 |
;Written by Iain McCurdy, 2006 |
| 2 |
|
| 3 |
|
| 4 |
;Modified for QuteCsound by René, April 2011 |
| 5 |
;Tested on Ubuntu 10.04 with csound-float 5.13.0 and QuteCsound svn rev 817 |
| 6 |
|
| 7 |
;Notes on modifications from original csd: |
| 8 |
; Add table(s) for exp slider |
| 9 |
; Removed subinstr call to instrument 2 from instrument 1 |
| 10 |
; Use QuteCsound internal midi interface for Harmonics (Channel 1, CC#1) |
| 11 |
|
| 12 |
|
| 13 |
;my flags on Ubuntu: -iadc -odac -b1024 -B2048 -+rtaudio=alsa -+rtmidi=alsa -Ma -m0 |
| 14 |
<CsoundSynthesizer> |
| 15 |
<CsOptions> |
| 16 |
|
| 17 |
</CsOptions> |
| 18 |
<CsInstruments> |
| 19 |
sr = 44100 ;SAMPLE RATE |
| 20 |
ksmps = 32 ;NUMBER OF AUDIO SAMPLES IN EACH CONTROL CYCLE |
| 21 |
nchnls = 2 ;NUMBER OF CHANNELS (2=STEREO) |
| 22 |
0dbfs = 1 ;MAXIMUM SOUND INTENSITY LEVEL REGARDLESS OF BIT DEPTH |
| 23 |
|
| 24 |
|
| 25 |
gisine ftgen 0, 0, 4096, 10, 1 ;FUNCTION TABLE THAT STORES A SINGLE CYCLE OF A SINE WAVE |
| 26 |
giExp1 ftgen 0, 0, 129, -25, 0, 1.0, 128, 5000.0 ;TABLE FOR EXP SLIDER |
| 27 |
|
| 28 |
|
| 29 |
instr 10 ;GUI |
| 30 |
gkamp invalue "Amplitude" |
| 31 |
kfreq invalue "Frequency" |
| 32 |
gkfreq tablei kfreq, giExp1, 1 |
| 33 |
outvalue "Frequency_Value", gkfreq |
| 34 |
gkharm invalue "Harmonics" |
| 35 |
endin |
| 36 |
|
| 37 |
instr 1 ;MIDI INPUT INSTRUMENT |
| 38 |
icps cpsmidi ;READ CYCLES PER SECOND VALUE FROM MIDI INPUT |
| 39 |
iamp ampmidi 1 ;READ IN A NOTE VELOCITY VALUE FROM THE MIDI INPUT |
| 40 |
kamp = iamp * gkamp |
| 41 |
|
| 42 |
;PITCH BEND=========================================================================================================================================================== |
| 43 |
iSemitoneBendRange= 2 ;PITCH BEND RANGE IN SEMITONES |
| 44 |
imin = 0 ;EQUILIBRIUM POSITION |
| 45 |
imax = iSemitoneBendRange * .0833333 ;MAX PITCH DISPLACEMENT (IN oct FORMAT) |
| 46 |
kbend pchbend imin, imax ;PITCH BEND VARIABLE (IN oct FORMAT) |
| 47 |
koct = octcps(icps) |
| 48 |
kfreq = cpsoct(koct + kbend) |
| 49 |
;===================================================================================================================================================================== |
| 50 |
|
| 51 |
;OUTPUT OPCODE AMPLITUDE | FREQUENCY | NO.OF HARMONICS | FUNCTION_TABLE |
| 52 |
asig buzz kamp, kfreq, int(gkharm), gisine |
| 53 |
aenv linsegr 0,0.01,1,0.01,0 ;ANTI-CLICK ENVELOPE |
| 54 |
outs asig*aenv, asig*aenv ;SEND AUDIO OUTPUT TO THE SPEAKERS |
| 55 |
endin |
| 56 |
|
| 57 |
instr 2 ;BUZZ INSTRUMENT |
| 58 |
;OUTPUT OPCODE AMPLITUDE | FREQUENCY | NO.OF HARMONICS | FUNCTION_TABLE |
| 59 |
asig buzz gkamp, gkfreq, int(gkharm), gisine |
| 60 |
aenv linsegr 0,0.01,1,0.01,0 ;ANTI-CLICK ENVELOPE |
| 61 |
outs asig*aenv, asig*aenv ;SEND AUDIO OUTPUT TO THE SPEAKERS |
| 62 |
endin |
| 63 |
</CsInstruments> |
| 64 |
<CsScore> |
| 65 |
;INSTR | START | DURATION |
| 66 |
i 10 0.0 3600 ;GUI |
| 67 |
</CsScore> |
| 68 |
</CsoundSynthesizer> |
| 69 |
<bsbPanel> |
| 70 |
<label>Widgets</label> |
| 71 |
<objectName/> |
| 72 |
<x>425</x> |
| 73 |
<y>433</y> |
| 74 |
<width>941</width> |
| 75 |
<height>258</height> |
| 76 |
<visible>true</visible> |
| 77 |
<uuid/> |
| 78 |
<bgcolor mode="background"> |
| 79 |
<r>241</r> |
| 80 |
<g>226</g> |
| 81 |
<b>185</b> |
| 82 |
</bgcolor> |
| 83 |
<bsbObject version="2" type="BSBLabel"> |
| 84 |
<objectName/> |
| 85 |
<x>2</x> |
| 86 |
<y>2</y> |
| 87 |
<width>512</width> |
| 88 |
<height>250</height> |
| 89 |
<uuid>{aa607456-d368-4d59-8497-d16d608404c3}</uuid> |
| 90 |
<visible>true</visible> |
| 91 |
<midichan>0</midichan> |
| 92 |
<midicc>0</midicc> |
| 93 |
<label>buzz</label> |
| 94 |
<alignment>center</alignment> |
| 95 |
<font>Liberation Sans</font> |
| 96 |
<fontsize>18</fontsize> |
| 97 |
<precision>3</precision> |
| 98 |
<color> |
| 99 |
<r>255</r> |
| 100 |
<g>255</g> |
| 101 |
<b>0</b> |
| 102 |
</color> |
| 103 |
<bgcolor mode="background"> |
| 104 |
<r>106</r> |
| 105 |
<g>117</g> |
| 106 |
<b>150</b> |
| 107 |
</bgcolor> |
| 108 |
<bordermode>border</bordermode> |
| 109 |
<borderradius>5</borderradius> |
| 110 |
<borderwidth>2</borderwidth> |
| 111 |
</bsbObject> |
| 112 |
<bsbObject version="2" type="BSBButton"> |
| 113 |
<objectName/> |
| 114 |
<x>8</x> |
| 115 |
<y>10</y> |
| 116 |
<width>124</width> |
| 117 |
<height>30</height> |
| 118 |
<uuid>{487d5181-d838-4cce-9628-317fefc350cb}</uuid> |
| 119 |
<visible>true</visible> |
| 120 |
<midichan>0</midichan> |
| 121 |
<midicc>0</midicc> |
| 122 |
<type>event</type> |
| 123 |
<pressedValue>1.00000000</pressedValue> |
| 124 |
<stringvalue/> |
| 125 |
<text> ON / OFF (MIDI)</text> |
| 126 |
<image>/</image> |
| 127 |
<eventLine>i 2 0 -1</eventLine> |
| 128 |
<latch>true</latch> |
| 129 |
<latched>false</latched> |
| 130 |
</bsbObject> |
| 131 |
<bsbObject version="2" type="BSBLabel"> |
| 132 |
<objectName/> |
| 133 |
<x>8</x> |
| 134 |
<y>138</y> |
| 135 |
<width>150</width> |
| 136 |
<height>30</height> |
| 137 |
<uuid>{0200a063-5db8-4668-bc2d-2d989a083f6e}</uuid> |
| 138 |
<visible>true</visible> |
| 139 |
<midichan>0</midichan> |
| 140 |
<midicc>0</midicc> |
| 141 |
<label>Amplitude</label> |
| 142 |
<alignment>left</alignment> |
| 143 |
<font>Liberation Sans</font> |
| 144 |
<fontsize>10</fontsize> |
| 145 |
<precision>3</precision> |
| 146 |
<color> |
| 147 |
<r>255</r> |
| 148 |
<g>255</g> |
| 149 |
<b>0</b> |
| 150 |
</color> |
| 151 |
<bgcolor mode="nobackground"> |
| 152 |
<r>255</r> |
| 153 |
<g>255</g> |
| 154 |
<b>255</b> |
| 155 |
</bgcolor> |
| 156 |
<bordermode>noborder</bordermode> |
| 157 |
<borderradius>1</borderradius> |
| 158 |
<borderwidth>1</borderwidth> |
| 159 |
</bsbObject> |
| 160 |
<bsbObject version="2" type="BSBDisplay"> |
| 161 |
<objectName>Amplitude</objectName> |
| 162 |
<x>448</x> |
| 163 |
<y>138</y> |
| 164 |
<width>60</width> |
| 165 |
<height>30</height> |
| 166 |
<uuid>{ab191e3a-430d-4f1d-88aa-9840342cd2d3}</uuid> |
| 167 |
<visible>true</visible> |
| 168 |
<midichan>0</midichan> |
| 169 |
<midicc>0</midicc> |
| 170 |
<label>0.492</label> |
| 171 |
<alignment>right</alignment> |
| 172 |
<font>Liberation Sans</font> |
| 173 |
<fontsize>9</fontsize> |
| 174 |
<precision>3</precision> |
| 175 |
<color> |
| 176 |
<r>255</r> |
| 177 |
<g>255</g> |
| 178 |
<b>0</b> |
| 179 |
</color> |
| 180 |
<bgcolor mode="nobackground"> |
| 181 |
<r>255</r> |
| 182 |
<g>255</g> |
| 183 |
<b>255</b> |
| 184 |
</bgcolor> |
| 185 |
<bordermode>noborder</bordermode> |
| 186 |
<borderradius>1</borderradius> |
| 187 |
<borderwidth>1</borderwidth> |
| 188 |
</bsbObject> |
| 189 |
<bsbObject version="2" type="BSBLabel"> |
| 190 |
<objectName/> |
| 191 |
<x>516</x> |
| 192 |
<y>2</y> |
| 193 |
<width>420</width> |
| 194 |
<height>250</height> |
| 195 |
<uuid>{74928ed2-b701-4668-9a11-74763d317e9b}</uuid> |
| 196 |
<visible>true</visible> |
| 197 |
<midichan>0</midichan> |
| 198 |
<midicc>0</midicc> |
| 199 |
<label>buzz</label> |
| 200 |
<alignment>center</alignment> |
| 201 |
<font>Liberation Sans</font> |
| 202 |
<fontsize>18</fontsize> |
| 203 |
<precision>3</precision> |
| 204 |
<color> |
| 205 |
<r>255</r> |
| 206 |
<g>255</g> |
| 207 |
<b>0</b> |
| 208 |
</color> |
| 209 |
<bgcolor mode="background"> |
| 210 |
<r>106</r> |
| 211 |
<g>117</g> |
| 212 |
<b>150</b> |
| 213 |
</bgcolor> |
| 214 |
<bordermode>border</bordermode> |
| 215 |
<borderradius>5</borderradius> |
| 216 |
<borderwidth>2</borderwidth> |
| 217 |
</bsbObject> |
| 218 |
<bsbObject version="2" type="BSBLabel"> |
| 219 |
<objectName/> |
| 220 |
<x>520</x> |
| 221 |
<y>17</y> |
| 222 |
<width>412</width> |
| 223 |
<height>231</height> |
| 224 |
<uuid>{d4bdb5ce-87d8-4c8c-9c64-40ec2eed6f5a}</uuid> |
| 225 |
<visible>true</visible> |
| 226 |
<midichan>0</midichan> |
| 227 |
<midicc>0</midicc> |
| 228 |
<label>---------------------------------------------------------------------------------------------------- |
| 229 |
Buzz creates a composite tone of harmonically related sine wave partials. The user is given control of the number of partials required (from the fundemental upwards) and of the the amplitude and the fundemental frequency of the tone. Buzz requires the user to first supply it with a sine waveform via a function table (probably GEN 10). This table should not be too small, sizes of 8192 and upwards are recommended. Buzz provides a useful source for subtractive synthesis. This example can also be played from an external MIDI keyboard. Pitch, note velocity and pitch bend and represented appropriately. MIDI controller 1 (the modulation wheel) can be used to modulate 'Number of Harmonics'.</label> |
| 230 |
<alignment>left</alignment> |
| 231 |
<font>Liberation Sans</font> |
| 232 |
<fontsize>14</fontsize> |
| 233 |
<precision>3</precision> |
| 234 |
<color> |
| 235 |
<r>255</r> |
| 236 |
<g>255</g> |
| 237 |
<b>0</b> |
| 238 |
</color> |
| 239 |
<bgcolor mode="nobackground"> |
| 240 |
<r>255</r> |
| 241 |
<g>255</g> |
| 242 |
<b>255</b> |
| 243 |
</bgcolor> |
| 244 |
<bordermode>noborder</bordermode> |
| 245 |
<borderradius>1</borderradius> |
| 246 |
<borderwidth>1</borderwidth> |
| 247 |
</bsbObject> |
| 248 |
<bsbObject version="2" type="BSBHSlider"> |
| 249 |
<objectName>Amplitude</objectName> |
| 250 |
<x>8</x> |
| 251 |
<y>122</y> |
| 252 |
<width>500</width> |
| 253 |
<height>27</height> |
| 254 |
<uuid>{2a8dc6e2-12f4-443d-af9b-59e4373cc24b}</uuid> |
| 255 |
<visible>true</visible> |
| 256 |
<midichan>0</midichan> |
| 257 |
<midicc>0</midicc> |
| 258 |
<minimum>0.00000000</minimum> |
| 259 |
<maximum>1.00000000</maximum> |
| 260 |
<value>0.49200000</value> |
| 261 |
<mode>lin</mode> |
| 262 |
<mouseControl act="jump">continuous</mouseControl> |
| 263 |
<resolution>-1.00000000</resolution> |
| 264 |
<randomizable group="0">false</randomizable> |
| 265 |
</bsbObject> |
| 266 |
<bsbObject version="2" type="BSBLabel"> |
| 267 |
<objectName/> |
| 268 |
<x>8</x> |
| 269 |
<y>176</y> |
| 270 |
<width>150</width> |
| 271 |
<height>30</height> |
| 272 |
<uuid>{4fa545c6-e2f1-4387-8c9f-4a9dd388bb42}</uuid> |
| 273 |
<visible>true</visible> |
| 274 |
<midichan>0</midichan> |
| 275 |
<midicc>0</midicc> |
| 276 |
<label>Oscillator Frequency</label> |
| 277 |
<alignment>left</alignment> |
| 278 |
<font>Liberation Sans</font> |
| 279 |
<fontsize>10</fontsize> |
| 280 |
<precision>3</precision> |
| 281 |
<color> |
| 282 |
<r>255</r> |
| 283 |
<g>255</g> |
| 284 |
<b>0</b> |
| 285 |
</color> |
| 286 |
<bgcolor mode="nobackground"> |
| 287 |
<r>255</r> |
| 288 |
<g>255</g> |
| 289 |
<b>255</b> |
| 290 |
</bgcolor> |
| 291 |
<bordermode>noborder</bordermode> |
| 292 |
<borderradius>1</borderradius> |
| 293 |
<borderwidth>1</borderwidth> |
| 294 |
</bsbObject> |
| 295 |
<bsbObject version="2" type="BSBDisplay"> |
| 296 |
<objectName>Frequency_Value</objectName> |
| 297 |
<x>448</x> |
| 298 |
<y>176</y> |
| 299 |
<width>60</width> |
| 300 |
<height>30</height> |
| 301 |
<uuid>{b0ad1916-b43e-44c2-be40-bca29f5cb1f4}</uuid> |
| 302 |
<visible>true</visible> |
| 303 |
<midichan>0</midichan> |
| 304 |
<midicc>0</midicc> |
| 305 |
<label>126.245</label> |
| 306 |
<alignment>right</alignment> |
| 307 |
<font>Liberation Sans</font> |
| 308 |
<fontsize>9</fontsize> |
| 309 |
<precision>3</precision> |
| 310 |
<color> |
| 311 |
<r>255</r> |
| 312 |
<g>255</g> |
| 313 |
<b>0</b> |
| 314 |
</color> |
| 315 |
<bgcolor mode="nobackground"> |
| 316 |
<r>255</r> |
| 317 |
<g>255</g> |
| 318 |
<b>255</b> |
| 319 |
</bgcolor> |
| 320 |
<bordermode>noborder</bordermode> |
| 321 |
<borderradius>1</borderradius> |
| 322 |
<borderwidth>1</borderwidth> |
| 323 |
</bsbObject> |
| 324 |
<bsbObject version="2" type="BSBHSlider"> |
| 325 |
<objectName>Frequency</objectName> |
| 326 |
<x>8</x> |
| 327 |
<y>160</y> |
| 328 |
<width>500</width> |
| 329 |
<height>27</height> |
| 330 |
<uuid>{9069e547-5638-4568-896f-980087c61de0}</uuid> |
| 331 |
<visible>true</visible> |
| 332 |
<midichan>0</midichan> |
| 333 |
<midicc>0</midicc> |
| 334 |
<minimum>0.00000000</minimum> |
| 335 |
<maximum>1.00000000</maximum> |
| 336 |
<value>0.56800000</value> |
| 337 |
<mode>lin</mode> |
| 338 |
<mouseControl act="jump">continuous</mouseControl> |
| 339 |
<resolution>-1.00000000</resolution> |
| 340 |
<randomizable group="0">false</randomizable> |
| 341 |
</bsbObject> |
| 342 |
<bsbObject version="2" type="BSBLabel"> |
| 343 |
<objectName/> |
| 344 |
<x>40</x> |
| 345 |
<y>68</y> |
| 346 |
<width>169</width> |
| 347 |
<height>31</height> |
| 348 |
<uuid>{ada34c8d-83fe-4eae-b207-ac7e38c5251f}</uuid> |
| 349 |
<visible>true</visible> |
| 350 |
<midichan>0</midichan> |
| 351 |
<midicc>0</midicc> |
| 352 |
<label>No. of Harmonics CC#1 :</label> |
| 353 |
<alignment>right</alignment> |
| 354 |
<font>Liberation Sans</font> |
| 355 |
<fontsize>10</fontsize> |
| 356 |
<precision>3</precision> |
| 357 |
<color> |
| 358 |
<r>255</r> |
| 359 |
<g>255</g> |
| 360 |
<b>0</b> |
| 361 |
</color> |
| 362 |
<bgcolor mode="nobackground"> |
| 363 |
<r>255</r> |
| 364 |
<g>255</g> |
| 365 |
<b>255</b> |
| 366 |
</bgcolor> |
| 367 |
<bordermode>noborder</bordermode> |
| 368 |
<borderradius>1</borderradius> |
| 369 |
<borderwidth>1</borderwidth> |
| 370 |
</bsbObject> |
| 371 |
<bsbObject version="2" type="BSBSpinBox"> |
| 372 |
<objectName>Harmonics</objectName> |
| 373 |
<x>210</x> |
| 374 |
<y>68</y> |
| 375 |
<width>50</width> |
| 376 |
<height>30</height> |
| 377 |
<uuid>{c37974b7-7a24-481d-8f02-a116324085e3}</uuid> |
| 378 |
<visible>true</visible> |
| 379 |
<midichan>1</midichan> |
| 380 |
<midicc>1</midicc> |
| 381 |
<alignment>right</alignment> |
| 382 |
<font>Liberation Sans</font> |
| 383 |
<fontsize>16</fontsize> |
| 384 |
<color> |
| 385 |
<r>0</r> |
| 386 |
<g>0</g> |
| 387 |
<b>0</b> |
| 388 |
</color> |
| 389 |
<bgcolor mode="nobackground"> |
| 390 |
<r>255</r> |
| 391 |
<g>255</g> |
| 392 |
<b>255</b> |
| 393 |
</bgcolor> |
| 394 |
<resolution>1.00000000</resolution> |
| 395 |
<minimum>1</minimum> |
| 396 |
<maximum>80</maximum> |
| 397 |
<randomizable group="0">false</randomizable> |
| 398 |
<value>1</value> |
| 399 |
</bsbObject> |
| 400 |
</bsbPanel> |
| 401 |
<bsbPresets> |
| 402 |
</bsbPresets> |