Debian Codegraph @

src/Examples/CsoundQt/Useful/IO_Test.csd

raw
1 <CsoundSynthesizer>
2 <CsOptions>
3 </CsOptions>
4 <CsInstruments>
5
6 sr = 44100
7 ksmps = 128
8 nchnls = 2
9 0dbfs = 1
10
11 massign 0, 2
12
13 instr 1
14 ; Signal generator
15 ksignal invalue "signal"
16 klevel invalue "level"
17 kon1 invalue "on1"
18 kon2 invalue "on2"
19
20 k1 init -90
21 k2 init -90
22
23 klevel = ampdbfs(klevel)
24 asig = 0
25 if ksignal == 1 then
26 asig oscil klevel, 1000, 1
27 elseif ksignal == 2 then
28 asig rand klevel
29 endif
30
31 outs asig*kon1, asig*kon2
32
33 ; Measure inputs
34
35 irange = 48
36 imin = ampdbfs(-irange)
37 ain1 inch 1
38 ain2 inch 2
39
40 ktrig metro 15
41
42 koldk1 = k1
43 koldk2 = k2
44 k1 max_k ain1, ktrig, 1
45 k2 max_k ain2, ktrig, 1
46
47 ; slow decay time for meters (but fast attack)
48 if (k1 < koldk1) then
49 k1 = koldk1 - (koldk1 - k1)*0.3
50 endif
51
52 if (k2 < koldk2) then
53 k2 = koldk2 - (koldk2 - k2)*0.3
54 endif
55
56 if ktrig == 1 then
57 outvalue "in1", (irange + dbfsamp(k1))/irange
58 outvalue "in2", (irange + dbfsamp(k2))/irange
59 endif
60
61 ;update tex display at slower rate
62 ktrig2 metro 4
63 if ktrig2 == 1 then
64 outvalue "indb1", dbfsamp(k1)
65 outvalue "indb2", dbfsamp(k2)
66 endif
67
68 endin
69
70 instr 2 ; midi note input
71 xtratim 0.1
72 kflag release
73 outvalue "notein", (kflag * -1)+ 1
74 endin
75
76 instr 3
77 noteondur 1, 60, 100, p3
78 endin
79
80
81 </CsInstruments>
82 <CsScore>
83 f 1 0 1024 10 1
84 i 1 0 3600
85 e
86 </CsScore>
87 </CsoundSynthesizer>
88 <bsbPanel>
89 <label>Widgets</label>
90 <objectName/>
91 <x>957</x>
92 <y>473</y>
93 <width>260</width>
94 <height>294</height>
95 <visible>true</visible>
96 <uuid/>
97 <bgcolor mode="background">
98 <r>132</r>
99 <g>127</g>
100 <b>89</b>
101 </bgcolor>
102 <bsbObject version="2" type="BSBLabel">
103 <objectName/>
104 <x>4</x>
105 <y>4</y>
106 <width>245</width>
107 <height>31</height>
108 <uuid>{dc5604fd-41c0-4189-abe2-55c72f10172b}</uuid>
109 <visible>true</visible>
110 <midichan>0</midichan>
111 <midicc>-3</midicc>
112 <description/>
113 <label>I/O Test</label>
114 <alignment>center</alignment>
115 <valignment>top</valignment>
116 <font>Helvetica</font>
117 <fontsize>20</fontsize>
118 <precision>3</precision>
119 <color>
120 <r>0</r>
121 <g>0</g>
122 <b>0</b>
123 </color>
124 <bgcolor mode="background">
125 <r>255</r>
126 <g>255</g>
127 <b>255</b>
128 </bgcolor>
129 <bordermode>border</bordermode>
130 <borderradius>5</borderradius>
131 <borderwidth>1</borderwidth>
132 </bsbObject>
133 <bsbObject version="2" type="BSBLabel">
134 <objectName/>
135 <x>117</x>
136 <y>39</y>
137 <width>131</width>
138 <height>149</height>
139 <uuid>{5685dc7a-1a9a-4199-ae42-93b1214fbf71}</uuid>
140 <visible>true</visible>
141 <midichan>0</midichan>
142 <midicc>-3</midicc>
143 <description/>
144 <label>Audio Output</label>
145 <alignment>left</alignment>
146 <valignment>top</valignment>
147 <font>Helvetica</font>
148 <fontsize>8</fontsize>
149 <precision>3</precision>
150 <color>
151 <r>0</r>
152 <g>0</g>
153 <b>0</b>
154 </color>
155 <bgcolor mode="background">
156 <r>170</r>
157 <g>170</g>
158 <b>127</b>
159 </bgcolor>
160 <bordermode>border</bordermode>
161 <borderradius>5</borderradius>
162 <borderwidth>1</borderwidth>
163 </bsbObject>
164 <bsbObject version="2" type="BSBLabel">
165 <objectName/>
166 <x>124</x>
167 <y>57</y>
168 <width>117</width>
169 <height>122</height>
170 <uuid>{fd6fcd6b-0db4-4c22-aeed-3c260dbe55c1}</uuid>
171 <visible>true</visible>
172 <midichan>0</midichan>
173 <midicc>-3</midicc>
174 <description/>
175 <label>Signal generator</label>
176 <alignment>left</alignment>
177 <valignment>top</valignment>
178 <font>Helvetica</font>
179 <fontsize>8</fontsize>
180 <precision>3</precision>
181 <color>
182 <r>0</r>
183 <g>0</g>
184 <b>0</b>
185 </color>
186 <bgcolor mode="nobackground">
187 <r>255</r>
188 <g>255</g>
189 <b>255</b>
190 </bgcolor>
191 <bordermode>border</bordermode>
192 <borderradius>5</borderradius>
193 <borderwidth>1</borderwidth>
194 </bsbObject>
195 <bsbObject version="2" type="BSBLabel">
196 <objectName/>
197 <x>6</x>
198 <y>39</y>
199 <width>108</width>
200 <height>244</height>
201 <uuid>{6b0524fe-c62b-443e-a7cc-2786168abc62}</uuid>
202 <visible>true</visible>
203 <midichan>0</midichan>
204 <midicc>-3</midicc>
205 <description/>
206 <label>Audio Input</label>
207 <alignment>left</alignment>
208 <valignment>top</valignment>
209 <font>Helvetica</font>
210 <fontsize>8</fontsize>
211 <precision>3</precision>
212 <color>
213 <r>0</r>
214 <g>0</g>
215 <b>0</b>
216 </color>
217 <bgcolor mode="background">
218 <r>170</r>
219 <g>170</g>
220 <b>127</b>
221 </bgcolor>
222 <bordermode>border</bordermode>
223 <borderradius>5</borderradius>
224 <borderwidth>1</borderwidth>
225 </bsbObject>
226 <bsbObject version="2" type="BSBController">
227 <objectName>hor2</objectName>
228 <x>75</x>
229 <y>65</y>
230 <width>20</width>
231 <height>167</height>
232 <uuid>{9144966e-0db1-4ae8-a1ad-3fb19f21a144}</uuid>
233 <visible>true</visible>
234 <midichan>0</midichan>
235 <midicc>-3</midicc>
236 <description/>
237 <objectName2>in2</objectName2>
238 <xMin>0.00000000</xMin>
239 <xMax>1.00000000</xMax>
240 <yMin>0.00000000</yMin>
241 <yMax>1.00000000</yMax>
242 <xValue>0.23529400</xValue>
243 <yValue>0.36984726</yValue>
244 <type>fill</type>
245 <pointsize>1</pointsize>
246 <fadeSpeed>0.00000000</fadeSpeed>
247 <mouseControl act="press">jump</mouseControl>
248 <bordermode>noborder</bordermode>
249 <borderColor>#00FF00</borderColor>
250 <color>
251 <r>62</r>
252 <g>255</g>
253 <b>51</b>
254 </color>
255 <randomizable group="0" mode="both">false</randomizable>
256 <bgcolor>
257 <r>0</r>
258 <g>0</g>
259 <b>0</b>
260 </bgcolor>
261 <bgcolormode>true</bgcolormode>
262 </bsbObject>
263 <bsbObject version="2" type="BSBController">
264 <objectName>hor2</objectName>
265 <x>27</x>
266 <y>65</y>
267 <width>20</width>
268 <height>167</height>
269 <uuid>{9b761a44-1f92-480b-9656-ffdbfa02e0ed}</uuid>
270 <visible>true</visible>
271 <midichan>0</midichan>
272 <midicc>-3</midicc>
273 <description/>
274 <objectName2>in1</objectName2>
275 <xMin>0.00000000</xMin>
276 <xMax>1.00000000</xMax>
277 <yMin>0.00000000</yMin>
278 <yMax>1.00000000</yMax>
279 <xValue>0.23529400</xValue>
280 <yValue>0.37872212</yValue>
281 <type>fill</type>
282 <pointsize>1</pointsize>
283 <fadeSpeed>0.00000000</fadeSpeed>
284 <mouseControl act="press">jump</mouseControl>
285 <bordermode>noborder</bordermode>
286 <borderColor>#00FF00</borderColor>
287 <color>
288 <r>62</r>
289 <g>255</g>
290 <b>51</b>
291 </color>
292 <randomizable group="0" mode="both">false</randomizable>
293 <bgcolor>
294 <r>0</r>
295 <g>0</g>
296 <b>0</b>
297 </bgcolor>
298 <bgcolormode>true</bgcolormode>
299 </bsbObject>
300 <bsbObject version="2" type="BSBLabel">
301 <objectName/>
302 <x>27</x>
303 <y>228</y>
304 <width>23</width>
305 <height>25</height>
306 <uuid>{cf92f08d-bb58-4a3d-acda-479165db96d4}</uuid>
307 <visible>true</visible>
308 <midichan>0</midichan>
309 <midicc>-3</midicc>
310 <description/>
311 <label>1</label>
312 <alignment>left</alignment>
313 <valignment>top</valignment>
314 <font>DejaVu Sans</font>
315 <fontsize>8</fontsize>
316 <precision>3</precision>
317 <color>
318 <r>0</r>
319 <g>0</g>
320 <b>0</b>
321 </color>
322 <bgcolor mode="nobackground">
323 <r>255</r>
324 <g>255</g>
325 <b>255</b>
326 </bgcolor>
327 <bordermode>noborder</bordermode>
328 <borderradius>1</borderradius>
329 <borderwidth>0</borderwidth>
330 </bsbObject>
331 <bsbObject version="2" type="BSBLabel">
332 <objectName/>
333 <x>76</x>
334 <y>229</y>
335 <width>23</width>
336 <height>25</height>
337 <uuid>{6065bd9d-67ac-4c5e-ba35-921b1df329a4}</uuid>
338 <visible>true</visible>
339 <midichan>0</midichan>
340 <midicc>-3</midicc>
341 <description/>
342 <label>2</label>
343 <alignment>left</alignment>
344 <valignment>top</valignment>
345 <font>DejaVu Sans</font>
346 <fontsize>8</fontsize>
347 <precision>3</precision>
348 <color>
349 <r>0</r>
350 <g>0</g>
351 <b>0</b>
352 </color>
353 <bgcolor mode="nobackground">
354 <r>255</r>
355 <g>255</g>
356 <b>255</b>
357 </bgcolor>
358 <bordermode>noborder</bordermode>
359 <borderradius>1</borderradius>
360 <borderwidth>0</borderwidth>
361 </bsbObject>
362 <bsbObject version="2" type="BSBScrollNumber">
363 <objectName>indb1</objectName>
364 <x>13</x>
365 <y>255</y>
366 <width>41</width>
367 <height>21</height>
368 <uuid>{557e7fb7-3fab-45bd-b4ea-cbe3fd20a92a}</uuid>
369 <visible>true</visible>
370 <midichan>0</midichan>
371 <midicc>0</midicc>
372 <description/>
373 <alignment>center</alignment>
374 <font>Nimbus Sans [urw]</font>
375 <fontsize>13</fontsize>
376 <color>
377 <r>162</r>
378 <g>255</g>
379 <b>155</b>
380 </color>
381 <bgcolor mode="background">
382 <r>42</r>
383 <g>46</g>
384 <b>50</b>
385 </bgcolor>
386 <value>-30.14529155</value>
387 <resolution>0.10000000</resolution>
388 <minimum>-999999999999.00000000</minimum>
389 <maximum>999999999999.00000000</maximum>
390 <bordermode>false</bordermode>
391 <borderradius>5</borderradius>
392 <borderwidth>0</borderwidth>
393 <randomizable group="0">false</randomizable>
394 <mouseControl act=""/>
395 </bsbObject>
396 <bsbObject version="2" type="BSBScrollNumber">
397 <objectName>indb2</objectName>
398 <x>66</x>
399 <y>255</y>
400 <width>41</width>
401 <height>21</height>
402 <uuid>{38bd1f5e-dcf7-4897-a5c6-565e19983e63}</uuid>
403 <visible>true</visible>
404 <midichan>0</midichan>
405 <midicc>0</midicc>
406 <description/>
407 <alignment>center</alignment>
408 <font>Nimbus Sans [urw]</font>
409 <fontsize>13</fontsize>
410 <color>
411 <r>162</r>
412 <g>255</g>
413 <b>155</b>
414 </color>
415 <bgcolor mode="background">
416 <r>42</r>
417 <g>46</g>
418 <b>50</b>
419 </bgcolor>
420 <value>-30.09117508</value>
421 <resolution>0.10000000</resolution>
422 <minimum>-999999999999.00000000</minimum>
423 <maximum>999999999999.00000000</maximum>
424 <bordermode>false</bordermode>
425 <borderradius>5</borderradius>
426 <borderwidth>0</borderwidth>
427 <randomizable group="0">false</randomizable>
428 <mouseControl act=""/>
429 </bsbObject>
430 <bsbObject version="2" type="BSBLabel">
431 <objectName/>
432 <x>117</x>
433 <y>191</y>
434 <width>131</width>
435 <height>92</height>
436 <uuid>{3b5a051f-f624-4116-b580-fb3fba6d3063}</uuid>
437 <visible>true</visible>
438 <midichan>0</midichan>
439 <midicc>-3</midicc>
440 <description/>
441 <label>MIDI note IO</label>
442 <alignment>left</alignment>
443 <valignment>top</valignment>
444 <font>Helvetica</font>
445 <fontsize>8</fontsize>
446 <precision>3</precision>
447 <color>
448 <r>0</r>
449 <g>0</g>
450 <b>0</b>
451 </color>
452 <bgcolor mode="background">
453 <r>170</r>
454 <g>170</g>
455 <b>127</b>
456 </bgcolor>
457 <bordermode>border</bordermode>
458 <borderradius>5</borderradius>
459 <borderwidth>1</borderwidth>
460 </bsbObject>
461 <bsbObject version="2" type="BSBLabel">
462 <objectName/>
463 <x>156</x>
464 <y>215</y>
465 <width>80</width>
466 <height>25</height>
467 <uuid>{b484dae2-4501-4669-9708-26b5a86ea084}</uuid>
468 <visible>true</visible>
469 <midichan>0</midichan>
470 <midicc>-3</midicc>
471 <description/>
472 <label>Note in</label>
473 <alignment>left</alignment>
474 <valignment>top</valignment>
475 <font>DejaVu Sans</font>
476 <fontsize>8</fontsize>
477 <precision>3</precision>
478 <color>
479 <r>0</r>
480 <g>0</g>
481 <b>0</b>
482 </color>
483 <bgcolor mode="nobackground">
484 <r>255</r>
485 <g>255</g>
486 <b>255</b>
487 </bgcolor>
488 <bordermode>noborder</bordermode>
489 <borderradius>1</borderradius>
490 <borderwidth>0</borderwidth>
491 </bsbObject>
492 <bsbObject version="2" type="BSBButton">
493 <objectName>button1</objectName>
494 <x>126</x>
495 <y>241</y>
496 <width>117</width>
497 <height>28</height>
498 <uuid>{a3545b15-5470-4efb-9dfd-eee56bc47d2a}</uuid>
499 <visible>true</visible>
500 <midichan>0</midichan>
501 <midicc>-3</midicc>
502 <description/>
503 <type>event</type>
504 <pressedValue>1.00000000</pressedValue>
505 <stringvalue/>
506 <text>Generate note</text>
507 <image>/</image>
508 <eventLine>i3 0 0.5</eventLine>
509 <latch>false</latch>
510 <momentaryMidiButton>false</momentaryMidiButton>
511 <latched>false</latched>
512 <fontsize>10</fontsize>
513 </bsbObject>
514 <bsbObject version="2" type="BSBController">
515 <objectName>hor21</objectName>
516 <x>135</x>
517 <y>217</y>
518 <width>19</width>
519 <height>19</height>
520 <uuid>{a4ab00b5-62ab-45b1-9b1f-2978742d4057}</uuid>
521 <visible>true</visible>
522 <midichan>0</midichan>
523 <midicc>-3</midicc>
524 <description/>
525 <objectName2>notein</objectName2>
526 <xMin>0.00000000</xMin>
527 <xMax>1.00000000</xMax>
528 <yMin>0.00000000</yMin>
529 <yMax>1.00000000</yMax>
530 <xValue>0.00000000</xValue>
531 <yValue>0.00000000</yValue>
532 <type>fill</type>
533 <pointsize>1</pointsize>
534 <fadeSpeed>0.00000000</fadeSpeed>
535 <mouseControl act="press">jump</mouseControl>
536 <bordermode>noborder</bordermode>
537 <borderColor>#00FF00</borderColor>
538 <color>
539 <r>0</r>
540 <g>234</g>
541 <b>0</b>
542 </color>
543 <randomizable group="0" mode="both">false</randomizable>
544 <bgcolor>
545 <r>0</r>
546 <g>0</g>
547 <b>0</b>
548 </bgcolor>
549 <bgcolormode>true</bgcolormode>
550 </bsbObject>
551 <bsbObject version="2" type="BSBDropdown">
552 <objectName>signal</objectName>
553 <x>133</x>
554 <y>81</y>
555 <width>99</width>
556 <height>23</height>
557 <uuid>{6d7e91db-0e40-4c78-8ff3-e01a436b45af}</uuid>
558 <visible>true</visible>
559 <midichan>0</midichan>
560 <midicc>-3</midicc>
561 <description/>
562 <bsbDropdownItemList>
563 <bsbDropdownItem>
564 <name>none</name>
565 <value>0</value>
566 <stringvalue/>
567 </bsbDropdownItem>
568 <bsbDropdownItem>
569 <name>sine</name>
570 <value>1</value>
571 <stringvalue/>
572 </bsbDropdownItem>
573 <bsbDropdownItem>
574 <name>noise</name>
575 <value>2</value>
576 <stringvalue/>
577 </bsbDropdownItem>
578 </bsbDropdownItemList>
579 <selectedIndex>2</selectedIndex>
580 <randomizable group="0">false</randomizable>
581 </bsbObject>
582 <bsbObject version="2" type="BSBLabel">
583 <objectName/>
584 <x>146</x>
585 <y>125</y>
586 <width>23</width>
587 <height>25</height>
588 <uuid>{ebf16146-fe15-4a31-a76b-a9556d01ac6c}</uuid>
589 <visible>true</visible>
590 <midichan>0</midichan>
591 <midicc>-3</midicc>
592 <description/>
593 <label>1</label>
594 <alignment>left</alignment>
595 <valignment>top</valignment>
596 <font>DejaVu Sans</font>
597 <fontsize>8</fontsize>
598 <precision>3</precision>
599 <color>
600 <r>0</r>
601 <g>0</g>
602 <b>0</b>
603 </color>
604 <bgcolor mode="nobackground">
605 <r>255</r>
606 <g>255</g>
607 <b>255</b>
608 </bgcolor>
609 <bordermode>noborder</bordermode>
610 <borderradius>1</borderradius>
611 <borderwidth>0</borderwidth>
612 </bsbObject>
613 <bsbObject version="2" type="BSBLabel">
614 <objectName/>
615 <x>197</x>
616 <y>125</y>
617 <width>23</width>
618 <height>25</height>
619 <uuid>{e6cf4d14-2fc7-48b0-a54b-29da5244fd8c}</uuid>
620 <visible>true</visible>
621 <midichan>0</midichan>
622 <midicc>-3</midicc>
623 <description/>
624 <label>2</label>
625 <alignment>left</alignment>
626 <valignment>top</valignment>
627 <font>DejaVu Sans</font>
628 <fontsize>8</fontsize>
629 <precision>3</precision>
630 <color>
631 <r>0</r>
632 <g>0</g>
633 <b>0</b>
634 </color>
635 <bgcolor mode="nobackground">
636 <r>255</r>
637 <g>255</g>
638 <b>255</b>
639 </bgcolor>
640 <bordermode>noborder</bordermode>
641 <borderradius>1</borderradius>
642 <borderwidth>0</borderwidth>
643 </bsbObject>
644 <bsbObject version="2" type="BSBCheckBox">
645 <objectName>on1</objectName>
646 <x>147</x>
647 <y>108</y>
648 <width>20</width>
649 <height>20</height>
650 <uuid>{3c136c88-19ed-4e92-9def-eacb6213dc7c}</uuid>
651 <visible>true</visible>
652 <midichan>0</midichan>
653 <midicc>-3</midicc>
654 <description/>
655 <selected>false</selected>
656 <label/>
657 <pressedValue>1</pressedValue>
658 <randomizable group="0">false</randomizable>
659 </bsbObject>
660 <bsbObject version="2" type="BSBCheckBox">
661 <objectName>on2</objectName>
662 <x>197</x>
663 <y>109</y>
664 <width>20</width>
665 <height>20</height>
666 <uuid>{3887034c-1195-41f0-aaf4-fb6bbcf576b6}</uuid>
667 <visible>true</visible>
668 <midichan>0</midichan>
669 <midicc>-3</midicc>
670 <description/>
671 <selected>false</selected>
672 <label/>
673 <pressedValue>1</pressedValue>
674 <randomizable group="0">false</randomizable>
675 </bsbObject>
676 <bsbObject version="2" type="BSBScrollNumber">
677 <objectName>level</objectName>
678 <x>188</x>
679 <y>149</y>
680 <width>42</width>
681 <height>22</height>
682 <uuid>{766ecd94-db0b-4271-803c-f740b6ced0d6}</uuid>
683 <visible>true</visible>
684 <midichan>0</midichan>
685 <midicc>-3</midicc>
686 <description/>
687 <alignment>center</alignment>
688 <font>Helvetica</font>
689 <fontsize>11</fontsize>
690 <color>
691 <r>0</r>
692 <g>0</g>
693 <b>0</b>
694 </color>
695 <bgcolor mode="background">
696 <r>255</r>
697 <g>255</g>
698 <b>255</b>
699 </bgcolor>
700 <value>-20.00000000</value>
701 <resolution>0.10000000</resolution>
702 <minimum>-999999999999.00000000</minimum>
703 <maximum>99999999999999.00000000</maximum>
704 <bordermode>border</bordermode>
705 <borderradius>5</borderradius>
706 <borderwidth>1</borderwidth>
707 <randomizable group="0">false</randomizable>
708 <mouseControl act=""/>
709 </bsbObject>
710 <bsbObject version="2" type="BSBLabel">
711 <objectName/>
712 <x>128</x>
713 <y>149</y>
714 <width>61</width>
715 <height>25</height>
716 <uuid>{d4f48a72-3837-4d07-9f63-c637cf212fc2}</uuid>
717 <visible>true</visible>
718 <midichan>0</midichan>
719 <midicc>-3</midicc>
720 <description/>
721 <label>Level</label>
722 <alignment>right</alignment>
723 <valignment>top</valignment>
724 <font>Helvetica</font>
725 <fontsize>10</fontsize>
726 <precision>3</precision>
727 <color>
728 <r>0</r>
729 <g>0</g>
730 <b>0</b>
731 </color>
732 <bgcolor mode="nobackground">
733 <r>255</r>
734 <g>255</g>
735 <b>255</b>
736 </bgcolor>
737 <bordermode>noborder</bordermode>
738 <borderradius>1</borderradius>
739 <borderwidth>0</borderwidth>
740 </bsbObject>
741 </bsbPanel>
742 <bsbPresets>
743 </bsbPresets>