| 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, 2 ;PITCH BEND VARIABLE (IN oct FORMAT) |
| 43 |
kbend portk kbend, kporttime |
| 44 |
|
| 45 |
asigL, asigR FilePlay2 Sfile, kbend, 0, 1 |
| 46 |
outs asigL, asigR |
| 47 |
endin |
| 48 |
|
| 49 |
</CsInstruments> |
| 50 |
<CsScore> |
| 51 |
f 0 86400 ;ALLOWS REALTIME MIDI PLAYING FOR 1 DAY |
| 52 |
</CsScore> |
| 53 |
</CsoundSynthesizer> |
| 54 |
|
| 55 |
<bsbPanel> |
| 56 |
<label>Widgets</label> |
| 57 |
<objectName/> |
| 58 |
<x>740</x> |
| 59 |
<y>414</y> |
| 60 |
<width>520</width> |
| 61 |
<height>240</height> |
| 62 |
<visible>true</visible> |
| 63 |
<uuid/> |
| 64 |
<bgcolor mode="background"> |
| 65 |
<r>170</r> |
| 66 |
<g>170</g> |
| 67 |
<b>170</b> |
| 68 |
</bgcolor> |
| 69 |
<bsbObject version="2" type="BSBLabel"> |
| 70 |
<objectName/> |
| 71 |
<x>2</x> |
| 72 |
<y>2</y> |
| 73 |
<width>512</width> |
| 74 |
<height>233</height> |
| 75 |
<uuid>{aa607456-d368-4d59-8497-d16d608404c3}</uuid> |
| 76 |
<visible>true</visible> |
| 77 |
<midichan>0</midichan> |
| 78 |
<midicc>0</midicc> |
| 79 |
<label>pchbend - Diskin Playback Speed 1</label> |
| 80 |
<alignment>center</alignment> |
| 81 |
<font>Liberation Sans</font> |
| 82 |
<fontsize>18</fontsize> |
| 83 |
<precision>3</precision> |
| 84 |
<color> |
| 85 |
<r>0</r> |
| 86 |
<g>0</g> |
| 87 |
<b>0</b> |
| 88 |
</color> |
| 89 |
<bgcolor mode="background"> |
| 90 |
<r>244</r> |
| 91 |
<g>248</g> |
| 92 |
<b>200</b> |
| 93 |
</bgcolor> |
| 94 |
<bordermode>border</bordermode> |
| 95 |
<borderradius>5</borderradius> |
| 96 |
<borderwidth>2</borderwidth> |
| 97 |
</bsbObject> |
| 98 |
<bsbObject version="2" type="BSBLabel"> |
| 99 |
<objectName/> |
| 100 |
<x>8</x> |
| 101 |
<y>17</y> |
| 102 |
<width>500</width> |
| 103 |
<height>160</height> |
| 104 |
<uuid>{d4bdb5ce-87d8-4c8c-9c64-40ec2eed6f5a}</uuid> |
| 105 |
<visible>true</visible> |
| 106 |
<midichan>0</midichan> |
| 107 |
<midicc>0</midicc> |
| 108 |
<label>-------------------------------------------------------------------------------------------------------------------------- |
| 109 |
In this example the pitch bend wheel is used to control the playback speed of a diskin file player. The range for playback speed is -2 to 2. Therefore at its maximum position the playback speed will be double normal speed and forwards (2) and at its minimum position the playback speed is double normal speed and backwards (-2). At the equilibrium position playback speed will be zero, therefore silence. A midi note needs to be played to activate the midi instrument. |
| 110 |
At each note the audio file is loaded (init).</label> |
| 111 |
<alignment>left</alignment> |
| 112 |
<font>Liberation Sans</font> |
| 113 |
<fontsize>14</fontsize> |
| 114 |
<precision>3</precision> |
| 115 |
<color> |
| 116 |
<r>0</r> |
| 117 |
<g>0</g> |
| 118 |
<b>0</b> |
| 119 |
</color> |
| 120 |
<bgcolor mode="nobackground"> |
| 121 |
<r>255</r> |
| 122 |
<g>255</g> |
| 123 |
<b>255</b> |
| 124 |
</bgcolor> |
| 125 |
<bordermode>noborder</bordermode> |
| 126 |
<borderradius>1</borderradius> |
| 127 |
<borderwidth>1</borderwidth> |
| 128 |
</bsbObject> |
| 129 |
<bsbObject version="2" type="BSBButton"> |
| 130 |
<objectName>_Browse</objectName> |
| 131 |
<x>8</x> |
| 132 |
<y>195</y> |
| 133 |
<width>170</width> |
| 134 |
<height>30</height> |
| 135 |
<uuid>{b9431a61-61f7-432b-bf6f-c47ddc7f9050}</uuid> |
| 136 |
<visible>true</visible> |
| 137 |
<midichan>0</midichan> |
| 138 |
<midicc>0</midicc> |
| 139 |
<type>value</type> |
| 140 |
<pressedValue>1.00000000</pressedValue> |
| 141 |
<stringvalue>AndItsAll.wav</stringvalue> |
| 142 |
<text>Browse Audio File</text> |
| 143 |
<image>/</image> |
| 144 |
<eventLine/> |
| 145 |
<latch>false</latch> |
| 146 |
<latched>false</latched> |
| 147 |
</bsbObject> |
| 148 |
<bsbObject version="2" type="BSBLineEdit"> |
| 149 |
<objectName>_Browse</objectName> |
| 150 |
<x>179</x> |
| 151 |
<y>196</y> |
| 152 |
<width>325</width> |
| 153 |
<height>28</height> |
| 154 |
<uuid>{68b5f90b-b78e-4581-b434-232db5f4c40f}</uuid> |
| 155 |
<visible>true</visible> |
| 156 |
<midichan>0</midichan> |
| 157 |
<midicc>0</midicc> |
| 158 |
<label>AndItsAll.wav</label> |
| 159 |
<alignment>left</alignment> |
| 160 |
<font>Liberation Sans</font> |
| 161 |
<fontsize>10</fontsize> |
| 162 |
<precision>3</precision> |
| 163 |
<color> |
| 164 |
<r>0</r> |
| 165 |
<g>0</g> |
| 166 |
<b>0</b> |
| 167 |
</color> |
| 168 |
<bgcolor mode="nobackground"> |
| 169 |
<r>229</r> |
| 170 |
<g>229</g> |
| 171 |
<b>229</b> |
| 172 |
</bgcolor> |
| 173 |
<background>nobackground</background> |
| 174 |
</bsbObject> |
| 175 |
<bsbObject version="2" type="BSBLabel"> |
| 176 |
<objectName/> |
| 177 |
<x>8</x> |
| 178 |
<y>174</y> |
| 179 |
<width>150</width> |
| 180 |
<height>30</height> |
| 181 |
<uuid>{936f6eb0-5225-4bd7-a5fe-a49df1c9c5ac}</uuid> |
| 182 |
<visible>true</visible> |
| 183 |
<midichan>0</midichan> |
| 184 |
<midicc>0</midicc> |
| 185 |
<label>Audio File</label> |
| 186 |
<alignment>left</alignment> |
| 187 |
<font>Liberation Sans</font> |
| 188 |
<fontsize>10</fontsize> |
| 189 |
<precision>3</precision> |
| 190 |
<color> |
| 191 |
<r>0</r> |
| 192 |
<g>0</g> |
| 193 |
<b>0</b> |
| 194 |
</color> |
| 195 |
<bgcolor mode="nobackground"> |
| 196 |
<r>255</r> |
| 197 |
<g>255</g> |
| 198 |
<b>255</b> |
| 199 |
</bgcolor> |
| 200 |
<bordermode>noborder</bordermode> |
| 201 |
<borderradius>1</borderradius> |
| 202 |
<borderwidth>1</borderwidth> |
| 203 |
</bsbObject> |
| 204 |
</bsbPanel> |
| 205 |
<bsbPresets> |
| 206 |
</bsbPresets> |
| 207 |
<EventPanel name="" tempo="60.00000000" loop="8.00000000" x="913" y="162" width="655" height="346" visible="false" loopStart="0" loopEnd="0"> </EventPanel> |