Debian Codegraph @

src/Examples/McCurdy Collection/Miscellaneous/AnalogueVocoder.csd

raw
1 ;Written by Iain McCurdy, 2011
2
3 ;Modified for QuteCsound by René, May 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 for exp slider
8 ; Add Browser for audio file and use of FilePlay2 udo, accept mono or stereo wav files
9 ; Add denorm to moogladder input
10
11
12 ;my flags on Ubuntu: -dm0 -iadc:system:capture_ -odac:system:playback_ -+rtaudio=jack -b16 -B4096 -+rtmidi=alsa -Ma
13 <CsoundSynthesizer>
14 <CsOptions>
15 --env:SSDIR+=../../SourceMaterials
16 </CsOptions>
17 <CsInstruments>
18 sr = 44100 ;SAMPLE RATE
19 ksmps = 16 ;NUMBER OF AUDIO SAMPLES IN EACH CONTROL CYCLE
20 nchnls = 2 ;NUMBER OF CHANNELS (2=STEREO)
21 0dbfs = 1 ;MAXIMUM AMPLITUDE REGARDLESS OF BIT DEPTH
22
23
24 zakinit 4,4
25
26 gisine ftgen 0,0,4096,10,1
27 gaCar init 0
28 gk12_24 init 12
29
30 ;TABLES FOR EXP SLIDER
31 giExp1 ftgen 0, 0, 129, -25, 0, 0.01, 128, 1.0
32 giExp2 ftgen 0, 0, 129, -25, 0, 1.0, 128, 12.0
33 giExp3 ftgen 0, 0, 129, -25, 0, 0.1, 128, 50.0
34 giExp4 ftgen 0, 0, 129, -25, 0, 40.0, 128, 10000.0
35
36
37 opcode VocoderChannel, 0, aaiiiii ;MODE UDO (K-RATE BASE FREQUENCY) - USED FOR NON-MIDI MODE
38 aMod,aCar,ibase,ibw,iincr,icount,inum xin ;NAME INPUT VARIABLES
39 icf = cpsmidinn(ibase+(icount*iincr)) ;DERIVE FREQUENCY FOR *THIS* BANDPASS FILTER BASED ON BASE FREQUENCY AND FILTER NUMBER (icount)
40 icount = icount + 1 ;INCREMENT COUNTER IN PREPARTION FOR NEXT FILTER
41 prints "Band: %d %t Freq: %f %n",icount,icf ;PRINT DATA ABOUT FILTER NUMBER AND FREQUENCY TO THE TERMINAL
42
43 if icf>15000 goto SKIP ;IF FILTER FREQUENCY EXCEEDS A SENSIBLE LIMIT SKIP THE CREATION OF THIS FILTER AND END RECURSION
44 aModF butbp aMod,icf,ibw*icf ;BANDPASS FILTER MODULATOR
45 if gk12_24=24 then ;IF 24DB PER OCT MODE IS CHOSEN...
46 aModF butbp aModF,icf,ibw*icf ;...BANDPASS FILTER AGAIN TO SHARPEN CUTOFF SLOPES
47 endif ;END OF THIS CONDITIONAL BRANCH
48 aEnv follow2 aModF, 0.01, 0.01 ;FOLLOW THE ENVELOPE OF THE FILTERED AUDIO
49
50 aCarF butbp aCar,icf,ibw*icf ;BANDPASS FILTER CARRIER
51 if gk12_24=24 then ;IF 24 DB PER OCT IS CHOSEN...
52 aCarF butbp aCarF,icf,ibw*icf ;...BANDPASS FILTER AGAIN TO SHARPEN CUTOFF SLOPES
53 endif ;END OF THIS CONDITIONAL BRANCH
54 zawm aCarF*aEnv, 0 ;MIX FILTERED CARRIER INTO THE ACCUMULATING ZAK AUDIO CHANNEL AND MODULATE ITS AMPLITUDE WITH THE MODULATOR ENVELOPE
55
56 if icount < inum then ;IF MORE FILTERS STILL NEED TO BE CREATED...
57 VocoderChannel aMod,aCar,ibase,ibw,iincr,icount,inum ;...CALL UDO AGAIN WITH INCREMENTED COUNTER
58 endif ;END OF THIS CONDITIONAL BRANCH
59 SKIP: ;LABEL
60 endop ;END OF UDO
61
62 opcode FilePlay2, aa, Skoo ; Credit to Joachim Heintz
63 ;gives stereo output regardless your soundfile is mono or stereo
64 Sfil, kspeed, iskip, iloop xin
65 ichn filenchnls Sfil
66 if ichn == 1 then
67 aL diskin2 Sfil, kspeed, iskip, iloop
68 aR = aL
69 else
70 aL, aR diskin2 Sfil, kspeed, iskip, iloop
71 endif
72 xout aL, aR
73 endop
74
75
76 instr 10 ;GUI
77 ktrig metro 10
78 if (ktrig == 1) then
79 ;SPINBOXES
80 gkbase invalue "BaseNote"
81 gknum invalue "NumBands"
82 gk12_24 invalue "dBperOct"
83 ;MENUS
84 gkModIn invalue "ModIn"
85 gkCarIn invalue "CarIn"
86 gkSynType invalue "SynType"
87 ;SLIDERS
88 kbw invalue "Bandwidth"
89 gkbw tablei kbw, giExp1, 1
90 outvalue "Bandwidth_Value", gkbw
91 kincr invalue "BandSpacing"
92 gkincr tablei kincr, giExp2, 1
93 outvalue "BandSpacing_Value", gkincr
94 kBPGain invalue "BPGain"
95 gkBPGain tablei kBPGain, giExp3, 1
96 outvalue "BPGain_Value", gkBPGain
97 kHPGain invalue "HPGain"
98 gkHPGain tablei kHPGain, giExp3, 1
99 outvalue "HPGain_Value", gkHPGain
100 kLPF invalue "LPF"
101 gkLPF tablei kLPF, giExp4, 1
102 outvalue "LPF_Value", gkLPF
103 gkres invalue "Res"
104
105 Sfile_new strcpy "" ;INIT TO EMPTY STRING
106 gSfile invalue "_Browse"
107 Sfile_old strcpyk Sfile_new
108 Sfile_new strcpyk gSfile
109 gkfile strcmpk Sfile_new, Sfile_old
110 endif
111
112 turnon 2 ;VOCODER PLAYS
113 endin
114
115 instr 1 ;SIMPLE MIDI SYNTH
116 icps cpsmidi ;READ MIDI NOTE IN CPS FORMAT
117 aenv linsegr 0,0.01,1,0.02,0 ;CREATE A SIMPLE GATE-TYPE ENVELOPE
118
119 if gkSynType=0 then ;IF SYNTH TYPE CHOSEN FROM BUTTON BANK GUI IS SAWTOOTH...
120 a1 vco2 1,icps ;...CREATE A SAWTOOTH WAVE TONE
121 elseif gkSynType=1 then ;IF SYNTH TYPE CHOSEN FROM BUTTON BANK GUI IS SQUARE...
122 a1 vco2 1,icps,2,0.5 ;...CREATE A SQUARE WAVE TONE
123 elseif gkSynType=2 then ;IF SYNTH TYPE CHOSEN FROM BUTTON BANK GUI IS PULSE...
124 a1 vco2 1,icps,2,0.1 ;...CREATE A PULSE WAVE TONE
125 else ;OTHERWISE...
126 a1 pinkish 1 ;...CREATE SOME PINK NOISE
127 endif ;END OF THIS CONDITIONAL BRANCH
128 gaCar = gaCar + (a1*aenv) ;APPLY ENVELOPE
129 endin
130
131 instr 2 ;VOCODER
132 ktrig changed gkbase,gkbw,gknum,gkincr,gkfile ;IF ANY OF THE INPUT VARIABLE ARE CHANGED GENERATE A MOMENTARY '1' VALUE (A BANG IN MAX-MSP LANGUAGE)
133 if ktrig=1 then ;IF A CHANGED VALUE TRIGGER IS RECEIVED...
134 reinit UPDATE ;REINITIALISE THIS INSTRUMENT FROM THE LABEL 'UPDATE'
135 endif ;END OF THIS CONDITIONAL BRANCH
136 UPDATE: ;LABEL
137 ibase init i(gkbase) ;CREATE AN INITIALISATION TIME VARIABLE FROM GUI CONTROL
138 inum init i(gknum) ;CREATE AN INITIALISATION TIME VARIABLE FROM GUI CONTROL
139 ibw init i(gkbw) ;CREATE AN INITIALISATION TIME VARIABLE FROM GUI CONTROL
140 iincr init i(gkincr) ;CREATE AN INITIALISATION TIME VARIABLE FROM GUI CONTROL
141
142 if gkModIn=0 then ;IF MODULATOR INPUT CHOSEN IS 'Audio File'...
143 aMod, asigR FilePlay2 gSfile, 1, 0, 1 ;...READ IN A SOUND FILE FROM HARD DISK
144 else ;OTHERWISE...
145 aMod inch 1 ;READ LIVE AUDIO FROM THE COMPUTER'S LEFT INPUT CHANNEL
146 endif ;END OF THIS CONDITIONAL BRANCH
147
148 denorm gaCar ;to avoid high cpu load on my intel box !!!
149
150 if gkCarIn=0 then ;IF 'Internal Synth' IS CHOSEN FOR CARRIER INPUT...
151 aCar moogladder gaCar,gkLPF,gkres ;... USE INTERNAL SYNTH AUDIO FROM INSTR 1 AND APPLY A LOW PASS FILTER
152 else ;OTHERWISE...
153 aCar inch 2 ;READ LIVE AUDIO FROM THE COMPUTER'S RIGHT CHANNEL INPUT CHANNEL
154 endif ;END OF THIS CONDITIONAL BRANCH
155
156 icount init 0 ;INITIALISE THE FILTER COUNTER TO ZERO
157 VocoderChannel aMod,aCar,ibase,ibw,iincr,icount,inum ;CALL 'VocoderChannel' UDO - (WILL RECURSE WITHIN THE UDO ITSELF FOR THEW REQUIRED NUMBER OF FILTERS
158 amix zar 0 ;READ COMBINED FILTERS OUTPUT FROM ZAK CHANNEL
159
160 ;HIGH-PASS CHANNEL
161 iHPcf = cpsmidinn(ibase+(inum*iincr)+1) ;HIGHPASS FILTER CUTOFF (ONE INCREMENT ABOVE THE HIGHEST BANDPASS FILTER)
162 iHPcf limit iHPcf,2000,18000 ;LIMIT THE HIGHPASS FILTER TO BE WITHIN SENSIBLE LIMITS
163 prints "HPF %t%t Freq: %f %n",iHPcf ;PRINT INFORMATION ABOUT THE HIGHPASS FILTER CUROPFF TO THE TERMINAL
164
165 aModHP buthp aMod, iHPcf ;HIGHPASS FILTER THE MODULATOR
166 aEnv follow2 aModHP,0.01,0.01 ;FOLLOW THE HIGHPASS FILTERED MODULATOR'S AMPLITUDE ENVELOPE
167 aCarHP buthp aCar, iHPcf ;HIGHPASS FILTER THE CARRIER
168 amix = (amix*gkBPGain)+(aCarHP*aEnv*gkHPGain) ;MIX THE HIGHPASS FILTERED CARRIER WITH THE BANDPASS FILTERS. APPLY THE MODULATOR'S ENVELOPE.
169
170 outs amix,amix ;SEND AUDIO TO THE OUTPUTS
171 zacl 0,4
172 clear gaCar ;CLEAR THE INTERNAL SYNTH ACCUMULATING GLOBAL VARIABLE, READ FOR THE NEXT PERF. PASS
173 rireturn ;RETURN FROM REINITIALISATION PASS. (NOT REALLY NEED AS THE endin FULFILS THE SAME FUNCTION.)
174 endin
175
176 instr 11 ;INIT
177 outvalue "BaseNote" , 40
178 outvalue "NumBands" , 50
179 outvalue "dBperOct" , 24
180 outvalue "Bandwidth" , 0.7
181 outvalue "BandSpacing" , 0.165
182 outvalue "BPGain" , 0.482
183 outvalue "HPGain" , 0.8063
184 outvalue "LPF" , 0.8745
185 outvalue "Res" , 0.0
186 endin
187 </CsInstruments>
188 <CsScore>
189 i 10 0 3600 ;GUI
190 i 11 0 0 ;INIT
191 </CsScore>
192 </CsoundSynthesizer>
193
194 <bsbPanel>
195 <label>Widgets</label>
196 <objectName/>
197 <x>329</x>
198 <y>160</y>
199 <width>1036</width>
200 <height>602</height>
201 <visible>true</visible>
202 <uuid/>
203 <bgcolor mode="background">
204 <r>241</r>
205 <g>226</g>
206 <b>185</b>
207 </bgcolor>
208 <bsbObject version="2" type="BSBLabel">
209 <objectName/>
210 <x>2</x>
211 <y>2</y>
212 <width>1034</width>
213 <height>600</height>
214 <uuid>{049f4dd4-ff71-4d6d-9157-43c84efad8a4}</uuid>
215 <visible>true</visible>
216 <midichan>0</midichan>
217 <midicc>0</midicc>
218 <label> Analogue Style Vocoder</label>
219 <alignment>center</alignment>
220 <font>Liberation Sans</font>
221 <fontsize>18</fontsize>
222 <precision>3</precision>
223 <color>
224 <r>255</r>
225 <g>255</g>
226 <b>255</b>
227 </color>
228 <bgcolor mode="background">
229 <r>5</r>
230 <g>27</g>
231 <b>150</b>
232 </bgcolor>
233 <bordermode>border</bordermode>
234 <borderradius>5</borderradius>
235 <borderwidth>2</borderwidth>
236 </bsbObject>
237 <bsbObject version="2" type="BSBLabel">
238 <objectName/>
239 <x>9</x>
240 <y>125</y>
241 <width>200</width>
242 <height>30</height>
243 <uuid>{3ebc1139-1fdb-48dc-9150-49ee8dfdbd4a}</uuid>
244 <visible>true</visible>
245 <midichan>0</midichan>
246 <midicc>0</midicc>
247 <label>Band Spacing (semitones)</label>
248 <alignment>left</alignment>
249 <font>Liberation Sans</font>
250 <fontsize>10</fontsize>
251 <precision>3</precision>
252 <color>
253 <r>255</r>
254 <g>255</g>
255 <b>255</b>
256 </color>
257 <bgcolor mode="nobackground">
258 <r>255</r>
259 <g>255</g>
260 <b>255</b>
261 </bgcolor>
262 <bordermode>noborder</bordermode>
263 <borderradius>1</borderradius>
264 <borderwidth>1</borderwidth>
265 </bsbObject>
266 <bsbObject version="2" type="BSBHSlider">
267 <objectName>BandSpacing</objectName>
268 <x>9</x>
269 <y>102</y>
270 <width>500</width>
271 <height>27</height>
272 <uuid>{2cf97843-5b49-438e-8034-62a459597e86}</uuid>
273 <visible>true</visible>
274 <midichan>0</midichan>
275 <midicc>0</midicc>
276 <minimum>0.00000000</minimum>
277 <maximum>1.00000000</maximum>
278 <value>0.16500001</value>
279 <mode>lin</mode>
280 <mouseControl act="jump">continuous</mouseControl>
281 <resolution>-1.00000000</resolution>
282 <randomizable group="0">false</randomizable>
283 </bsbObject>
284 <bsbObject version="2" type="BSBDisplay">
285 <objectName>BandSpacing_Value</objectName>
286 <x>449</x>
287 <y>125</y>
288 <width>60</width>
289 <height>30</height>
290 <uuid>{e54486c5-f9aa-4d0e-9a67-6506dae3c790}</uuid>
291 <visible>true</visible>
292 <midichan>0</midichan>
293 <midicc>0</midicc>
294 <label>1.507</label>
295 <alignment>right</alignment>
296 <font>Liberation Sans</font>
297 <fontsize>9</fontsize>
298 <precision>3</precision>
299 <color>
300 <r>255</r>
301 <g>255</g>
302 <b>255</b>
303 </color>
304 <bgcolor mode="nobackground">
305 <r>255</r>
306 <g>255</g>
307 <b>255</b>
308 </bgcolor>
309 <bordermode>noborder</bordermode>
310 <borderradius>1</borderradius>
311 <borderwidth>1</borderwidth>
312 </bsbObject>
313 <bsbObject version="2" type="BSBLabel">
314 <objectName/>
315 <x>9</x>
316 <y>72</y>
317 <width>200</width>
318 <height>30</height>
319 <uuid>{78a7e9cd-fb57-421c-8e1f-40b60a90dfc0}</uuid>
320 <visible>true</visible>
321 <midichan>0</midichan>
322 <midicc>0</midicc>
323 <label>Bandwidth (octaves)</label>
324 <alignment>left</alignment>
325 <font>Liberation Sans</font>
326 <fontsize>10</fontsize>
327 <precision>3</precision>
328 <color>
329 <r>255</r>
330 <g>255</g>
331 <b>255</b>
332 </color>
333 <bgcolor mode="nobackground">
334 <r>255</r>
335 <g>255</g>
336 <b>255</b>
337 </bgcolor>
338 <bordermode>noborder</bordermode>
339 <borderradius>1</borderradius>
340 <borderwidth>1</borderwidth>
341 </bsbObject>
342 <bsbObject version="2" type="BSBHSlider">
343 <objectName>Bandwidth</objectName>
344 <x>9</x>
345 <y>49</y>
346 <width>500</width>
347 <height>27</height>
348 <uuid>{4b5d3fba-55d0-43d1-a94a-457bc9144a31}</uuid>
349 <visible>true</visible>
350 <midichan>0</midichan>
351 <midicc>0</midicc>
352 <minimum>0.00000000</minimum>
353 <maximum>1.00000000</maximum>
354 <value>0.69999999</value>
355 <mode>lin</mode>
356 <mouseControl act="jump">continuous</mouseControl>
357 <resolution>-1.00000000</resolution>
358 <randomizable group="0">false</randomizable>
359 </bsbObject>
360 <bsbObject version="2" type="BSBDisplay">
361 <objectName>Bandwidth_Value</objectName>
362 <x>449</x>
363 <y>72</y>
364 <width>60</width>
365 <height>30</height>
366 <uuid>{58265963-6245-459e-8071-9ed8bba850a4}</uuid>
367 <visible>true</visible>
368 <midichan>0</midichan>
369 <midicc>0</midicc>
370 <label>0.251</label>
371 <alignment>right</alignment>
372 <font>Liberation Sans</font>
373 <fontsize>9</fontsize>
374 <precision>3</precision>
375 <color>
376 <r>255</r>
377 <g>255</g>
378 <b>255</b>
379 </color>
380 <bgcolor mode="nobackground">
381 <r>255</r>
382 <g>255</g>
383 <b>255</b>
384 </bgcolor>
385 <bordermode>noborder</bordermode>
386 <borderradius>1</borderradius>
387 <borderwidth>1</borderwidth>
388 </bsbObject>
389 <bsbObject version="2" type="BSBLabel">
390 <objectName/>
391 <x>9</x>
392 <y>231</y>
393 <width>200</width>
394 <height>30</height>
395 <uuid>{1c02d7bd-4198-417f-a816-a560f4133e23}</uuid>
396 <visible>true</visible>
397 <midichan>0</midichan>
398 <midicc>0</midicc>
399 <label>Highpass Filter Gain</label>
400 <alignment>left</alignment>
401 <font>Liberation Sans</font>
402 <fontsize>10</fontsize>
403 <precision>3</precision>
404 <color>
405 <r>255</r>
406 <g>255</g>
407 <b>255</b>
408 </color>
409 <bgcolor mode="nobackground">
410 <r>255</r>
411 <g>255</g>
412 <b>255</b>
413 </bgcolor>
414 <bordermode>noborder</bordermode>
415 <borderradius>1</borderradius>
416 <borderwidth>1</borderwidth>
417 </bsbObject>
418 <bsbObject version="2" type="BSBHSlider">
419 <objectName>HPGain</objectName>
420 <x>9</x>
421 <y>208</y>
422 <width>500</width>
423 <height>27</height>
424 <uuid>{e5fa660d-82a5-412a-a76a-500a0632ee0c}</uuid>
425 <visible>true</visible>
426 <midichan>0</midichan>
427 <midicc>0</midicc>
428 <minimum>0.00000000</minimum>
429 <maximum>1.00000000</maximum>
430 <value>0.80629998</value>
431 <mode>lin</mode>
432 <mouseControl act="jump">continuous</mouseControl>
433 <resolution>-1.00000000</resolution>
434 <randomizable group="0">false</randomizable>
435 </bsbObject>
436 <bsbObject version="2" type="BSBDisplay">
437 <objectName>HPGain_Value</objectName>
438 <x>449</x>
439 <y>231</y>
440 <width>60</width>
441 <height>30</height>
442 <uuid>{8341c14a-4acb-4d3d-824f-675147975768}</uuid>
443 <visible>true</visible>
444 <midichan>0</midichan>
445 <midicc>0</midicc>
446 <label>15.006</label>
447 <alignment>right</alignment>
448 <font>Liberation Sans</font>
449 <fontsize>9</fontsize>
450 <precision>3</precision>
451 <color>
452 <r>255</r>
453 <g>255</g>
454 <b>255</b>
455 </color>
456 <bgcolor mode="nobackground">
457 <r>255</r>
458 <g>255</g>
459 <b>255</b>
460 </bgcolor>
461 <bordermode>noborder</bordermode>
462 <borderradius>1</borderradius>
463 <borderwidth>1</borderwidth>
464 </bsbObject>
465 <bsbObject version="2" type="BSBLabel">
466 <objectName/>
467 <x>9</x>
468 <y>178</y>
469 <width>200</width>
470 <height>30</height>
471 <uuid>{fd3ea893-7f4f-4d74-a6c6-2ed00b696056}</uuid>
472 <visible>true</visible>
473 <midichan>0</midichan>
474 <midicc>0</midicc>
475 <label>Bandpass Filters Gain</label>
476 <alignment>left</alignment>
477 <font>Liberation Sans</font>
478 <fontsize>10</fontsize>
479 <precision>3</precision>
480 <color>
481 <r>255</r>
482 <g>255</g>
483 <b>255</b>
484 </color>
485 <bgcolor mode="nobackground">
486 <r>255</r>
487 <g>255</g>
488 <b>255</b>
489 </bgcolor>
490 <bordermode>noborder</bordermode>
491 <borderradius>1</borderradius>
492 <borderwidth>1</borderwidth>
493 </bsbObject>
494 <bsbObject version="2" type="BSBHSlider">
495 <objectName>BPGain</objectName>
496 <x>9</x>
497 <y>155</y>
498 <width>500</width>
499 <height>27</height>
500 <uuid>{3911e6c3-0337-45b0-81d8-e63c67cae1f3}</uuid>
501 <visible>true</visible>
502 <midichan>0</midichan>
503 <midicc>0</midicc>
504 <minimum>0.00000000</minimum>
505 <maximum>1.00000000</maximum>
506 <value>0.48199999</value>
507 <mode>lin</mode>
508 <mouseControl act="jump">continuous</mouseControl>
509 <resolution>-1.00000000</resolution>
510 <randomizable group="0">false</randomizable>
511 </bsbObject>
512 <bsbObject version="2" type="BSBDisplay">
513 <objectName>BPGain_Value</objectName>
514 <x>449</x>
515 <y>178</y>
516 <width>60</width>
517 <height>30</height>
518 <uuid>{78473677-bb47-45c2-bf88-fa6930dca759}</uuid>
519 <visible>true</visible>
520 <midichan>0</midichan>
521 <midicc>0</midicc>
522 <label>2.000</label>
523 <alignment>right</alignment>
524 <font>Liberation Sans</font>
525 <fontsize>9</fontsize>
526 <precision>3</precision>
527 <color>
528 <r>255</r>
529 <g>255</g>
530 <b>255</b>
531 </color>
532 <bgcolor mode="nobackground">
533 <r>255</r>
534 <g>255</g>
535 <b>255</b>
536 </bgcolor>
537 <bordermode>noborder</bordermode>
538 <borderradius>1</borderradius>
539 <borderwidth>1</borderwidth>
540 </bsbObject>
541 <bsbObject version="2" type="BSBLabel">
542 <objectName/>
543 <x>9</x>
544 <y>260</y>
545 <width>100</width>
546 <height>30</height>
547 <uuid>{d7f5620d-8a05-4982-8edb-af45fcc4611c}</uuid>
548 <visible>true</visible>
549 <midichan>0</midichan>
550 <midicc>0</midicc>
551 <label>Base Note</label>
552 <alignment>right</alignment>
553 <font>Liberation Sans</font>
554 <fontsize>10</fontsize>
555 <precision>3</precision>
556 <color>
557 <r>255</r>
558 <g>255</g>
559 <b>255</b>
560 </color>
561 <bgcolor mode="nobackground">
562 <r>255</r>
563 <g>255</g>
564 <b>255</b>
565 </bgcolor>
566 <bordermode>noborder</bordermode>
567 <borderradius>1</borderradius>
568 <borderwidth>1</borderwidth>
569 </bsbObject>
570 <bsbObject version="2" type="BSBLabel">
571 <objectName/>
572 <x>9</x>
573 <y>291</y>
574 <width>1026</width>
575 <height>301</height>
576 <uuid>{3d230d57-2e7b-4bd4-8175-e6a7da3e9e07}</uuid>
577 <visible>true</visible>
578 <midichan>0</midichan>
579 <midicc>0</midicc>
580 <label>-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
581 This is an implementation of a traditional analogue style vocoder.
582 Two audio signals, referred to as a modulator and a carrier, are passed into the vocoder effect. The modulator is is typically a voice and the carrier is typically a synthesizer. The modulator is analysed by being passed into multiband filter (bank of bandpass filters), the amplitude envelope of each band is tracked and a control function for each band generated. The carrier signal is also passed through a matching multiband filter, the set of amplitude envelopes derived from the modulator analysis is applied to outputs of this second multiband filter. In this implementation the user can vary the 'Base Note' or the frequency of the lowermost filter expressed as a MIDI note value. The number of filters in both filter banks can be varied as can the spacing between adjacent filters, expressed in semitones, and the bandwidth of the filters, expressed as a fraction of an octave. Whenever changes are made to these controls the vocoder instrument reinitializes itself and at the same time checks if any of the filter frequencies will exceed the nyquist frequency, in which case they will be omitted. For this reason the actual number of filters implemented may not be the number asked for using the GUI counter. Filter frequency data is printed to the terminal each time a change is made. The uppermost band of the filter bank is always a highpass filter. This is to allow high frequency sibilants to be in modulator to be accurately represented. In this implementation the user can choose between two internal sound files and the computer's live audio input as modulator source. If 'microphone' is chosen then audio is read from the computer's left input channel. For carrier signal there is a simple built-in synth with four waveform options and a resonant lowpass filter (moogladder). This internal synth is ideally played from an external MIDI keyboard - modify &lt;CsOptions> accordingly.
583 If 'External' is chosen then audio is taken from the computer's right channel input. You can connect you own hardware synthesizer here. Filter creation is controlled using a UDO with recursion so that the number of filters can be changed without having to rewrite code. The filter slopes are switchable between 12 dB per octave and 24 dB per octave. Choosing 24 dB per octave effectively doubles the number of filters used as for each band two series filters are used instead of one. Older computers may struggle in realtime with 24 dB per octave when combined with large number of filters.</label>
584 <alignment>left</alignment>
585 <font>Liberation Sans</font>
586 <fontsize>14</fontsize>
587 <precision>3</precision>
588 <color>
589 <r>255</r>
590 <g>255</g>
591 <b>255</b>
592 </color>
593 <bgcolor mode="nobackground">
594 <r>255</r>
595 <g>255</g>
596 <b>255</b>
597 </bgcolor>
598 <bordermode>noborder</bordermode>
599 <borderradius>1</borderradius>
600 <borderwidth>1</borderwidth>
601 </bsbObject>
602 <bsbObject version="2" type="BSBLabel">
603 <objectName/>
604 <x>517</x>
605 <y>49</y>
606 <width>512</width>
607 <height>95</height>
608 <uuid>{0084c854-b62e-4a4d-8290-1d7db3f769e5}</uuid>
609 <visible>true</visible>
610 <midichan>0</midichan>
611 <midicc>0</midicc>
612 <label>Modulator</label>
613 <alignment>left</alignment>
614 <font>Arial</font>
615 <fontsize>14</fontsize>
616 <precision>3</precision>
617 <color>
618 <r>255</r>
619 <g>255</g>
620 <b>255</b>
621 </color>
622 <bgcolor mode="nobackground">
623 <r>255</r>
624 <g>255</g>
625 <b>255</b>
626 </bgcolor>
627 <bordermode>border</bordermode>
628 <borderradius>10</borderradius>
629 <borderwidth>2</borderwidth>
630 </bsbObject>
631 <bsbObject version="2" type="BSBButton">
632 <objectName>_Browse</objectName>
633 <x>522</x>
634 <y>106</y>
635 <width>170</width>
636 <height>30</height>
637 <uuid>{553ef759-a6a8-4856-8b44-e46a7916ad88}</uuid>
638 <visible>true</visible>
639 <midichan>0</midichan>
640 <midicc>0</midicc>
641 <type>value</type>
642 <pressedValue>1.00000000</pressedValue>
643 <stringvalue>AndItsAll.wav</stringvalue>
644 <text>Browse Audio File</text>
645 <image>/</image>
646 <eventLine/>
647 <latch>false</latch>
648 <latched>false</latched>
649 </bsbObject>
650 <bsbObject version="2" type="BSBLineEdit">
651 <objectName>_Browse</objectName>
652 <x>693</x>
653 <y>107</y>
654 <width>330</width>
655 <height>28</height>
656 <uuid>{d99fb6e8-ff26-4114-994b-4a3d44cdb7bc}</uuid>
657 <visible>true</visible>
658 <midichan>0</midichan>
659 <midicc>0</midicc>
660 <label>AndItsAll.wav</label>
661 <alignment>left</alignment>
662 <font>Liberation Sans</font>
663 <fontsize>10</fontsize>
664 <precision>3</precision>
665 <color>
666 <r>0</r>
667 <g>0</g>
668 <b>0</b>
669 </color>
670 <bgcolor mode="nobackground">
671 <r>229</r>
672 <g>229</g>
673 <b>229</b>
674 </bgcolor>
675 <background>nobackground</background>
676 </bsbObject>
677 <bsbObject version="2" type="BSBLabel">
678 <objectName/>
679 <x>522</x>
680 <y>85</y>
681 <width>150</width>
682 <height>30</height>
683 <uuid>{43f7116d-e6bc-4121-a7d8-624b37846007}</uuid>
684 <visible>true</visible>
685 <midichan>0</midichan>
686 <midicc>0</midicc>
687 <label>Audio File</label>
688 <alignment>left</alignment>
689 <font>Liberation Sans</font>
690 <fontsize>10</fontsize>
691 <precision>3</precision>
692 <color>
693 <r>255</r>
694 <g>255</g>
695 <b>255</b>
696 </color>
697 <bgcolor mode="nobackground">
698 <r>255</r>
699 <g>255</g>
700 <b>255</b>
701 </bgcolor>
702 <bordermode>noborder</bordermode>
703 <borderradius>1</borderradius>
704 <borderwidth>1</borderwidth>
705 </bsbObject>
706 <bsbObject version="2" type="BSBDropdown">
707 <objectName>ModIn</objectName>
708 <x>813</x>
709 <y>57</y>
710 <width>210</width>
711 <height>30</height>
712 <uuid>{56035bec-5d19-4dfe-95e2-4eba077267e8}</uuid>
713 <visible>true</visible>
714 <midichan>0</midichan>
715 <midicc>0</midicc>
716 <bsbDropdownItemList>
717 <bsbDropdownItem>
718 <name>Audio File</name>
719 <value>0</value>
720 <stringvalue/>
721 </bsbDropdownItem>
722 <bsbDropdownItem>
723 <name> Micophone (Left Channel)</name>
724 <value>1</value>
725 <stringvalue/>
726 </bsbDropdownItem>
727 </bsbDropdownItemList>
728 <selectedIndex>0</selectedIndex>
729 <randomizable group="0">false</randomizable>
730 </bsbObject>
731 <bsbObject version="2" type="BSBSpinBox">
732 <objectName>BaseNote</objectName>
733 <x>109</x>
734 <y>260</y>
735 <width>60</width>
736 <height>30</height>
737 <uuid>{66a00915-8240-4189-b441-9cc8399d70aa}</uuid>
738 <visible>true</visible>
739 <midichan>0</midichan>
740 <midicc>0</midicc>
741 <alignment>center</alignment>
742 <font>Arial</font>
743 <fontsize>14</fontsize>
744 <color>
745 <r>0</r>
746 <g>0</g>
747 <b>0</b>
748 </color>
749 <bgcolor mode="nobackground">
750 <r>255</r>
751 <g>255</g>
752 <b>255</b>
753 </bgcolor>
754 <resolution>1.00000000</resolution>
755 <minimum>24</minimum>
756 <maximum>80</maximum>
757 <randomizable group="0">false</randomizable>
758 <value>40</value>
759 </bsbObject>
760 <bsbObject version="2" type="BSBLabel">
761 <objectName/>
762 <x>169</x>
763 <y>260</y>
764 <width>100</width>
765 <height>30</height>
766 <uuid>{2ff0a3cd-f045-46fa-bcbc-4f44ee7fb423}</uuid>
767 <visible>true</visible>
768 <midichan>0</midichan>
769 <midicc>0</midicc>
770 <label>Num. Bands</label>
771 <alignment>right</alignment>
772 <font>Liberation Sans</font>
773 <fontsize>10</fontsize>
774 <precision>3</precision>
775 <color>
776 <r>255</r>
777 <g>255</g>
778 <b>255</b>
779 </color>
780 <bgcolor mode="nobackground">
781 <r>255</r>
782 <g>255</g>
783 <b>255</b>
784 </bgcolor>
785 <bordermode>noborder</bordermode>
786 <borderradius>1</borderradius>
787 <borderwidth>1</borderwidth>
788 </bsbObject>
789 <bsbObject version="2" type="BSBSpinBox">
790 <objectName>NumBands</objectName>
791 <x>269</x>
792 <y>260</y>
793 <width>60</width>
794 <height>30</height>
795 <uuid>{aa29e343-5d22-4238-bb99-a1a9ba851b2d}</uuid>
796 <visible>true</visible>
797 <midichan>0</midichan>
798 <midicc>0</midicc>
799 <alignment>center</alignment>
800 <font>Arial</font>
801 <fontsize>14</fontsize>
802 <color>
803 <r>0</r>
804 <g>0</g>
805 <b>0</b>
806 </color>
807 <bgcolor mode="nobackground">
808 <r>255</r>
809 <g>255</g>
810 <b>255</b>
811 </bgcolor>
812 <resolution>1.00000000</resolution>
813 <minimum>1</minimum>
814 <maximum>100</maximum>
815 <randomizable group="0">false</randomizable>
816 <value>50</value>
817 </bsbObject>
818 <bsbObject version="2" type="BSBLabel">
819 <objectName/>
820 <x>329</x>
821 <y>260</y>
822 <width>100</width>
823 <height>30</height>
824 <uuid>{7ba7c4e3-eaeb-4036-b014-11c0c41d483c}</uuid>
825 <visible>true</visible>
826 <midichan>0</midichan>
827 <midicc>0</midicc>
828 <label>dB per Oct</label>
829 <alignment>right</alignment>
830 <font>Liberation Sans</font>
831 <fontsize>10</fontsize>
832 <precision>3</precision>
833 <color>
834 <r>255</r>
835 <g>255</g>
836 <b>255</b>
837 </color>
838 <bgcolor mode="nobackground">
839 <r>255</r>
840 <g>255</g>
841 <b>255</b>
842 </bgcolor>
843 <bordermode>noborder</bordermode>
844 <borderradius>1</borderradius>
845 <borderwidth>1</borderwidth>
846 </bsbObject>
847 <bsbObject version="2" type="BSBSpinBox">
848 <objectName>dBperOct</objectName>
849 <x>429</x>
850 <y>260</y>
851 <width>60</width>
852 <height>30</height>
853 <uuid>{e6b15ddb-b975-49ae-9770-d82aefa41f83}</uuid>
854 <visible>true</visible>
855 <midichan>0</midichan>
856 <midicc>0</midicc>
857 <alignment>center</alignment>
858 <font>Arial</font>
859 <fontsize>14</fontsize>
860 <color>
861 <r>0</r>
862 <g>0</g>
863 <b>0</b>
864 </color>
865 <bgcolor mode="nobackground">
866 <r>255</r>
867 <g>255</g>
868 <b>255</b>
869 </bgcolor>
870 <resolution>1.00000000</resolution>
871 <minimum>12</minimum>
872 <maximum>24</maximum>
873 <randomizable group="0">false</randomizable>
874 <value>24</value>
875 </bsbObject>
876 <bsbObject version="2" type="BSBLabel">
877 <objectName/>
878 <x>517</x>
879 <y>151</y>
880 <width>512</width>
881 <height>140</height>
882 <uuid>{c9a8a317-ee56-436a-aefb-5ce9e2816aef}</uuid>
883 <visible>true</visible>
884 <midichan>0</midichan>
885 <midicc>0</midicc>
886 <label>Carrier</label>
887 <alignment>left</alignment>
888 <font>Arial</font>
889 <fontsize>14</fontsize>
890 <precision>3</precision>
891 <color>
892 <r>255</r>
893 <g>255</g>
894 <b>255</b>
895 </color>
896 <bgcolor mode="nobackground">
897 <r>255</r>
898 <g>255</g>
899 <b>255</b>
900 </bgcolor>
901 <bordermode>border</bordermode>
902 <borderradius>10</borderradius>
903 <borderwidth>2</borderwidth>
904 </bsbObject>
905 <bsbObject version="2" type="BSBDropdown">
906 <objectName>CarIn</objectName>
907 <x>522</x>
908 <y>192</y>
909 <width>210</width>
910 <height>30</height>
911 <uuid>{87392937-db97-42d1-8890-d619532257bb}</uuid>
912 <visible>true</visible>
913 <midichan>0</midichan>
914 <midicc>0</midicc>
915 <bsbDropdownItemList>
916 <bsbDropdownItem>
917 <name>Internal Synth</name>
918 <value>0</value>
919 <stringvalue/>
920 </bsbDropdownItem>
921 <bsbDropdownItem>
922 <name>External (Right Channel)</name>
923 <value>1</value>
924 <stringvalue/>
925 </bsbDropdownItem>
926 </bsbDropdownItemList>
927 <selectedIndex>0</selectedIndex>
928 <randomizable group="0">false</randomizable>
929 </bsbObject>
930 <bsbObject version="2" type="BSBDropdown">
931 <objectName>SynType</objectName>
932 <x>902</x>
933 <y>192</y>
934 <width>120</width>
935 <height>30</height>
936 <uuid>{1eca9d44-ace2-4e49-b0ec-ced60019042b}</uuid>
937 <visible>true</visible>
938 <midichan>0</midichan>
939 <midicc>0</midicc>
940 <bsbDropdownItemList>
941 <bsbDropdownItem>
942 <name>Sawtooth</name>
943 <value>0</value>
944 <stringvalue/>
945 </bsbDropdownItem>
946 <bsbDropdownItem>
947 <name>Square</name>
948 <value>1</value>
949 <stringvalue/>
950 </bsbDropdownItem>
951 <bsbDropdownItem>
952 <name>Pulse</name>
953 <value>2</value>
954 <stringvalue/>
955 </bsbDropdownItem>
956 <bsbDropdownItem>
957 <name>Noise</name>
958 <value>3</value>
959 <stringvalue/>
960 </bsbDropdownItem>
961 </bsbDropdownItemList>
962 <selectedIndex>0</selectedIndex>
963 <randomizable group="0">false</randomizable>
964 </bsbObject>
965 <bsbObject version="2" type="BSBLabel">
966 <objectName/>
967 <x>780</x>
968 <y>192</y>
969 <width>120</width>
970 <height>30</height>
971 <uuid>{fc6f50d0-1a2d-471c-9b93-792a6fccca9b}</uuid>
972 <visible>true</visible>
973 <midichan>0</midichan>
974 <midicc>0</midicc>
975 <label>Internal Synth Wave</label>
976 <alignment>right</alignment>
977 <font>Liberation Sans</font>
978 <fontsize>10</fontsize>
979 <precision>3</precision>
980 <color>
981 <r>255</r>
982 <g>255</g>
983 <b>255</b>
984 </color>
985 <bgcolor mode="nobackground">
986 <r>255</r>
987 <g>255</g>
988 <b>255</b>
989 </bgcolor>
990 <bordermode>noborder</bordermode>
991 <borderradius>1</borderradius>
992 <borderwidth>1</borderwidth>
993 </bsbObject>
994 <bsbObject version="2" type="BSBController">
995 <objectName>LPF</objectName>
996 <x>556</x>
997 <y>252</y>
998 <width>200</width>
999 <height>12</height>
1000 <uuid>{9af6561a-c1a5-4ea2-8e69-24b2ece53fd1}</uuid>
1001 <visible>true</visible>
1002 <midichan>0</midichan>
1003 <midicc>0</midicc>
1004 <objectName2/>
1005 <xMin>0.00000000</xMin>
1006 <xMax>1.00000000</xMax>
1007 <yMin>0.00000000</yMin>
1008 <yMax>1.00000000</yMax>
1009 <xValue>0.87449998</xValue>
1010 <yValue>0.00000000</yValue>
1011 <type>fill</type>
1012 <pointsize>1</pointsize>
1013 <fadeSpeed>0.00000000</fadeSpeed>
1014 <mouseControl act="press">jump</mouseControl>
1015 <color>
1016 <r>0</r>
1017 <g>234</g>
1018 <b>0</b>
1019 </color>
1020 <randomizable mode="both" group="0">false</randomizable>
1021 <bgcolor>
1022 <r>0</r>
1023 <g>0</g>
1024 <b>0</b>
1025 </bgcolor>
1026 </bsbObject>
1027 <bsbObject version="2" type="BSBLabel">
1028 <objectName/>
1029 <x>517</x>
1030 <y>248</y>
1031 <width>40</width>
1032 <height>24</height>
1033 <uuid>{0925f33c-4729-4fd1-8a2a-53ce834d94b8}</uuid>
1034 <visible>true</visible>
1035 <midichan>0</midichan>
1036 <midicc>0</midicc>
1037 <label>LPF</label>
1038 <alignment>right</alignment>
1039 <font>Liberation Sans</font>
1040 <fontsize>10</fontsize>
1041 <precision>3</precision>
1042 <color>
1043 <r>255</r>
1044 <g>255</g>
1045 <b>255</b>
1046 </color>
1047 <bgcolor mode="nobackground">
1048 <r>255</r>
1049 <g>255</g>
1050 <b>255</b>
1051 </bgcolor>
1052 <bordermode>noborder</bordermode>
1053 <borderradius>1</borderradius>
1054 <borderwidth>1</borderwidth>
1055 </bsbObject>
1056 <bsbObject version="2" type="BSBController">
1057 <objectName>Res</objectName>
1058 <x>820</x>
1059 <y>252</y>
1060 <width>200</width>
1061 <height>12</height>
1062 <uuid>{e2a71ace-794e-42ac-b3d9-f3ffa358cdb6}</uuid>
1063 <visible>true</visible>
1064 <midichan>0</midichan>
1065 <midicc>0</midicc>
1066 <objectName2/>
1067 <xMin>0.00000000</xMin>
1068 <xMax>1.00000000</xMax>
1069 <yMin>0.00000000</yMin>
1070 <yMax>1.00000000</yMax>
1071 <xValue>0.00000000</xValue>
1072 <yValue>0.00000000</yValue>
1073 <type>fill</type>
1074 <pointsize>1</pointsize>
1075 <fadeSpeed>0.00000000</fadeSpeed>
1076 <mouseControl act="press">jump</mouseControl>
1077 <color>
1078 <r>0</r>
1079 <g>234</g>
1080 <b>0</b>
1081 </color>
1082 <randomizable mode="both" group="0">false</randomizable>
1083 <bgcolor>
1084 <r>0</r>
1085 <g>0</g>
1086 <b>0</b>
1087 </bgcolor>
1088 </bsbObject>
1089 <bsbObject version="2" type="BSBLabel">
1090 <objectName/>
1091 <x>780</x>
1092 <y>248</y>
1093 <width>40</width>
1094 <height>24</height>
1095 <uuid>{99ee820d-dc5e-4f4c-9005-7fa02564ae07}</uuid>
1096 <visible>true</visible>
1097 <midichan>0</midichan>
1098 <midicc>0</midicc>
1099 <label>Res</label>
1100 <alignment>right</alignment>
1101 <font>Liberation Sans</font>
1102 <fontsize>10</fontsize>
1103 <precision>3</precision>
1104 <color>
1105 <r>255</r>
1106 <g>255</g>
1107 <b>255</b>
1108 </color>
1109 <bgcolor mode="nobackground">
1110 <r>255</r>
1111 <g>255</g>
1112 <b>255</b>
1113 </bgcolor>
1114 <bordermode>noborder</bordermode>
1115 <borderradius>1</borderradius>
1116 <borderwidth>1</borderwidth>
1117 </bsbObject>
1118 </bsbPanel>
1119 <bsbPresets>
1120 </bsbPresets>
1121 <EventPanel name="" tempo="60.00000000" loop="8.00000000" x="913" y="162" width="655" height="346" visible="false" loopStart="0" loopEnd="0"> </EventPanel>