;example for csoundqt ;joachim heintz nov 2011 sr = 44100 ksmps = 32 nchnls = 1 0dbfs = 1 opcode LpPhsr, a, kkkki ;see description at http://www.csounds.com/udo/displayOpcode.php?opcode_id=158 kloopstart, kloopend, kspeed, kdir, irefdur xin kstart01 = kloopstart/irefdur ;start in 0-1 range kend01 = kloopend/irefdur ;end in 0-1 range ifqbas = 1 / irefdur ;phasor frequency for the whole irefdur range kfqrel = ifqbas / (kend01-kstart01) * kspeed ;phasor frequency for the selected section andxrel phasor kfqrel*kdir ;phasor 0-1 atimpt = andxrel * (kloopend-kloopstart) + kloopstart ;adjusted to start and end xout atimpt endop instr 1 ;receive the widget values kloopstart invalue "loopstart" kloopend invalue "loopend" kback invalue "back" ;1 = backwards kspeed invalue "speed" ; 1 = normal kpitch invalue "pitch" ; in semitones kdb invalue "db" ;volume in db klock invalue "lock" ;phase locking on/off Snd invalue "_Browse" ;soundfile ;set general values iftsnd ftgen 0, 0, 0, 1, Snd, 0, 0, 1 isndlen filelen Snd kdir = (kback == 1 ? -1 : 1) ;set kloopend to isndlen if 0 or larger than isndlen kloopend = (kloopend == 0 || kloopend > isndlen ? isndlen : kloopend) atimpt LpPhsr kloopstart, kloopend, kspeed, kdir, isndlen ;calculate audio and output result asnd mincer atimpt, ampdb(kdb), semitone(kpitch), iftsnd, klock out asnd endin i 1 0 3600 72 179 400 200 true 220 214 207 loopstart 49 149 80 25 {3c04d57e-8f9a-4cb2-b045-3d9c288b1199} true 0 0 right Arial 14 0 0 0 255 255 255 0.00100000 0 1e+12 false 0.5 loopend 147 149 80 25 {196f2bff-845d-4d87-b301-3f53f8c272ca} true 0 0 right Arial 14 0 0 0 255 255 255 0.00100000 0 1e+12 false 1.5 48 112 80 25 {5adeed74-95fd-4ed2-936f-911efaabe12a} true 0 0 left Arial 14 3 0 0 0 255 255 255 noborder 1 1 146 112 80 25 {ad9c8d7d-9bbb-466a-86fb-38fbec6537bd} true 0 0 left Arial 14 3 0 0 0 255 255 255 noborder 1 1 back 274 149 20 20 {90e7e012-32e4-4423-8dc1-6143f35e2918} true 0 0 false 244 112 80 25 {5ba23af8-e23c-4c23-b63d-b2fd73f97ad3} true 0 0 left Arial 14 3 0 0 0 255 255 255 noborder 1 1 speed 94 189 269 28 {9629f5cd-f9f3-427d-80ed-a655e0b45b14} true 0 0 0.00000000 4.00000000 1.00000000 lin continuous -1.00000000 false speed 362 190 80 25 {b9cbc924-e76e-45b8-9f9b-da47c3a0e902} true 0 0 right Arial 14 0 0 0 255 255 255 0.00100000 0 1e+12 false 1 pitch 204 225 159 28 {cd230787-9b99-48bf-af84-b0b7dafb12d6} true 0 0 -24.00000000 24.00000000 0.00000000 lin continuous -1.00000000 false pitch 362 225 80 25 {40522c26-35ea-4584-a9ab-493849b0e2d0} true 0 0 right Arial 14 0 0 0 255 255 255 0.00100000 -1e+12 1e+12 false 0 db 103 263 260 26 {06d78383-e5a1-4edd-8ce7-a3e0f030e99d} true 0 0 -24.00000000 12.00000000 -3.92565056 lin continuous -1.00000000 false db 362 262 80 25 {846d6d51-4a7f-4baa-89e6-e8b3ab82988d} true 0 0 right Arial 14 0 0 0 255 255 255 0.00100000 -1e+12 1e+12 false -3.92565 lock 388 149 20 20 {7a28f302-916e-4246-a512-a38404dc7ea2} true 0 0 false 363 112 80 25 {505cc402-7701-4e89-8f6e-f56bb80d73f0} true 0 0 left Arial 14 3 0 0 0 255 255 255 noborder 1 1 47 15 399 36 {6a409679-366b-43ea-8021-31cd74a0b944} true 0 0 center Arial 24 3 0 0 0 255 255 255 noborder 1 1 _Browse 48 62 396 32 {50508683-2963-48bd-a067-ea2d824403f2} true 0 0 value 1.00000000 /home/linux/Joachim/Csound/Hui/fox.wav Browse Soundfile First! / i1 0 10 false false 46 189 50 27 {423a136a-eb64-4cb7-88ba-44a85c811ec2} true 0 0 left Arial 14 3 0 0 0 255 255 255 noborder 1 1 46 225 160 29 {400f5c3f-9f72-452e-87b5-69da3b0f0534} true 0 0 left Arial 14 3 0 0 0 255 255 255 noborder 1 1 46 263 57 29 {38c02e0e-3f48-4494-8245-a0464ea9f2d0} true 0 0 left Arial 14 3 0 0 0 255 255 255 noborder 1 1