Debian Codegraph @

src/Examples/McCurdy Collection/PhysicalModels/sandpaper.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 ; INIT instrument added
9
10
11 ;my flags on Ubuntu: -odac -b1024 -B2048 -+rtaudio=alsa -+rtmidi=null -m0
12 <CsoundSynthesizer>
13 <CsOptions>
14
15 </CsOptions>
16 <CsInstruments>
17 sr = 44100 ;SAMPLE RATE
18 ksmps = 100 ;NUMBER OF AUDIO SAMPLES IN EACH CONTROL
19 nchnls = 2 ;NUMBER OF CHANNELS (2=STEREO)
20 0dbfs = 1 ;MAXIMUM AMPLITUDE REGARDLESS OF BIT DEPTH
21
22
23 giExp1 ftgen 0, 0, 129, -25, 0, 0.001, 128, 1.0 ;TABLE FOR EXP SLIDER
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 "NumbPart"
34 gkdamp invalue "Damping"
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 BEGIN:
45 asandpaper sandpaper i(gkamp), i(gkdettack) , i(gknum), i(gkdamp), i(gkmaxshake)
46 rireturn
47 outs asandpaper, asandpaper
48 endin
49
50 instr 2 ;INIT
51 outvalue "Amplitude" , 0.03
52 outvalue "Dettack" , 0.34
53 outvalue "NumbPart" , 500
54 outvalue "Damping" , -1
55 outvalue "EnergyFB" , 0
56 endin
57 </CsInstruments>
58 <CsScore>
59 ;INSTR | START | DURATION
60 i 10 0 3600 ;GUI
61
62 i 2 0 0.1 ;INIT
63 </CsScore>
64 </CsoundSynthesizer>
65 <bsbPanel>
66 <label>Widgets</label>
67 <objectName/>
68 <x>1159</x>
69 <y>84</y>
70 <width>520</width>
71 <height>484</height>
72 <visible>true</visible>
73 <uuid/>
74 <bgcolor mode="background">
75 <r>241</r>
76 <g>226</g>
77 <b>185</b>
78 </bgcolor>
79 <bsbObject version="2" type="BSBLabel">
80 <objectName/>
81 <x>2</x>
82 <y>2</y>
83 <width>513</width>
84 <height>481</height>
85 <uuid>{aa607456-d368-4d59-8497-d16d608404c3}</uuid>
86 <visible>true</visible>
87 <midichan>0</midichan>
88 <midicc>0</midicc>
89 <label>sandpaper</label>
90 <alignment>center</alignment>
91 <font>Liberation Sans</font>
92 <fontsize>18</fontsize>
93 <precision>3</precision>
94 <color>
95 <r>0</r>
96 <g>0</g>
97 <b>0</b>
98 </color>
99 <bgcolor mode="background">
100 <r>147</r>
101 <g>154</g>
102 <b>255</b>
103 </bgcolor>
104 <bordermode>border</bordermode>
105 <borderradius>5</borderradius>
106 <borderwidth>2</borderwidth>
107 </bsbObject>
108 <bsbObject version="2" type="BSBLabel">
109 <objectName/>
110 <x>8</x>
111 <y>112</y>
112 <width>220</width>
113 <height>30</height>
114 <uuid>{640b50b7-7200-4f81-8394-89d9843ae939}</uuid>
115 <visible>true</visible>
116 <midichan>0</midichan>
117 <midicc>0</midicc>
118 <label>Amplitude</label>
119 <alignment>left</alignment>
120 <font>Liberation Sans</font>
121 <fontsize>10</fontsize>
122 <precision>3</precision>
123 <color>
124 <r>0</r>
125 <g>0</g>
126 <b>0</b>
127 </color>
128 <bgcolor mode="nobackground">
129 <r>255</r>
130 <g>255</g>
131 <b>255</b>
132 </bgcolor>
133 <bordermode>noborder</bordermode>
134 <borderradius>1</borderradius>
135 <borderwidth>1</borderwidth>
136 </bsbObject>
137 <bsbObject version="2" type="BSBHSlider">
138 <objectName>Amplitude</objectName>
139 <x>8</x>
140 <y>91</y>
141 <width>500</width>
142 <height>27</height>
143 <uuid>{5585fa6f-0f63-4ac3-bf1b-809c2b1d9134}</uuid>
144 <visible>true</visible>
145 <midichan>0</midichan>
146 <midicc>0</midicc>
147 <minimum>0.00000000</minimum>
148 <maximum>1.00000000</maximum>
149 <value>0.03000000</value>
150 <mode>lin</mode>
151 <mouseControl act="jump">continuous</mouseControl>
152 <resolution>-1.00000000</resolution>
153 <randomizable group="0">false</randomizable>
154 </bsbObject>
155 <bsbObject version="2" type="BSBDisplay">
156 <objectName>Amplitude</objectName>
157 <x>448</x>
158 <y>112</y>
159 <width>60</width>
160 <height>30</height>
161 <uuid>{b731b52e-e14a-476a-a583-f3b2bd885539}</uuid>
162 <visible>true</visible>
163 <midichan>0</midichan>
164 <midicc>0</midicc>
165 <label>0.030</label>
166 <alignment>right</alignment>
167 <font>Liberation Sans</font>
168 <fontsize>9</fontsize>
169 <precision>3</precision>
170 <color>
171 <r>0</r>
172 <g>0</g>
173 <b>0</b>
174 </color>
175 <bgcolor mode="nobackground">
176 <r>255</r>
177 <g>255</g>
178 <b>255</b>
179 </bgcolor>
180 <bordermode>noborder</bordermode>
181 <borderradius>1</borderradius>
182 <borderwidth>1</borderwidth>
183 </bsbObject>
184 <bsbObject version="2" type="BSBButton">
185 <objectName/>
186 <x>8</x>
187 <y>43</y>
188 <width>120</width>
189 <height>30</height>
190 <uuid>{04d44ebe-12eb-4bb0-a3f5-9e4fd3e7830e}</uuid>
191 <visible>true</visible>
192 <midichan>0</midichan>
193 <midicc>0</midicc>
194 <type>event</type>
195 <pressedValue>1.00000000</pressedValue>
196 <stringvalue/>
197 <text>Scrape !</text>
198 <image>/</image>
199 <eventLine>i 1 0 -1</eventLine>
200 <latch>false</latch>
201 <latched>false</latched>
202 </bsbObject>
203 <bsbObject version="2" type="BSBLabel">
204 <objectName/>
205 <x>8</x>
206 <y>158</y>
207 <width>220</width>
208 <height>30</height>
209 <uuid>{1fee3c20-99d2-4c60-baa7-669d23492f06}</uuid>
210 <visible>true</visible>
211 <midichan>0</midichan>
212 <midicc>0</midicc>
213 <label>idettack (i-rate)</label>
214 <alignment>left</alignment>
215 <font>Liberation Sans</font>
216 <fontsize>10</fontsize>
217 <precision>3</precision>
218 <color>
219 <r>0</r>
220 <g>0</g>
221 <b>0</b>
222 </color>
223 <bgcolor mode="nobackground">
224 <r>255</r>
225 <g>255</g>
226 <b>255</b>
227 </bgcolor>
228 <bordermode>noborder</bordermode>
229 <borderradius>1</borderradius>
230 <borderwidth>1</borderwidth>
231 </bsbObject>
232 <bsbObject version="2" type="BSBHSlider">
233 <objectName>Dettack</objectName>
234 <x>8</x>
235 <y>137</y>
236 <width>500</width>
237 <height>27</height>
238 <uuid>{f5ebacc2-9a31-48e3-adb0-3cb090aec444}</uuid>
239 <visible>true</visible>
240 <midichan>0</midichan>
241 <midicc>0</midicc>
242 <minimum>0.00000000</minimum>
243 <maximum>1.00000000</maximum>
244 <value>0.34000000</value>
245 <mode>lin</mode>
246 <mouseControl act="jump">continuous</mouseControl>
247 <resolution>-1.00000000</resolution>
248 <randomizable group="0">false</randomizable>
249 </bsbObject>
250 <bsbObject version="2" type="BSBDisplay">
251 <objectName>Dettack_Value</objectName>
252 <x>448</x>
253 <y>158</y>
254 <width>60</width>
255 <height>30</height>
256 <uuid>{221d17eb-f6ee-4286-a97f-e6bc5c0a1749}</uuid>
257 <visible>true</visible>
258 <midichan>0</midichan>
259 <midicc>0</midicc>
260 <label>0.010</label>
261 <alignment>right</alignment>
262 <font>Liberation Sans</font>
263 <fontsize>9</fontsize>
264 <precision>3</precision>
265 <color>
266 <r>0</r>
267 <g>0</g>
268 <b>0</b>
269 </color>
270 <bgcolor mode="nobackground">
271 <r>255</r>
272 <g>255</g>
273 <b>255</b>
274 </bgcolor>
275 <bordermode>noborder</bordermode>
276 <borderradius>1</borderradius>
277 <borderwidth>1</borderwidth>
278 </bsbObject>
279 <bsbObject version="2" type="BSBLabel">
280 <objectName/>
281 <x>8</x>
282 <y>204</y>
283 <width>220</width>
284 <height>30</height>
285 <uuid>{bce7cccd-a303-4a57-af94-fd50cf914991}</uuid>
286 <visible>true</visible>
287 <midichan>0</midichan>
288 <midicc>0</midicc>
289 <label>Number of Particles (i-rate)</label>
290 <alignment>left</alignment>
291 <font>Liberation Sans</font>
292 <fontsize>10</fontsize>
293 <precision>3</precision>
294 <color>
295 <r>0</r>
296 <g>0</g>
297 <b>0</b>
298 </color>
299 <bgcolor mode="nobackground">
300 <r>255</r>
301 <g>255</g>
302 <b>255</b>
303 </bgcolor>
304 <bordermode>noborder</bordermode>
305 <borderradius>1</borderradius>
306 <borderwidth>1</borderwidth>
307 </bsbObject>
308 <bsbObject version="2" type="BSBHSlider">
309 <objectName>NumbPart</objectName>
310 <x>8</x>
311 <y>183</y>
312 <width>500</width>
313 <height>27</height>
314 <uuid>{aaf82558-9229-4d61-8190-0286f3764e87}</uuid>
315 <visible>true</visible>
316 <midichan>0</midichan>
317 <midicc>0</midicc>
318 <minimum>0.00010000</minimum>
319 <maximum>1000.00000000</maximum>
320 <value>500.00000000</value>
321 <mode>lin</mode>
322 <mouseControl act="jump">continuous</mouseControl>
323 <resolution>-1.00000000</resolution>
324 <randomizable group="0">false</randomizable>
325 </bsbObject>
326 <bsbObject version="2" type="BSBDisplay">
327 <objectName>NumbPart</objectName>
328 <x>448</x>
329 <y>204</y>
330 <width>60</width>
331 <height>30</height>
332 <uuid>{1cd1723d-bcd9-44df-9f08-9d8191f03601}</uuid>
333 <visible>true</visible>
334 <midichan>0</midichan>
335 <midicc>0</midicc>
336 <label>500.000</label>
337 <alignment>right</alignment>
338 <font>Liberation Sans</font>
339 <fontsize>9</fontsize>
340 <precision>3</precision>
341 <color>
342 <r>0</r>
343 <g>0</g>
344 <b>0</b>
345 </color>
346 <bgcolor mode="nobackground">
347 <r>255</r>
348 <g>255</g>
349 <b>255</b>
350 </bgcolor>
351 <bordermode>noborder</bordermode>
352 <borderradius>1</borderradius>
353 <borderwidth>1</borderwidth>
354 </bsbObject>
355 <bsbObject version="2" type="BSBLabel">
356 <objectName/>
357 <x>8</x>
358 <y>250</y>
359 <width>220</width>
360 <height>30</height>
361 <uuid>{0f0e06ef-104c-459c-8a8b-3bf531321341}</uuid>
362 <visible>true</visible>
363 <midichan>0</midichan>
364 <midicc>0</midicc>
365 <label>Damping (i-rate)</label>
366 <alignment>left</alignment>
367 <font>Liberation Sans</font>
368 <fontsize>10</fontsize>
369 <precision>3</precision>
370 <color>
371 <r>0</r>
372 <g>0</g>
373 <b>0</b>
374 </color>
375 <bgcolor mode="nobackground">
376 <r>255</r>
377 <g>255</g>
378 <b>255</b>
379 </bgcolor>
380 <bordermode>noborder</bordermode>
381 <borderradius>1</borderradius>
382 <borderwidth>1</borderwidth>
383 </bsbObject>
384 <bsbObject version="2" type="BSBHSlider">
385 <objectName>Damping</objectName>
386 <x>8</x>
387 <y>229</y>
388 <width>500</width>
389 <height>27</height>
390 <uuid>{4a2f399c-8a7b-40cf-84ab-839e1d7012f5}</uuid>
391 <visible>true</visible>
392 <midichan>0</midichan>
393 <midicc>0</midicc>
394 <minimum>-5.00000000</minimum>
395 <maximum>0.05000000</maximum>
396 <value>-1.00000000</value>
397 <mode>lin</mode>
398 <mouseControl act="jump">continuous</mouseControl>
399 <resolution>-1.00000000</resolution>
400 <randomizable group="0">false</randomizable>
401 </bsbObject>
402 <bsbObject version="2" type="BSBDisplay">
403 <objectName>Damping</objectName>
404 <x>448</x>
405 <y>250</y>
406 <width>60</width>
407 <height>30</height>
408 <uuid>{62bd5b38-121f-4382-8c01-02c75edf2237}</uuid>
409 <visible>true</visible>
410 <midichan>0</midichan>
411 <midicc>0</midicc>
412 <label>-1.000</label>
413 <alignment>right</alignment>
414 <font>Liberation Sans</font>
415 <fontsize>9</fontsize>
416 <precision>3</precision>
417 <color>
418 <r>0</r>
419 <g>0</g>
420 <b>0</b>
421 </color>
422 <bgcolor mode="nobackground">
423 <r>255</r>
424 <g>255</g>
425 <b>255</b>
426 </bgcolor>
427 <bordermode>noborder</bordermode>
428 <borderradius>1</borderradius>
429 <borderwidth>1</borderwidth>
430 </bsbObject>
431 <bsbObject version="2" type="BSBLabel">
432 <objectName/>
433 <x>8</x>
434 <y>296</y>
435 <width>220</width>
436 <height>30</height>
437 <uuid>{3967c371-a6b0-46ca-a51c-5a44bcad618d}</uuid>
438 <visible>true</visible>
439 <midichan>0</midichan>
440 <midicc>0</midicc>
441 <label>Energy Feedback (i-rate)</label>
442 <alignment>left</alignment>
443 <font>Liberation Sans</font>
444 <fontsize>10</fontsize>
445 <precision>3</precision>
446 <color>
447 <r>0</r>
448 <g>0</g>
449 <b>0</b>
450 </color>
451 <bgcolor mode="nobackground">
452 <r>255</r>
453 <g>255</g>
454 <b>255</b>
455 </bgcolor>
456 <bordermode>noborder</bordermode>
457 <borderradius>1</borderradius>
458 <borderwidth>1</borderwidth>
459 </bsbObject>
460 <bsbObject version="2" type="BSBHSlider">
461 <objectName>EnergyFB</objectName>
462 <x>8</x>
463 <y>275</y>
464 <width>500</width>
465 <height>27</height>
466 <uuid>{fa94c4bb-3469-4fbf-9096-f6f7c115eb69}</uuid>
467 <visible>true</visible>
468 <midichan>0</midichan>
469 <midicc>0</midicc>
470 <minimum>0.00000000</minimum>
471 <maximum>1.00000000</maximum>
472 <value>0.00000000</value>
473 <mode>lin</mode>
474 <mouseControl act="jump">continuous</mouseControl>
475 <resolution>-1.00000000</resolution>
476 <randomizable group="0">false</randomizable>
477 </bsbObject>
478 <bsbObject version="2" type="BSBDisplay">
479 <objectName>EnergyFB</objectName>
480 <x>448</x>
481 <y>296</y>
482 <width>60</width>
483 <height>30</height>
484 <uuid>{1f01b045-b441-4f44-8dfe-884fb64aba2a}</uuid>
485 <visible>true</visible>
486 <midichan>0</midichan>
487 <midicc>0</midicc>
488 <label>0.000</label>
489 <alignment>right</alignment>
490 <font>Liberation Sans</font>
491 <fontsize>9</fontsize>
492 <precision>3</precision>
493 <color>
494 <r>0</r>
495 <g>0</g>
496 <b>0</b>
497 </color>
498 <bgcolor mode="nobackground">
499 <r>255</r>
500 <g>255</g>
501 <b>255</b>
502 </bgcolor>
503 <bordermode>noborder</bordermode>
504 <borderradius>1</borderradius>
505 <borderwidth>1</borderwidth>
506 </bsbObject>
507 <bsbObject version="2" type="BSBLabel">
508 <objectName/>
509 <x>6</x>
510 <y>319</y>
511 <width>507</width>
512 <height>161</height>
513 <uuid>{4dd9a56f-89f0-4d88-aacf-1fcb6f6145fd}</uuid>
514 <visible>true</visible>
515 <midichan>0</midichan>
516 <midicc>0</midicc>
517 <label>----------------------------------------------------------------------------------------------------------------------------
518 'sandpaper' is a semi-physical model of the sound of sandpaper being rubbed. 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>
519 <alignment>left</alignment>
520 <font>Liberation Sans</font>
521 <fontsize>14</fontsize>
522 <precision>3</precision>
523 <color>
524 <r>0</r>
525 <g>0</g>
526 <b>0</b>
527 </color>
528 <bgcolor mode="nobackground">
529 <r>255</r>
530 <g>255</g>
531 <b>255</b>
532 </bgcolor>
533 <bordermode>noborder</bordermode>
534 <borderradius>1</borderradius>
535 <borderwidth>1</borderwidth>
536 </bsbObject>
537 </bsbPanel>
538 <bsbPresets>
539 </bsbPresets>
540 <EventPanel name="" tempo="60.00000000" loop="8.00000000" x="913" y="162" width="655" height="346" visible="true" loopStart="0" loopEnd="0"> </EventPanel>