Debian Codegraph @

src/Examples/CsoundQt/Miscellaneous/Mincer_Loop.csd

raw
1 <CsoundSynthesizer>
2 <CsOptions>
3 </CsOptions>
4 <CsInstruments>
5 ;example for csoundqt
6 ;joachim heintz nov 2011
7
8 sr = 44100
9 ksmps = 32
10 nchnls = 1
11 0dbfs = 1
12
13
14 opcode LpPhsr, a, kkkki
15 ;see description at http://www.csounds.com/udo/displayOpcode.php?opcode_id=158
16
17 kloopstart, kloopend, kspeed, kdir, irefdur xin
18
19 kstart01 = kloopstart/irefdur ;start in 0-1 range
20 kend01 = kloopend/irefdur ;end in 0-1 range
21 ifqbas = 1 / irefdur ;phasor frequency for the whole irefdur range
22 kfqrel = ifqbas / (kend01-kstart01) * kspeed ;phasor frequency for the selected section
23 andxrel phasor kfqrel*kdir ;phasor 0-1
24 atimpt = andxrel * (kloopend-kloopstart) + kloopstart ;adjusted to start and end
25
26 xout atimpt
27
28 endop
29
30
31 instr 1
32 ;receive the widget values
33 kloopstart invalue "loopstart"
34 kloopend invalue "loopend"
35 kback invalue "back" ;1 = backwards
36 kspeed invalue "speed" ; 1 = normal
37 kpitch invalue "pitch" ; in semitones
38 kdb invalue "db" ;volume in db
39 klock invalue "lock" ;phase locking on/off
40 Snd invalue "_Browse" ;soundfile
41
42 ;set general values
43 iftsnd ftgen 0, 0, 0, 1, Snd, 0, 0, 1
44 isndlen filelen Snd
45 kdir = (kback == 1 ? -1 : 1)
46 ;set kloopend to isndlen if 0 or larger than isndlen
47 kloopend = (kloopend == 0 || kloopend > isndlen ? isndlen : kloopend)
48
49 atimpt LpPhsr kloopstart, kloopend, kspeed, kdir, isndlen
50
51 ;calculate audio and output result
52 asnd mincer atimpt, ampdb(kdb), semitone(kpitch), iftsnd, klock
53 out asnd
54 endin
55
56
57 </CsInstruments>
58 <CsScore>
59 i 1 0 3600
60 </CsScore>
61 </CsoundSynthesizer>
62 <bsbPanel>
63 <label>Widgets</label>
64 <objectName/>
65 <x>72</x>
66 <y>179</y>
67 <width>400</width>
68 <height>200</height>
69 <visible>true</visible>
70 <uuid/>
71 <bgcolor mode="nobackground">
72 <r>220</r>
73 <g>214</g>
74 <b>207</b>
75 </bgcolor>
76 <bsbObject version="2" type="BSBSpinBox">
77 <objectName>loopstart</objectName>
78 <x>49</x>
79 <y>149</y>
80 <width>80</width>
81 <height>25</height>
82 <uuid>{3c04d57e-8f9a-4cb2-b045-3d9c288b1199}</uuid>
83 <visible>true</visible>
84 <midichan>0</midichan>
85 <midicc>0</midicc>
86 <alignment>right</alignment>
87 <font>Arial</font>
88 <fontsize>14</fontsize>
89 <color>
90 <r>0</r>
91 <g>0</g>
92 <b>0</b>
93 </color>
94 <bgcolor mode="nobackground">
95 <r>255</r>
96 <g>255</g>
97 <b>255</b>
98 </bgcolor>
99 <resolution>0.00100000</resolution>
100 <minimum>0</minimum>
101 <maximum>1e+12</maximum>
102 <randomizable group="0">false</randomizable>
103 <value>0.5</value>
104 </bsbObject>
105 <bsbObject version="2" type="BSBSpinBox">
106 <objectName>loopend</objectName>
107 <x>147</x>
108 <y>149</y>
109 <width>80</width>
110 <height>25</height>
111 <uuid>{196f2bff-845d-4d87-b301-3f53f8c272ca}</uuid>
112 <visible>true</visible>
113 <midichan>0</midichan>
114 <midicc>0</midicc>
115 <alignment>right</alignment>
116 <font>Arial</font>
117 <fontsize>14</fontsize>
118 <color>
119 <r>0</r>
120 <g>0</g>
121 <b>0</b>
122 </color>
123 <bgcolor mode="nobackground">
124 <r>255</r>
125 <g>255</g>
126 <b>255</b>
127 </bgcolor>
128 <resolution>0.00100000</resolution>
129 <minimum>0</minimum>
130 <maximum>1e+12</maximum>
131 <randomizable group="0">false</randomizable>
132 <value>1.5</value>
133 </bsbObject>
134 <bsbObject version="2" type="BSBLabel">
135 <objectName/>
136 <x>48</x>
137 <y>112</y>
138 <width>80</width>
139 <height>25</height>
140 <uuid>{5adeed74-95fd-4ed2-936f-911efaabe12a}</uuid>
141 <visible>true</visible>
142 <midichan>0</midichan>
143 <midicc>0</midicc>
144 <label>loop start</label>
145 <alignment>left</alignment>
146 <font>Arial</font>
147 <fontsize>14</fontsize>
148 <precision>3</precision>
149 <color>
150 <r>0</r>
151 <g>0</g>
152 <b>0</b>
153 </color>
154 <bgcolor mode="nobackground">
155 <r>255</r>
156 <g>255</g>
157 <b>255</b>
158 </bgcolor>
159 <bordermode>noborder</bordermode>
160 <borderradius>1</borderradius>
161 <borderwidth>1</borderwidth>
162 </bsbObject>
163 <bsbObject version="2" type="BSBLabel">
164 <objectName/>
165 <x>146</x>
166 <y>112</y>
167 <width>80</width>
168 <height>25</height>
169 <uuid>{ad9c8d7d-9bbb-466a-86fb-38fbec6537bd}</uuid>
170 <visible>true</visible>
171 <midichan>0</midichan>
172 <midicc>0</midicc>
173 <label>loop end</label>
174 <alignment>left</alignment>
175 <font>Arial</font>
176 <fontsize>14</fontsize>
177 <precision>3</precision>
178 <color>
179 <r>0</r>
180 <g>0</g>
181 <b>0</b>
182 </color>
183 <bgcolor mode="nobackground">
184 <r>255</r>
185 <g>255</g>
186 <b>255</b>
187 </bgcolor>
188 <bordermode>noborder</bordermode>
189 <borderradius>1</borderradius>
190 <borderwidth>1</borderwidth>
191 </bsbObject>
192 <bsbObject version="2" type="BSBCheckBox">
193 <objectName>back</objectName>
194 <x>274</x>
195 <y>149</y>
196 <width>20</width>
197 <height>20</height>
198 <uuid>{90e7e012-32e4-4423-8dc1-6143f35e2918}</uuid>
199 <visible>true</visible>
200 <midichan>0</midichan>
201 <midicc>0</midicc>
202 <selected>false</selected>
203 <label/>
204 <pressedValue>1</pressedValue>
205 <randomizable group="0">false</randomizable>
206 </bsbObject>
207 <bsbObject version="2" type="BSBLabel">
208 <objectName/>
209 <x>244</x>
210 <y>112</y>
211 <width>80</width>
212 <height>25</height>
213 <uuid>{5ba23af8-e23c-4c23-b63d-b2fd73f97ad3}</uuid>
214 <visible>true</visible>
215 <midichan>0</midichan>
216 <midicc>0</midicc>
217 <label>backwards</label>
218 <alignment>left</alignment>
219 <font>Arial</font>
220 <fontsize>14</fontsize>
221 <precision>3</precision>
222 <color>
223 <r>0</r>
224 <g>0</g>
225 <b>0</b>
226 </color>
227 <bgcolor mode="nobackground">
228 <r>255</r>
229 <g>255</g>
230 <b>255</b>
231 </bgcolor>
232 <bordermode>noborder</bordermode>
233 <borderradius>1</borderradius>
234 <borderwidth>1</borderwidth>
235 </bsbObject>
236 <bsbObject version="2" type="BSBHSlider">
237 <objectName>speed</objectName>
238 <x>94</x>
239 <y>189</y>
240 <width>269</width>
241 <height>28</height>
242 <uuid>{9629f5cd-f9f3-427d-80ed-a655e0b45b14}</uuid>
243 <visible>true</visible>
244 <midichan>0</midichan>
245 <midicc>0</midicc>
246 <minimum>0.00000000</minimum>
247 <maximum>4.00000000</maximum>
248 <value>1.00000000</value>
249 <mode>lin</mode>
250 <mouseControl act="jump">continuous</mouseControl>
251 <resolution>-1.00000000</resolution>
252 <randomizable group="0">false</randomizable>
253 </bsbObject>
254 <bsbObject version="2" type="BSBSpinBox">
255 <objectName>speed</objectName>
256 <x>362</x>
257 <y>190</y>
258 <width>80</width>
259 <height>25</height>
260 <uuid>{b9cbc924-e76e-45b8-9f9b-da47c3a0e902}</uuid>
261 <visible>true</visible>
262 <midichan>0</midichan>
263 <midicc>0</midicc>
264 <alignment>right</alignment>
265 <font>Arial</font>
266 <fontsize>14</fontsize>
267 <color>
268 <r>0</r>
269 <g>0</g>
270 <b>0</b>
271 </color>
272 <bgcolor mode="nobackground">
273 <r>255</r>
274 <g>255</g>
275 <b>255</b>
276 </bgcolor>
277 <resolution>0.00100000</resolution>
278 <minimum>0</minimum>
279 <maximum>1e+12</maximum>
280 <randomizable group="0">false</randomizable>
281 <value>1</value>
282 </bsbObject>
283 <bsbObject version="2" type="BSBHSlider">
284 <objectName>pitch</objectName>
285 <x>204</x>
286 <y>225</y>
287 <width>159</width>
288 <height>28</height>
289 <uuid>{cd230787-9b99-48bf-af84-b0b7dafb12d6}</uuid>
290 <visible>true</visible>
291 <midichan>0</midichan>
292 <midicc>0</midicc>
293 <minimum>-24.00000000</minimum>
294 <maximum>24.00000000</maximum>
295 <value>0.00000000</value>
296 <mode>lin</mode>
297 <mouseControl act="jump">continuous</mouseControl>
298 <resolution>-1.00000000</resolution>
299 <randomizable group="0">false</randomizable>
300 </bsbObject>
301 <bsbObject version="2" type="BSBSpinBox">
302 <objectName>pitch</objectName>
303 <x>362</x>
304 <y>225</y>
305 <width>80</width>
306 <height>25</height>
307 <uuid>{40522c26-35ea-4584-a9ab-493849b0e2d0}</uuid>
308 <visible>true</visible>
309 <midichan>0</midichan>
310 <midicc>0</midicc>
311 <alignment>right</alignment>
312 <font>Arial</font>
313 <fontsize>14</fontsize>
314 <color>
315 <r>0</r>
316 <g>0</g>
317 <b>0</b>
318 </color>
319 <bgcolor mode="nobackground">
320 <r>255</r>
321 <g>255</g>
322 <b>255</b>
323 </bgcolor>
324 <resolution>0.00100000</resolution>
325 <minimum>-1e+12</minimum>
326 <maximum>1e+12</maximum>
327 <randomizable group="0">false</randomizable>
328 <value>0</value>
329 </bsbObject>
330 <bsbObject version="2" type="BSBHSlider">
331 <objectName>db</objectName>
332 <x>103</x>
333 <y>263</y>
334 <width>260</width>
335 <height>26</height>
336 <uuid>{06d78383-e5a1-4edd-8ce7-a3e0f030e99d}</uuid>
337 <visible>true</visible>
338 <midichan>0</midichan>
339 <midicc>0</midicc>
340 <minimum>-24.00000000</minimum>
341 <maximum>12.00000000</maximum>
342 <value>-3.92565056</value>
343 <mode>lin</mode>
344 <mouseControl act="jump">continuous</mouseControl>
345 <resolution>-1.00000000</resolution>
346 <randomizable group="0">false</randomizable>
347 </bsbObject>
348 <bsbObject version="2" type="BSBSpinBox">
349 <objectName>db</objectName>
350 <x>362</x>
351 <y>262</y>
352 <width>80</width>
353 <height>25</height>
354 <uuid>{846d6d51-4a7f-4baa-89e6-e8b3ab82988d}</uuid>
355 <visible>true</visible>
356 <midichan>0</midichan>
357 <midicc>0</midicc>
358 <alignment>right</alignment>
359 <font>Arial</font>
360 <fontsize>14</fontsize>
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 <resolution>0.00100000</resolution>
372 <minimum>-1e+12</minimum>
373 <maximum>1e+12</maximum>
374 <randomizable group="0">false</randomizable>
375 <value>-3.92565</value>
376 </bsbObject>
377 <bsbObject version="2" type="BSBCheckBox">
378 <objectName>lock</objectName>
379 <x>388</x>
380 <y>149</y>
381 <width>20</width>
382 <height>20</height>
383 <uuid>{7a28f302-916e-4246-a512-a38404dc7ea2}</uuid>
384 <visible>true</visible>
385 <midichan>0</midichan>
386 <midicc>0</midicc>
387 <selected>false</selected>
388 <label/>
389 <pressedValue>1</pressedValue>
390 <randomizable group="0">false</randomizable>
391 </bsbObject>
392 <bsbObject version="2" type="BSBLabel">
393 <objectName/>
394 <x>363</x>
395 <y>112</y>
396 <width>80</width>
397 <height>25</height>
398 <uuid>{505cc402-7701-4e89-8f6e-f56bb80d73f0}</uuid>
399 <visible>true</visible>
400 <midichan>0</midichan>
401 <midicc>0</midicc>
402 <label>phase lock</label>
403 <alignment>left</alignment>
404 <font>Arial</font>
405 <fontsize>14</fontsize>
406 <precision>3</precision>
407 <color>
408 <r>0</r>
409 <g>0</g>
410 <b>0</b>
411 </color>
412 <bgcolor mode="nobackground">
413 <r>255</r>
414 <g>255</g>
415 <b>255</b>
416 </bgcolor>
417 <bordermode>noborder</bordermode>
418 <borderradius>1</borderradius>
419 <borderwidth>1</borderwidth>
420 </bsbObject>
421 <bsbObject version="2" type="BSBLabel">
422 <objectName/>
423 <x>47</x>
424 <y>15</y>
425 <width>399</width>
426 <height>36</height>
427 <uuid>{6a409679-366b-43ea-8021-31cd74a0b944}</uuid>
428 <visible>true</visible>
429 <midichan>0</midichan>
430 <midicc>0</midicc>
431 <label>LOOPING WITH MINCER</label>
432 <alignment>center</alignment>
433 <font>Arial</font>
434 <fontsize>24</fontsize>
435 <precision>3</precision>
436 <color>
437 <r>0</r>
438 <g>0</g>
439 <b>0</b>
440 </color>
441 <bgcolor mode="nobackground">
442 <r>255</r>
443 <g>255</g>
444 <b>255</b>
445 </bgcolor>
446 <bordermode>noborder</bordermode>
447 <borderradius>1</borderradius>
448 <borderwidth>1</borderwidth>
449 </bsbObject>
450 <bsbObject version="2" type="BSBButton">
451 <objectName>_Browse</objectName>
452 <x>48</x>
453 <y>62</y>
454 <width>396</width>
455 <height>32</height>
456 <uuid>{50508683-2963-48bd-a067-ea2d824403f2}</uuid>
457 <visible>true</visible>
458 <midichan>0</midichan>
459 <midicc>0</midicc>
460 <type>value</type>
461 <pressedValue>1.00000000</pressedValue>
462 <stringvalue>/home/linux/Joachim/Csound/Hui/fox.wav</stringvalue>
463 <text>Browse Soundfile First!</text>
464 <image>/</image>
465 <eventLine>i1 0 10</eventLine>
466 <latch>false</latch>
467 <latched>false</latched>
468 </bsbObject>
469 <bsbObject version="2" type="BSBLabel">
470 <objectName/>
471 <x>46</x>
472 <y>189</y>
473 <width>50</width>
474 <height>27</height>
475 <uuid>{423a136a-eb64-4cb7-88ba-44a85c811ec2}</uuid>
476 <visible>true</visible>
477 <midichan>0</midichan>
478 <midicc>0</midicc>
479 <label>speed</label>
480 <alignment>left</alignment>
481 <font>Arial</font>
482 <fontsize>14</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>46</x>
501 <y>225</y>
502 <width>160</width>
503 <height>29</height>
504 <uuid>{400f5c3f-9f72-452e-87b5-69da3b0f0534}</uuid>
505 <visible>true</visible>
506 <midichan>0</midichan>
507 <midicc>0</midicc>
508 <label>transposition (semitones)</label>
509 <alignment>left</alignment>
510 <font>Arial</font>
511 <fontsize>14</fontsize>
512 <precision>3</precision>
513 <color>
514 <r>0</r>
515 <g>0</g>
516 <b>0</b>
517 </color>
518 <bgcolor mode="nobackground">
519 <r>255</r>
520 <g>255</g>
521 <b>255</b>
522 </bgcolor>
523 <bordermode>noborder</bordermode>
524 <borderradius>1</borderradius>
525 <borderwidth>1</borderwidth>
526 </bsbObject>
527 <bsbObject version="2" type="BSBLabel">
528 <objectName/>
529 <x>46</x>
530 <y>263</y>
531 <width>57</width>
532 <height>29</height>
533 <uuid>{38c02e0e-3f48-4494-8245-a0464ea9f2d0}</uuid>
534 <visible>true</visible>
535 <midichan>0</midichan>
536 <midicc>0</midicc>
537 <label>volume</label>
538 <alignment>left</alignment>
539 <font>Arial</font>
540 <fontsize>14</fontsize>
541 <precision>3</precision>
542 <color>
543 <r>0</r>
544 <g>0</g>
545 <b>0</b>
546 </color>
547 <bgcolor mode="nobackground">
548 <r>255</r>
549 <g>255</g>
550 <b>255</b>
551 </bgcolor>
552 <bordermode>noborder</bordermode>
553 <borderradius>1</borderradius>
554 <borderwidth>1</borderwidth>
555 </bsbObject>
556 </bsbPanel>
557 <bsbPresets>
558 </bsbPresets>