| 1 |
;Writen by Iain McCurdy, 2006 |
| 2 |
|
| 3 |
; Modified for QuteCsound by René, February 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 Browser for audio file and use of FilePlay2 udo, now accept mono or stereo wav files |
| 8 |
|
| 9 |
|
| 10 |
;my flags on Ubuntu: -dm0 -odac -+rtaudio=alsa -b1024 -B2048 -+rtmidi=alsa -Ma |
| 11 |
<CsoundSynthesizer> |
| 12 |
<CsOptions> |
| 13 |
--env:SSDIR+=../../SourceMaterials |
| 14 |
</CsOptions> |
| 15 |
<CsInstruments> |
| 16 |
sr = 44100 ;SAMPLE RATE |
| 17 |
ksmps = 16 ;NUMBER OF AUDIO SAMPLES IN EACH CONTROL CYCLE |
| 18 |
nchnls = 2 ;NUMBER OF CHANNELS (2=STEREO) |
| 19 |
|
| 20 |
|
| 21 |
opcode FilePlay2, aa, Skoo ; Credit to Joachim Heintz |
| 22 |
;gives stereo output regardless your soundfile is mono or stereo |
| 23 |
Sfil, kspeed, iskip, iloop xin |
| 24 |
ichn filenchnls Sfil |
| 25 |
if ichn == 1 then |
| 26 |
aL diskin2 Sfil, kspeed, iskip, iloop |
| 27 |
aR = aL |
| 28 |
else |
| 29 |
aL, aR diskin2 Sfil, kspeed, iskip, iloop |
| 30 |
endif |
| 31 |
xout aL, aR |
| 32 |
endop |
| 33 |
|
| 34 |
|
| 35 |
instr 1 |
| 36 |
|
| 37 |
Sfile invalue "_Browse" |
| 38 |
|
| 39 |
iporttime = .01 |
| 40 |
kporttime linseg 0, .001, iporttime, 1, iporttime |
| 41 |
|
| 42 |
kbend pchbend 0, 1 |
| 43 |
kratio = cpsoct(8+kbend)/cpsoct(8) |
| 44 |
kratio portk kratio, kporttime |
| 45 |
|
| 46 |
asigL, asigR FilePlay2 Sfile, kratio, 0, 1 |
| 47 |
outs asigL, asigR |
| 48 |
endin |
| 49 |
|
| 50 |
</CsInstruments> |
| 51 |
<CsScore> |
| 52 |
f 0 86400 ;ALLOWS REALTIME MIDI PLAYING FOR 1 DAY |
| 53 |
</CsScore> |
| 54 |
</CsoundSynthesizer> |
| 55 |
|
| 56 |
<bsbPanel> |
| 57 |
<label>Widgets</label> |
| 58 |
<objectName/> |
| 59 |
<x>845</x> |
| 60 |
<y>326</y> |
| 61 |
<width>520</width> |
| 62 |
<height>240</height> |
| 63 |
<visible>true</visible> |
| 64 |
<uuid/> |
| 65 |
<bgcolor mode="background"> |
| 66 |
<r>170</r> |
| 67 |
<g>170</g> |
| 68 |
<b>170</b> |
| 69 |
</bgcolor> |
| 70 |
<bsbObject version="2" type="BSBLabel"> |
| 71 |
<objectName/> |
| 72 |
<x>2</x> |
| 73 |
<y>2</y> |
| 74 |
<width>512</width> |
| 75 |
<height>233</height> |
| 76 |
<uuid>{aa607456-d368-4d59-8497-d16d608404c3}</uuid> |
| 77 |
<visible>true</visible> |
| 78 |
<midichan>0</midichan> |
| 79 |
<midicc>0</midicc> |
| 80 |
<label>pchbend - Diskin Playback Speed 2</label> |
| 81 |
<alignment>center</alignment> |
| 82 |
<font>Liberation Sans</font> |
| 83 |
<fontsize>18</fontsize> |
| 84 |
<precision>3</precision> |
| 85 |
<color> |
| 86 |
<r>0</r> |
| 87 |
<g>0</g> |
| 88 |
<b>0</b> |
| 89 |
</color> |
| 90 |
<bgcolor mode="background"> |
| 91 |
<r>244</r> |
| 92 |
<g>248</g> |
| 93 |
<b>200</b> |
| 94 |
</bgcolor> |
| 95 |
<bordermode>border</bordermode> |
| 96 |
<borderradius>5</borderradius> |
| 97 |
<borderwidth>2</borderwidth> |
| 98 |
</bsbObject> |
| 99 |
<bsbObject version="2" type="BSBLabel"> |
| 100 |
<objectName/> |
| 101 |
<x>8</x> |
| 102 |
<y>17</y> |
| 103 |
<width>500</width> |
| 104 |
<height>160</height> |
| 105 |
<uuid>{d4bdb5ce-87d8-4c8c-9c64-40ec2eed6f5a}</uuid> |
| 106 |
<visible>true</visible> |
| 107 |
<midichan>0</midichan> |
| 108 |
<midicc>0</midicc> |
| 109 |
<label>-------------------------------------------------------------------------------------------------------------------------- |
| 110 |
This example is similar to the previous one except that how the pchbend output is mapped to diskin playback speed is different. At the pitch bend wheel's equilibrium position playback speed is normal, at its maximum position playback speed doubled and at its minimum position playback speed is halved. |
| 111 |
A midi note needs to be played to activate the midi instrument. |
| 112 |
At each note the audio file is loaded (init).</label> |
| 113 |
<alignment>left</alignment> |
| 114 |
<font>Liberation Sans</font> |
| 115 |
<fontsize>14</fontsize> |
| 116 |
<precision>3</precision> |
| 117 |
<color> |
| 118 |
<r>0</r> |
| 119 |
<g>0</g> |
| 120 |
<b>0</b> |
| 121 |
</color> |
| 122 |
<bgcolor mode="nobackground"> |
| 123 |
<r>255</r> |
| 124 |
<g>255</g> |
| 125 |
<b>255</b> |
| 126 |
</bgcolor> |
| 127 |
<bordermode>noborder</bordermode> |
| 128 |
<borderradius>1</borderradius> |
| 129 |
<borderwidth>1</borderwidth> |
| 130 |
</bsbObject> |
| 131 |
<bsbObject version="2" type="BSBButton"> |
| 132 |
<objectName>_Browse</objectName> |
| 133 |
<x>8</x> |
| 134 |
<y>195</y> |
| 135 |
<width>170</width> |
| 136 |
<height>30</height> |
| 137 |
<uuid>{b9431a61-61f7-432b-bf6f-c47ddc7f9050}</uuid> |
| 138 |
<visible>true</visible> |
| 139 |
<midichan>0</midichan> |
| 140 |
<midicc>0</midicc> |
| 141 |
<type>value</type> |
| 142 |
<pressedValue>1.00000000</pressedValue> |
| 143 |
<stringvalue>AndItsAll.wav</stringvalue> |
| 144 |
<text>Browse Audio File</text> |
| 145 |
<image>/</image> |
| 146 |
<eventLine/> |
| 147 |
<latch>false</latch> |
| 148 |
<latched>false</latched> |
| 149 |
</bsbObject> |
| 150 |
<bsbObject version="2" type="BSBLineEdit"> |
| 151 |
<objectName>_Browse</objectName> |
| 152 |
<x>179</x> |
| 153 |
<y>196</y> |
| 154 |
<width>325</width> |
| 155 |
<height>28</height> |
| 156 |
<uuid>{68b5f90b-b78e-4581-b434-232db5f4c40f}</uuid> |
| 157 |
<visible>true</visible> |
| 158 |
<midichan>0</midichan> |
| 159 |
<midicc>0</midicc> |
| 160 |
<label>AndItsAll.wav</label> |
| 161 |
<alignment>left</alignment> |
| 162 |
<font>Liberation Sans</font> |
| 163 |
<fontsize>10</fontsize> |
| 164 |
<precision>3</precision> |
| 165 |
<color> |
| 166 |
<r>0</r> |
| 167 |
<g>0</g> |
| 168 |
<b>0</b> |
| 169 |
</color> |
| 170 |
<bgcolor mode="nobackground"> |
| 171 |
<r>229</r> |
| 172 |
<g>229</g> |
| 173 |
<b>229</b> |
| 174 |
</bgcolor> |
| 175 |
<background>nobackground</background> |
| 176 |
</bsbObject> |
| 177 |
<bsbObject version="2" type="BSBLabel"> |
| 178 |
<objectName/> |
| 179 |
<x>8</x> |
| 180 |
<y>174</y> |
| 181 |
<width>150</width> |
| 182 |
<height>30</height> |
| 183 |
<uuid>{936f6eb0-5225-4bd7-a5fe-a49df1c9c5ac}</uuid> |
| 184 |
<visible>true</visible> |
| 185 |
<midichan>0</midichan> |
| 186 |
<midicc>0</midicc> |
| 187 |
<label>Audio File</label> |
| 188 |
<alignment>left</alignment> |
| 189 |
<font>Liberation Sans</font> |
| 190 |
<fontsize>10</fontsize> |
| 191 |
<precision>3</precision> |
| 192 |
<color> |
| 193 |
<r>0</r> |
| 194 |
<g>0</g> |
| 195 |
<b>0</b> |
| 196 |
</color> |
| 197 |
<bgcolor mode="nobackground"> |
| 198 |
<r>255</r> |
| 199 |
<g>255</g> |
| 200 |
<b>255</b> |
| 201 |
</bgcolor> |
| 202 |
<bordermode>noborder</bordermode> |
| 203 |
<borderradius>1</borderradius> |
| 204 |
<borderwidth>1</borderwidth> |
| 205 |
</bsbObject> |
| 206 |
</bsbPanel> |
| 207 |
<bsbPresets> |
| 208 |
</bsbPresets> |
| 209 |
<EventPanel name="" tempo="60.00000000" loop="8.00000000" x="913" y="162" width="655" height="346" visible="false" loopStart="0" loopEnd="0"> </EventPanel> |