Debian Codegraph @

src/Examples/McCurdy Collection/PhysicalModels/crunch.csd

raw
1 ;Written by Iain McCurdy, 2009
2
3 ;Modified for QuteCsound by René, March 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 tables for exp slider
8
9
10 ;my flags on Ubuntu: -odac -b1024 -B2048 -+rtaudio=alsa -+rtmidi=null -m0
11 <CsoundSynthesizer>
12 <CsOptions>
13
14 </CsOptions>
15 <CsInstruments>
16 sr = 44100 ;SAMPLE RATE
17 ksmps = 100 ;NUMBER OF AUDIO SAMPLES IN EACH CONTROL CYCLE
18 nchnls = 2 ;NUMBER OF CHANNELS (2=STEREO)
19 0dbfs = 1 ;MAXIMUM AMPLITUDE REGARDLESS OF BIT DEPTH
20
21
22 ;TABLES FOR EXP SLIDER
23 giExp1 ftgen 0, 0, 129, -25, 0, 0.001, 128, 1.0
24
25
26 instr 10 ;GUI
27 ktrig metro 10
28 if (ktrig == 1) then
29 gkamp invalue "Amplitude"
30 kdettack invalue "dettack"
31 gkdettack tablei kdettack, giExp1, 1
32 outvalue "dettack_Value", gkdettack
33 gknum invalue "Num"
34 gkdamp invalue "Damp"
35 gkmaxshake invalue "EnergyFB"
36 endif
37 endin
38
39 instr 1
40 kSwitch changed gkamp, gkdettack, gknum, gkdamp, gkmaxshake ;GENERATE A MOMENTARY '1' PULSE IN OUTPUT 'kSwitch' IF ANY OF THE SCANNED INPUT VARIABLES CHANGE. (OUTPUT 'kSwitch' IS NORMALLY ZERO)
41 if kSwitch=1 then
42 reinit BEGIN
43 endif
44
45 BEGIN:
46 acrunch crunch i(gkamp), i(gkdettack) , i(gknum), i(gkdamp), i(gkmaxshake)
47 rireturn
48 outs acrunch, acrunch
49 endin
50 </CsInstruments>
51 <CsScore>
52 ;INSTR | START | DURATION
53 i 10 0 3600 ;GUI
54 </CsScore>
55 </CsoundSynthesizer>
56 <bsbPanel>
57 <label>Widgets</label>
58 <objectName/>
59 <x>686</x>
60 <y>251</y>
61 <width>982</width>
62 <height>257</height>
63 <visible>true</visible>
64 <uuid/>
65 <bgcolor mode="background">
66 <r>241</r>
67 <g>226</g>
68 <b>185</b>
69 </bgcolor>
70 <bsbObject version="2" type="BSBLabel">
71 <objectName/>
72 <x>2</x>
73 <y>2</y>
74 <width>512</width>
75 <height>250</height>
76 <uuid>{aa607456-d368-4d59-8497-d16d608404c3}</uuid>
77 <visible>true</visible>
78 <midichan>0</midichan>
79 <midicc>0</midicc>
80 <label>crunch</label>
81 <alignment>center</alignment>
82 <font>Liberation Sans</font>
83 <fontsize>18</fontsize>
84 <precision>3</precision>
85 <color>
86 <r>0</r>
87 <g>0</g>
88 <b>0</b>
89 </color>
90 <bgcolor mode="background">
91 <r>147</r>
92 <g>154</g>
93 <b>255</b>
94 </bgcolor>
95 <bordermode>border</bordermode>
96 <borderradius>5</borderradius>
97 <borderwidth>2</borderwidth>
98 </bsbObject>
99 <bsbObject version="2" type="BSBButton">
100 <objectName/>
101 <x>8</x>
102 <y>8</y>
103 <width>100</width>
104 <height>30</height>
105 <uuid>{24979132-c53f-4414-ac6b-6b4f503ecfe8}</uuid>
106 <visible>true</visible>
107 <midichan>0</midichan>
108 <midicc>0</midicc>
109 <type>event</type>
110 <pressedValue>1.00000000</pressedValue>
111 <stringvalue/>
112 <text>Crunch !</text>
113 <image>/</image>
114 <eventLine>i 1 0 -1</eventLine>
115 <latch>false</latch>
116 <latched>false</latched>
117 </bsbObject>
118 <bsbObject version="2" type="BSBLabel">
119 <objectName/>
120 <x>8</x>
121 <y>74</y>
122 <width>220</width>
123 <height>30</height>
124 <uuid>{640b50b7-7200-4f81-8394-89d9843ae939}</uuid>
125 <visible>true</visible>
126 <midichan>0</midichan>
127 <midicc>0</midicc>
128 <label>Amplitude</label>
129 <alignment>left</alignment>
130 <font>Liberation Sans</font>
131 <fontsize>10</fontsize>
132 <precision>3</precision>
133 <color>
134 <r>0</r>
135 <g>0</g>
136 <b>0</b>
137 </color>
138 <bgcolor mode="nobackground">
139 <r>255</r>
140 <g>255</g>
141 <b>255</b>
142 </bgcolor>
143 <bordermode>noborder</bordermode>
144 <borderradius>1</borderradius>
145 <borderwidth>1</borderwidth>
146 </bsbObject>
147 <bsbObject version="2" type="BSBHSlider">
148 <objectName>Amplitude</objectName>
149 <x>8</x>
150 <y>57</y>
151 <width>500</width>
152 <height>27</height>
153 <uuid>{5585fa6f-0f63-4ac3-bf1b-809c2b1d9134}</uuid>
154 <visible>true</visible>
155 <midichan>0</midichan>
156 <midicc>0</midicc>
157 <minimum>0.00000000</minimum>
158 <maximum>1.00000000</maximum>
159 <value>0.60800000</value>
160 <mode>lin</mode>
161 <mouseControl act="jump">continuous</mouseControl>
162 <resolution>-1.00000000</resolution>
163 <randomizable group="0">false</randomizable>
164 </bsbObject>
165 <bsbObject version="2" type="BSBDisplay">
166 <objectName>Amplitude</objectName>
167 <x>448</x>
168 <y>74</y>
169 <width>60</width>
170 <height>30</height>
171 <uuid>{b731b52e-e14a-476a-a583-f3b2bd885539}</uuid>
172 <visible>true</visible>
173 <midichan>0</midichan>
174 <midicc>0</midicc>
175 <label>0.608</label>
176 <alignment>right</alignment>
177 <font>Liberation Sans</font>
178 <fontsize>9</fontsize>
179 <precision>3</precision>
180 <color>
181 <r>0</r>
182 <g>0</g>
183 <b>0</b>
184 </color>
185 <bgcolor mode="nobackground">
186 <r>255</r>
187 <g>255</g>
188 <b>255</b>
189 </bgcolor>
190 <bordermode>noborder</bordermode>
191 <borderradius>1</borderradius>
192 <borderwidth>1</borderwidth>
193 </bsbObject>
194 <bsbObject version="2" type="BSBLabel">
195 <objectName/>
196 <x>8</x>
197 <y>109</y>
198 <width>220</width>
199 <height>30</height>
200 <uuid>{989564b0-b237-4c22-9d10-b76b7c7e4e4c}</uuid>
201 <visible>true</visible>
202 <midichan>0</midichan>
203 <midicc>0</midicc>
204 <label>idettack (i-rate)</label>
205 <alignment>left</alignment>
206 <font>Liberation Sans</font>
207 <fontsize>10</fontsize>
208 <precision>3</precision>
209 <color>
210 <r>0</r>
211 <g>0</g>
212 <b>0</b>
213 </color>
214 <bgcolor mode="nobackground">
215 <r>255</r>
216 <g>255</g>
217 <b>255</b>
218 </bgcolor>
219 <bordermode>noborder</bordermode>
220 <borderradius>1</borderradius>
221 <borderwidth>1</borderwidth>
222 </bsbObject>
223 <bsbObject version="2" type="BSBHSlider">
224 <objectName>dettack</objectName>
225 <x>8</x>
226 <y>92</y>
227 <width>500</width>
228 <height>27</height>
229 <uuid>{84cd664e-fb67-4dd4-aac3-adbcf2c81fe6}</uuid>
230 <visible>true</visible>
231 <midichan>0</midichan>
232 <midicc>0</midicc>
233 <minimum>0.00000000</minimum>
234 <maximum>1.00000000</maximum>
235 <value>0.33600000</value>
236 <mode>lin</mode>
237 <mouseControl act="jump">continuous</mouseControl>
238 <resolution>-1.00000000</resolution>
239 <randomizable group="0">false</randomizable>
240 </bsbObject>
241 <bsbObject version="2" type="BSBDisplay">
242 <objectName>dettack_Value</objectName>
243 <x>448</x>
244 <y>109</y>
245 <width>60</width>
246 <height>30</height>
247 <uuid>{ba8682a6-056f-4432-946b-4e3ee82c47a1}</uuid>
248 <visible>true</visible>
249 <midichan>0</midichan>
250 <midicc>0</midicc>
251 <label>0.010</label>
252 <alignment>right</alignment>
253 <font>Liberation Sans</font>
254 <fontsize>9</fontsize>
255 <precision>3</precision>
256 <color>
257 <r>0</r>
258 <g>0</g>
259 <b>0</b>
260 </color>
261 <bgcolor mode="nobackground">
262 <r>255</r>
263 <g>255</g>
264 <b>255</b>
265 </bgcolor>
266 <bordermode>noborder</bordermode>
267 <borderradius>1</borderradius>
268 <borderwidth>1</borderwidth>
269 </bsbObject>
270 <bsbObject version="2" type="BSBLabel">
271 <objectName/>
272 <x>8</x>
273 <y>143</y>
274 <width>200</width>
275 <height>30</height>
276 <uuid>{76044785-79c4-4202-b7ce-07aee4868219}</uuid>
277 <visible>true</visible>
278 <midichan>0</midichan>
279 <midicc>0</midicc>
280 <label>Number of Particles (i-rate)</label>
281 <alignment>left</alignment>
282 <font>Liberation Sans</font>
283 <fontsize>10</fontsize>
284 <precision>3</precision>
285 <color>
286 <r>0</r>
287 <g>0</g>
288 <b>0</b>
289 </color>
290 <bgcolor mode="nobackground">
291 <r>255</r>
292 <g>255</g>
293 <b>255</b>
294 </bgcolor>
295 <bordermode>noborder</bordermode>
296 <borderradius>1</borderradius>
297 <borderwidth>1</borderwidth>
298 </bsbObject>
299 <bsbObject version="2" type="BSBHSlider">
300 <objectName>Num</objectName>
301 <x>8</x>
302 <y>126</y>
303 <width>500</width>
304 <height>27</height>
305 <uuid>{0f952e77-ff9b-4621-b1af-23252bb9c2a6}</uuid>
306 <visible>true</visible>
307 <midichan>0</midichan>
308 <midicc>0</midicc>
309 <minimum>0.00010000</minimum>
310 <maximum>1000.00000000</maximum>
311 <value>502.00004980</value>
312 <mode>lin</mode>
313 <mouseControl act="jump">continuous</mouseControl>
314 <resolution>-1.00000000</resolution>
315 <randomizable group="0">false</randomizable>
316 </bsbObject>
317 <bsbObject version="2" type="BSBDisplay">
318 <objectName>Num</objectName>
319 <x>448</x>
320 <y>143</y>
321 <width>60</width>
322 <height>30</height>
323 <uuid>{7b92c0ca-2fe8-4b4f-9ed0-f618c1b3cb5c}</uuid>
324 <visible>true</visible>
325 <midichan>0</midichan>
326 <midicc>0</midicc>
327 <label>502.000</label>
328 <alignment>right</alignment>
329 <font>Liberation Sans</font>
330 <fontsize>9</fontsize>
331 <precision>3</precision>
332 <color>
333 <r>0</r>
334 <g>0</g>
335 <b>0</b>
336 </color>
337 <bgcolor mode="nobackground">
338 <r>255</r>
339 <g>255</g>
340 <b>255</b>
341 </bgcolor>
342 <bordermode>noborder</bordermode>
343 <borderradius>1</borderradius>
344 <borderwidth>1</borderwidth>
345 </bsbObject>
346 <bsbObject version="2" type="BSBLabel">
347 <objectName/>
348 <x>8</x>
349 <y>178</y>
350 <width>220</width>
351 <height>30</height>
352 <uuid>{ca41878c-b561-486b-9cf9-d0da6b48448b}</uuid>
353 <visible>true</visible>
354 <midichan>0</midichan>
355 <midicc>0</midicc>
356 <label>Damping (i-rate)</label>
357 <alignment>left</alignment>
358 <font>Liberation Sans</font>
359 <fontsize>10</fontsize>
360 <precision>3</precision>
361 <color>
362 <r>0</r>
363 <g>0</g>
364 <b>0</b>
365 </color>
366 <bgcolor mode="nobackground">
367 <r>255</r>
368 <g>255</g>
369 <b>255</b>
370 </bgcolor>
371 <bordermode>noborder</bordermode>
372 <borderradius>1</borderradius>
373 <borderwidth>1</borderwidth>
374 </bsbObject>
375 <bsbObject version="2" type="BSBHSlider">
376 <objectName>Damp</objectName>
377 <x>8</x>
378 <y>161</y>
379 <width>500</width>
380 <height>27</height>
381 <uuid>{2800fb88-347a-402c-88ed-fc97af6a36be}</uuid>
382 <visible>true</visible>
383 <midichan>0</midichan>
384 <midicc>0</midicc>
385 <minimum>-5.00000000</minimum>
386 <maximum>0.05000000</maximum>
387 <value>-1.00040000</value>
388 <mode>lin</mode>
389 <mouseControl act="jump">continuous</mouseControl>
390 <resolution>-1.00000000</resolution>
391 <randomizable group="0">false</randomizable>
392 </bsbObject>
393 <bsbObject version="2" type="BSBDisplay">
394 <objectName>Damp</objectName>
395 <x>448</x>
396 <y>178</y>
397 <width>60</width>
398 <height>30</height>
399 <uuid>{5d1ba94c-536a-4178-be6c-c0d9d2f75e3d}</uuid>
400 <visible>true</visible>
401 <midichan>0</midichan>
402 <midicc>0</midicc>
403 <label>-1.000</label>
404 <alignment>right</alignment>
405 <font>Liberation Sans</font>
406 <fontsize>9</fontsize>
407 <precision>3</precision>
408 <color>
409 <r>0</r>
410 <g>0</g>
411 <b>0</b>
412 </color>
413 <bgcolor mode="nobackground">
414 <r>255</r>
415 <g>255</g>
416 <b>255</b>
417 </bgcolor>
418 <bordermode>noborder</bordermode>
419 <borderradius>1</borderradius>
420 <borderwidth>1</borderwidth>
421 </bsbObject>
422 <bsbObject version="2" type="BSBLabel">
423 <objectName/>
424 <x>8</x>
425 <y>213</y>
426 <width>220</width>
427 <height>30</height>
428 <uuid>{cdd71125-b224-471a-9c41-9c05d8d28d0c}</uuid>
429 <visible>true</visible>
430 <midichan>0</midichan>
431 <midicc>0</midicc>
432 <label>Energy Feedback (i-rate)</label>
433 <alignment>left</alignment>
434 <font>Liberation Sans</font>
435 <fontsize>10</fontsize>
436 <precision>3</precision>
437 <color>
438 <r>0</r>
439 <g>0</g>
440 <b>0</b>
441 </color>
442 <bgcolor mode="nobackground">
443 <r>255</r>
444 <g>255</g>
445 <b>255</b>
446 </bgcolor>
447 <bordermode>noborder</bordermode>
448 <borderradius>1</borderradius>
449 <borderwidth>1</borderwidth>
450 </bsbObject>
451 <bsbObject version="2" type="BSBHSlider">
452 <objectName>EnergyFB</objectName>
453 <x>8</x>
454 <y>196</y>
455 <width>500</width>
456 <height>27</height>
457 <uuid>{7a83bb1f-f25d-47e0-bf2d-9c5c86e0756b}</uuid>
458 <visible>true</visible>
459 <midichan>0</midichan>
460 <midicc>0</midicc>
461 <minimum>0.00000000</minimum>
462 <maximum>1.00000000</maximum>
463 <value>0.00000000</value>
464 <mode>lin</mode>
465 <mouseControl act="jump">continuous</mouseControl>
466 <resolution>-1.00000000</resolution>
467 <randomizable group="0">false</randomizable>
468 </bsbObject>
469 <bsbObject version="2" type="BSBDisplay">
470 <objectName>EnergyFB</objectName>
471 <x>448</x>
472 <y>213</y>
473 <width>60</width>
474 <height>30</height>
475 <uuid>{7f8d2709-bf8c-46ab-83f0-36fc620b0d56}</uuid>
476 <visible>true</visible>
477 <midichan>0</midichan>
478 <midicc>0</midicc>
479 <label>0.000</label>
480 <alignment>right</alignment>
481 <font>Liberation Sans</font>
482 <fontsize>9</fontsize>
483 <precision>3</precision>
484 <color>
485 <r>0</r>
486 <g>0</g>
487 <b>0</b>
488 </color>
489 <bgcolor mode="nobackground">
490 <r>255</r>
491 <g>255</g>
492 <b>255</b>
493 </bgcolor>
494 <bordermode>noborder</bordermode>
495 <borderradius>1</borderradius>
496 <borderwidth>1</borderwidth>
497 </bsbObject>
498 <bsbObject version="2" type="BSBLabel">
499 <objectName/>
500 <x>515</x>
501 <y>2</y>
502 <width>460</width>
503 <height>250</height>
504 <uuid>{74928ed2-b701-4668-9a11-74763d317e9b}</uuid>
505 <visible>true</visible>
506 <midichan>0</midichan>
507 <midicc>0</midicc>
508 <label>crunch</label>
509 <alignment>center</alignment>
510 <font>Liberation Sans</font>
511 <fontsize>18</fontsize>
512 <precision>3</precision>
513 <color>
514 <r>0</r>
515 <g>0</g>
516 <b>0</b>
517 </color>
518 <bgcolor mode="background">
519 <r>147</r>
520 <g>154</g>
521 <b>255</b>
522 </bgcolor>
523 <bordermode>border</bordermode>
524 <borderradius>5</borderradius>
525 <borderwidth>2</borderwidth>
526 </bsbObject>
527 <bsbObject version="2" type="BSBLabel">
528 <objectName/>
529 <x>517</x>
530 <y>25</y>
531 <width>456</width>
532 <height>220</height>
533 <uuid>{d4bdb5ce-87d8-4c8c-9c64-40ec2eed6f5a}</uuid>
534 <visible>true</visible>
535 <midichan>0</midichan>
536 <midicc>0</midicc>
537 <label>---------------------------------------------------------------------------------------------------------------
538 'crunch' is a semi-physical model of a crunching sound. It is one of the PhISEM percussion opcodes. PhISEM (Physically Informed Stochastic Event Modeling) is an algorithmic approach for simulating collisions of multiple independent sound producing objects. The input parameter 'idettack' which is supposed to control the time until all sound ceases doens't seem to have any effect. If 'Energy Feedback' is anything other than zero a sustained texture is produced. 'Damping' gives some control over how the density of the sound decays.</label>
539 <alignment>left</alignment>
540 <font>Liberation Sans</font>
541 <fontsize>14</fontsize>
542 <precision>3</precision>
543 <color>
544 <r>0</r>
545 <g>0</g>
546 <b>0</b>
547 </color>
548 <bgcolor mode="nobackground">
549 <r>255</r>
550 <g>255</g>
551 <b>255</b>
552 </bgcolor>
553 <bordermode>noborder</bordermode>
554 <borderradius>1</borderradius>
555 <borderwidth>1</borderwidth>
556 </bsbObject>
557 </bsbPanel>
558 <bsbPresets>
559 </bsbPresets>
560 <EventPanel name="" tempo="60.00000000" loop="8.00000000" x="913" y="162" width="655" height="346" visible="true" loopStart="0" loopEnd="0"> </EventPanel>