Debian Codegraph @

src/Examples/McCurdy Collection/Filters/moogvcf.csd

raw
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
9
10 ;my flags on Ubuntu: -iadc -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 SOUND INTENSITY LEVEL REGARDLESS OF BIT DEPTH
20
21
22 gir ftgen 1, 0, 131072, 10, 1 ;SINE WAVE FUNCTION TABLE
23 giExp20000 ftgen 0, 0, 129, -25, 0, 20.0, 128, 20000.0 ;TABLES FOR EXP SLIDER
24
25
26 instr 1 ;GUI
27 ktrig metro 10
28 if (ktrig == 1) then
29 kfco invalue "Filter_Cutoff"
30 gkfco tablei kfco, giExp20000, 1
31 outvalue "Filter_Cutoff_Value", gkfco
32 kfrq invalue "Oscillator_Frequency"
33 gkfrq tablei kfrq, giExp20000, 1
34 outvalue "Oscillator_Frequency_Value", gkfrq
35 gkres invalue "Resonance"
36 gkgain invalue "Output_Amplitude_Scaling"
37
38 gkskip invalue "Initialisation"
39 endif
40 endin
41
42 instr 2
43 kporttime linseg 0,0.001,0.005,1,0.005 ;CREATE A VARIABLE FUNCTION THAT RAPIDLY RAMPS UP TO A SET VALUE
44 kfrq portk gkfrq, kporttime ;SMOOTH MOVEMENT OF SLIDER VARIABLE
45 kfco portk gkfco, kporttime ;SMOOTH MOVEMENT OF SLIDER VARIABLE
46 asig vco 1, kfrq, 1, 0 ;GENERATE A TRIANGLE WAVE AUDIO SIGNAL (NOTE THAT lpf18 EXPECTS A SIGNAL WITHIN THE RANGE -1 TO 1)
47 kSwitch changed gkskip
48 if kSwitch=1 then ;IF I-RATE VARIABLE CHANGE TRIGGER IS '1'...
49 reinit START ;BEGIN A REINITIALISATION PASS FROM LABEL 'START'
50 endif
51 START:
52 asig vco 1, kfrq, 1, 0 ;GENERATE A TRIANGLE WAVE AUDIO SIGNAL (NOTE THAT lpf18 EXPECTS A SIGNAL WITHIN THE RANGE -1 TO 1)
53 iscale = 1
54 ares moogvcf asig, kfco, gkres, iscale, i(gkskip)
55 rireturn ;RETURN FROM REINITIALISATION PASS TO PERFORMANCE TIME PASSES
56 outs ares * gkgain, ares * gkgain ;FILTER OUTPUT IS SENT TO THE AUDIO OUTPUTS AND RESCALED USING gkgain SLIDER VARIABLE
57 endin
58 </CsInstruments>
59 <CsScore>
60 ;INSTR | START | DURATION
61 i 1 0 3600 ;GUI
62 </CsScore>
63 </CsoundSynthesizer><bsbPanel>
64 <label>Widgets</label>
65 <objectName/>
66 <x>383</x>
67 <y>279</y>
68 <width>794</width>
69 <height>264</height>
70 <visible>true</visible>
71 <uuid/>
72 <bgcolor mode="background">
73 <r>241</r>
74 <g>226</g>
75 <b>185</b>
76 </bgcolor>
77 <bsbObject version="2" type="BSBLabel">
78 <objectName/>
79 <x>2</x>
80 <y>2</y>
81 <width>512</width>
82 <height>260</height>
83 <uuid>{aa607456-d368-4d59-8497-d16d608404c3}</uuid>
84 <visible>true</visible>
85 <midichan>0</midichan>
86 <midicc>0</midicc>
87 <label>moogvcf</label>
88 <alignment>center</alignment>
89 <font>Liberation Sans</font>
90 <fontsize>18</fontsize>
91 <precision>3</precision>
92 <color>
93 <r>0</r>
94 <g>0</g>
95 <b>0</b>
96 </color>
97 <bgcolor mode="background">
98 <r>106</r>
99 <g>117</g>
100 <b>150</b>
101 </bgcolor>
102 <bordermode>border</bordermode>
103 <borderradius>5</borderradius>
104 <borderwidth>2</borderwidth>
105 </bsbObject>
106 <bsbObject version="2" type="BSBLabel">
107 <objectName/>
108 <x>516</x>
109 <y>2</y>
110 <width>269</width>
111 <height>259</height>
112 <uuid>{74928ed2-b701-4668-9a11-74763d317e9b}</uuid>
113 <visible>true</visible>
114 <midichan>0</midichan>
115 <midicc>0</midicc>
116 <label>moogvcf</label>
117 <alignment>center</alignment>
118 <font>Liberation Sans</font>
119 <fontsize>18</fontsize>
120 <precision>3</precision>
121 <color>
122 <r>0</r>
123 <g>0</g>
124 <b>0</b>
125 </color>
126 <bgcolor mode="background">
127 <r>106</r>
128 <g>117</g>
129 <b>150</b>
130 </bgcolor>
131 <bordermode>border</bordermode>
132 <borderradius>5</borderradius>
133 <borderwidth>2</borderwidth>
134 </bsbObject>
135 <bsbObject version="2" type="BSBLabel">
136 <objectName/>
137 <x>519</x>
138 <y>20</y>
139 <width>262</width>
140 <height>238</height>
141 <uuid>{d4bdb5ce-87d8-4c8c-9c64-40ec2eed6f5a}</uuid>
142 <visible>true</visible>
143 <midichan>0</midichan>
144 <midicc>0</midicc>
145 <label>---------------------------------------------------------------
146 moogvcf is an emulation of the moog ladder diode resonant low-pass filter. The opcode's input arguments include cutoff frequency and resonance. An optional 2-way switch (default=0) is provided to select whether the data space for feedback within the filter is initially cleared or allowed to retain previously held information. The input signal used in this example is a triangle waveform, the frequency of which is adjustable using an on-screen slider.</label>
147 <alignment>left</alignment>
148 <font>Arial</font>
149 <fontsize>14</fontsize>
150 <precision>3</precision>
151 <color>
152 <r>0</r>
153 <g>0</g>
154 <b>0</b>
155 </color>
156 <bgcolor mode="nobackground">
157 <r>255</r>
158 <g>255</g>
159 <b>255</b>
160 </bgcolor>
161 <bordermode>noborder</bordermode>
162 <borderradius>1</borderradius>
163 <borderwidth>1</borderwidth>
164 </bsbObject>
165 <bsbObject version="2" type="BSBButton">
166 <objectName/>
167 <x>8</x>
168 <y>6</y>
169 <width>100</width>
170 <height>30</height>
171 <uuid>{24979132-c53f-4414-ac6b-6b4f503ecfe8}</uuid>
172 <visible>true</visible>
173 <midichan>0</midichan>
174 <midicc>0</midicc>
175 <type>event</type>
176 <pressedValue>1.00000000</pressedValue>
177 <stringvalue/>
178 <text> ON / OFF</text>
179 <image>/</image>
180 <eventLine>i 2 0 -1</eventLine>
181 <latch>true</latch>
182 <latched>false</latched>
183 </bsbObject>
184 <bsbObject version="2" type="BSBDisplay">
185 <objectName>Filter_Cutoff_Value</objectName>
186 <x>448</x>
187 <y>63</y>
188 <width>60</width>
189 <height>30</height>
190 <uuid>{745d6bee-b951-4a03-9fe8-9e10d5ae4556}</uuid>
191 <visible>true</visible>
192 <midichan>0</midichan>
193 <midicc>0</midicc>
194 <label>395.515</label>
195 <alignment>right</alignment>
196 <font>Arial</font>
197 <fontsize>9</fontsize>
198 <precision>3</precision>
199 <color>
200 <r>0</r>
201 <g>0</g>
202 <b>0</b>
203 </color>
204 <bgcolor mode="nobackground">
205 <r>255</r>
206 <g>255</g>
207 <b>255</b>
208 </bgcolor>
209 <bordermode>noborder</bordermode>
210 <borderradius>1</borderradius>
211 <borderwidth>1</borderwidth>
212 </bsbObject>
213 <bsbObject version="2" type="BSBHSlider">
214 <objectName>Filter_Cutoff</objectName>
215 <x>8</x>
216 <y>46</y>
217 <width>500</width>
218 <height>27</height>
219 <uuid>{06814721-6151-4baa-84e2-8f39843b07a4}</uuid>
220 <visible>true</visible>
221 <midichan>0</midichan>
222 <midicc>0</midicc>
223 <minimum>0.00000000</minimum>
224 <maximum>1.00000000</maximum>
225 <value>0.43200000</value>
226 <mode>lin</mode>
227 <mouseControl act="jump">continuous</mouseControl>
228 <resolution>-1.00000000</resolution>
229 <randomizable group="0">false</randomizable>
230 </bsbObject>
231 <bsbObject version="2" type="BSBLabel">
232 <objectName/>
233 <x>8</x>
234 <y>63</y>
235 <width>180</width>
236 <height>30</height>
237 <uuid>{c6d7165c-6730-426f-b293-52b411bc73cf}</uuid>
238 <visible>true</visible>
239 <midichan>0</midichan>
240 <midicc>0</midicc>
241 <label>Filter Cutoff</label>
242 <alignment>left</alignment>
243 <font>Arial</font>
244 <fontsize>10</fontsize>
245 <precision>3</precision>
246 <color>
247 <r>0</r>
248 <g>0</g>
249 <b>0</b>
250 </color>
251 <bgcolor mode="nobackground">
252 <r>255</r>
253 <g>255</g>
254 <b>255</b>
255 </bgcolor>
256 <bordermode>noborder</bordermode>
257 <borderradius>1</borderradius>
258 <borderwidth>1</borderwidth>
259 </bsbObject>
260 <bsbObject version="2" type="BSBLabel">
261 <objectName/>
262 <x>8</x>
263 <y>101</y>
264 <width>160</width>
265 <height>30</height>
266 <uuid>{f9f4369b-a39e-45aa-ba99-7457a534535f}</uuid>
267 <visible>true</visible>
268 <midichan>0</midichan>
269 <midicc>0</midicc>
270 <label>Resonance</label>
271 <alignment>left</alignment>
272 <font>Arial</font>
273 <fontsize>10</fontsize>
274 <precision>3</precision>
275 <color>
276 <r>0</r>
277 <g>0</g>
278 <b>0</b>
279 </color>
280 <bgcolor mode="nobackground">
281 <r>255</r>
282 <g>255</g>
283 <b>255</b>
284 </bgcolor>
285 <bordermode>noborder</bordermode>
286 <borderradius>1</borderradius>
287 <borderwidth>1</borderwidth>
288 </bsbObject>
289 <bsbObject version="2" type="BSBHSlider">
290 <objectName>Resonance</objectName>
291 <x>8</x>
292 <y>84</y>
293 <width>500</width>
294 <height>27</height>
295 <uuid>{42fe25e5-e98f-4f00-872c-f791822a1b3e}</uuid>
296 <visible>true</visible>
297 <midichan>0</midichan>
298 <midicc>0</midicc>
299 <minimum>0.00000000</minimum>
300 <maximum>1.00000000</maximum>
301 <value>0.52600000</value>
302 <mode>lin</mode>
303 <mouseControl act="jump">continuous</mouseControl>
304 <resolution>-1.00000000</resolution>
305 <randomizable group="0">false</randomizable>
306 </bsbObject>
307 <bsbObject version="2" type="BSBDisplay">
308 <objectName>Resonance</objectName>
309 <x>448</x>
310 <y>101</y>
311 <width>60</width>
312 <height>30</height>
313 <uuid>{a8f35453-f236-447d-88d9-1a0b135383b6}</uuid>
314 <visible>true</visible>
315 <midichan>0</midichan>
316 <midicc>0</midicc>
317 <label>0.526</label>
318 <alignment>right</alignment>
319 <font>Arial</font>
320 <fontsize>9</fontsize>
321 <precision>3</precision>
322 <color>
323 <r>0</r>
324 <g>0</g>
325 <b>0</b>
326 </color>
327 <bgcolor mode="nobackground">
328 <r>255</r>
329 <g>255</g>
330 <b>255</b>
331 </bgcolor>
332 <bordermode>noborder</bordermode>
333 <borderradius>1</borderradius>
334 <borderwidth>1</borderwidth>
335 </bsbObject>
336 <bsbObject version="2" type="BSBDisplay">
337 <objectName>Oscillator_Frequency_Value</objectName>
338 <x>448</x>
339 <y>138</y>
340 <width>60</width>
341 <height>30</height>
342 <uuid>{4de7125b-4cc8-4769-ac1b-083ee6357f6a}</uuid>
343 <visible>true</visible>
344 <midichan>0</midichan>
345 <midicc>0</midicc>
346 <label>325.956</label>
347 <alignment>right</alignment>
348 <font>Arial</font>
349 <fontsize>9</fontsize>
350 <precision>3</precision>
351 <color>
352 <r>0</r>
353 <g>0</g>
354 <b>0</b>
355 </color>
356 <bgcolor mode="nobackground">
357 <r>255</r>
358 <g>255</g>
359 <b>255</b>
360 </bgcolor>
361 <bordermode>noborder</bordermode>
362 <borderradius>1</borderradius>
363 <borderwidth>1</borderwidth>
364 </bsbObject>
365 <bsbObject version="2" type="BSBHSlider">
366 <objectName>Oscillator_Frequency</objectName>
367 <x>8</x>
368 <y>121</y>
369 <width>500</width>
370 <height>27</height>
371 <uuid>{3fc19561-9f06-4437-8dce-93fe562391d0}</uuid>
372 <visible>true</visible>
373 <midichan>0</midichan>
374 <midicc>0</midicc>
375 <minimum>0.00000000</minimum>
376 <maximum>1.00000000</maximum>
377 <value>0.40400000</value>
378 <mode>lin</mode>
379 <mouseControl act="jump">continuous</mouseControl>
380 <resolution>-1.00000000</resolution>
381 <randomizable group="0">false</randomizable>
382 </bsbObject>
383 <bsbObject version="2" type="BSBLabel">
384 <objectName/>
385 <x>8</x>
386 <y>138</y>
387 <width>160</width>
388 <height>30</height>
389 <uuid>{c3737a58-87dd-4c87-8bea-5dd299c564ed}</uuid>
390 <visible>true</visible>
391 <midichan>0</midichan>
392 <midicc>0</midicc>
393 <label>Oscillator Frequency</label>
394 <alignment>left</alignment>
395 <font>Arial</font>
396 <fontsize>10</fontsize>
397 <precision>3</precision>
398 <color>
399 <r>0</r>
400 <g>0</g>
401 <b>0</b>
402 </color>
403 <bgcolor mode="nobackground">
404 <r>255</r>
405 <g>255</g>
406 <b>255</b>
407 </bgcolor>
408 <bordermode>noborder</bordermode>
409 <borderradius>1</borderradius>
410 <borderwidth>1</borderwidth>
411 </bsbObject>
412 <bsbObject version="2" type="BSBDisplay">
413 <objectName>Output_Amplitude_Scaling</objectName>
414 <x>448</x>
415 <y>214</y>
416 <width>60</width>
417 <height>30</height>
418 <uuid>{3a0c526f-9ad8-46e1-9556-6e55c4e3329d}</uuid>
419 <visible>true</visible>
420 <midichan>0</midichan>
421 <midicc>0</midicc>
422 <label>0.536</label>
423 <alignment>right</alignment>
424 <font>Arial</font>
425 <fontsize>9</fontsize>
426 <precision>3</precision>
427 <color>
428 <r>0</r>
429 <g>0</g>
430 <b>0</b>
431 </color>
432 <bgcolor mode="nobackground">
433 <r>255</r>
434 <g>255</g>
435 <b>255</b>
436 </bgcolor>
437 <bordermode>noborder</bordermode>
438 <borderradius>1</borderradius>
439 <borderwidth>1</borderwidth>
440 </bsbObject>
441 <bsbObject version="2" type="BSBHSlider">
442 <objectName>Output_Amplitude_Scaling</objectName>
443 <x>8</x>
444 <y>197</y>
445 <width>500</width>
446 <height>27</height>
447 <uuid>{cd3f39f5-b9c6-4aaf-812d-9de179dee5fb}</uuid>
448 <visible>true</visible>
449 <midichan>0</midichan>
450 <midicc>0</midicc>
451 <minimum>0.00000000</minimum>
452 <maximum>1.00000000</maximum>
453 <value>0.53600000</value>
454 <mode>lin</mode>
455 <mouseControl act="jump">continuous</mouseControl>
456 <resolution>-1.00000000</resolution>
457 <randomizable group="0">false</randomizable>
458 </bsbObject>
459 <bsbObject version="2" type="BSBLabel">
460 <objectName/>
461 <x>8</x>
462 <y>214</y>
463 <width>160</width>
464 <height>30</height>
465 <uuid>{08fb4374-a1f1-4588-85b1-6b17ef1a26a6}</uuid>
466 <visible>true</visible>
467 <midichan>0</midichan>
468 <midicc>0</midicc>
469 <label>Output Amplitude Scaling</label>
470 <alignment>left</alignment>
471 <font>Arial</font>
472 <fontsize>10</fontsize>
473 <precision>3</precision>
474 <color>
475 <r>0</r>
476 <g>0</g>
477 <b>0</b>
478 </color>
479 <bgcolor mode="nobackground">
480 <r>255</r>
481 <g>255</g>
482 <b>255</b>
483 </bgcolor>
484 <bordermode>noborder</bordermode>
485 <borderradius>1</borderradius>
486 <borderwidth>1</borderwidth>
487 </bsbObject>
488 <bsbObject version="2" type="BSBButton">
489 <objectName>Initialisation</objectName>
490 <x>380</x>
491 <y>6</y>
492 <width>130</width>
493 <height>30</height>
494 <uuid>{88395e38-ecab-4818-bef3-1a18b504f914}</uuid>
495 <visible>true</visible>
496 <midichan>0</midichan>
497 <midicc>0</midicc>
498 <type>value</type>
499 <pressedValue>1.00000000</pressedValue>
500 <stringvalue/>
501 <text> No Initialisation</text>
502 <image>/</image>
503 <eventLine/>
504 <latch>true</latch>
505 <latched>false</latched>
506 </bsbObject>
507 </bsbPanel>
508 <bsbPresets>
509 </bsbPresets>
510 <EventPanel name="" tempo="60.00000000" loop="8.00000000" x="913" y="162" width="655" height="346" visible="true" loopStart="0" loopEnd="0"> </EventPanel>