| 1 |
;Written by Iain McCurdy, 2008 |
| 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 |
;(Different value of ksmps cause sliders instabilities) |
| 6 |
|
| 7 |
|
| 8 |
;Notes on modifications from original csd: |
| 9 |
; Replaced sound file by vco |
| 10 |
; Changed kr by kr/441 to stabilise the sliders |
| 11 |
|
| 12 |
|
| 13 |
;my flags on Ubuntu: -odac -b1024 -B2048 -+rtaudio=alsa -+rtmidi=null -m0 |
| 14 |
<CsoundSynthesizer> |
| 15 |
<CsOptions> |
| 16 |
|
| 17 |
</CsOptions> |
| 18 |
<CsInstruments> |
| 19 |
sr = 44100 ;SAMPLE RATE |
| 20 |
ksmps = 10 ;NUMBER OF AUDIO SAMPLES IN EACH CONTROL CYCLE |
| 21 |
nchnls = 2 ;NUMBER OF CHANNELS (2=STEREO) |
| 22 |
|
| 23 |
|
| 24 |
instr 1 |
| 25 |
kdbs invalue "Decibels" |
| 26 |
kamps invalue "Amplitude" |
| 27 |
|
| 28 |
kamp = ampdb(kdbs) |
| 29 |
ktrigger changed kamp |
| 30 |
if ktrigger==1 then |
| 31 |
outvalue "Amplitude", kamp |
| 32 |
endif |
| 33 |
|
| 34 |
kdb = dbamp(kamps) |
| 35 |
ktrigger2 metro kr/441 |
| 36 |
if ktrigger2==1 then |
| 37 |
outvalue "Decibels", kdb |
| 38 |
endif |
| 39 |
|
| 40 |
asig vco2 kamps, 220 |
| 41 |
outs asig, asig |
| 42 |
endin |
| 43 |
</CsInstruments> |
| 44 |
<CsScore> |
| 45 |
i 1 0 3600 |
| 46 |
</CsScore> |
| 47 |
</CsoundSynthesizer> |
| 48 |
<bsbPanel> |
| 49 |
<label>Widgets</label> |
| 50 |
<objectName/> |
| 51 |
<x>1162</x> |
| 52 |
<y>146</y> |
| 53 |
<width>517</width> |
| 54 |
<height>304</height> |
| 55 |
<visible>true</visible> |
| 56 |
<uuid/> |
| 57 |
<bgcolor mode="background"> |
| 58 |
<r>241</r> |
| 59 |
<g>226</g> |
| 60 |
<b>185</b> |
| 61 |
</bgcolor> |
| 62 |
<bsbObject version="2" type="BSBLabel"> |
| 63 |
<objectName/> |
| 64 |
<x>2</x> |
| 65 |
<y>2</y> |
| 66 |
<width>512</width> |
| 67 |
<height>300</height> |
| 68 |
<uuid>{aa607456-d368-4d59-8497-d16d608404c3}</uuid> |
| 69 |
<visible>true</visible> |
| 70 |
<midichan>0</midichan> |
| 71 |
<midicc>0</midicc> |
| 72 |
<label>Convert decibels to amplitude</label> |
| 73 |
<alignment>center</alignment> |
| 74 |
<font>Liberation Sans</font> |
| 75 |
<fontsize>18</fontsize> |
| 76 |
<precision>3</precision> |
| 77 |
<color> |
| 78 |
<r>255</r> |
| 79 |
<g>255</g> |
| 80 |
<b>255</b> |
| 81 |
</color> |
| 82 |
<bgcolor mode="background"> |
| 83 |
<r>5</r> |
| 84 |
<g>27</g> |
| 85 |
<b>150</b> |
| 86 |
</bgcolor> |
| 87 |
<bordermode>border</bordermode> |
| 88 |
<borderradius>5</borderradius> |
| 89 |
<borderwidth>2</borderwidth> |
| 90 |
</bsbObject> |
| 91 |
<bsbObject version="2" type="BSBLabel"> |
| 92 |
<objectName/> |
| 93 |
<x>8</x> |
| 94 |
<y>23</y> |
| 95 |
<width>499</width> |
| 96 |
<height>161</height> |
| 97 |
<uuid>{e41f02b8-6ad4-46dc-805c-0b2eeafbd476}</uuid> |
| 98 |
<visible>true</visible> |
| 99 |
<midichan>0</midichan> |
| 100 |
<midicc>0</midicc> |
| 101 |
<label>-------------------------------------------------------------------------------------------------------------------------- |
| 102 |
This example converts decibel values into amplitude values that Csound uses to play a sound. The opcode used is 'ampdb'. If the user moves the 'decibels' slider the 'amplitude' slider moves to show its corresponding value. How the two scales for sound intensity differ is evident visually through how the sliders move and aurally through how they vary the intensity of the played back soundfile. (The sound intensity can also be varied using the 'amplitude' slider.) Decibels are converted back to amplitude using the 'dbamp' opcode.</label> |
| 103 |
<alignment>left</alignment> |
| 104 |
<font>Liberation Sans</font> |
| 105 |
<fontsize>14</fontsize> |
| 106 |
<precision>3</precision> |
| 107 |
<color> |
| 108 |
<r>255</r> |
| 109 |
<g>255</g> |
| 110 |
<b>255</b> |
| 111 |
</color> |
| 112 |
<bgcolor mode="nobackground"> |
| 113 |
<r>255</r> |
| 114 |
<g>255</g> |
| 115 |
<b>255</b> |
| 116 |
</bgcolor> |
| 117 |
<bordermode>noborder</bordermode> |
| 118 |
<borderradius>1</borderradius> |
| 119 |
<borderwidth>1</borderwidth> |
| 120 |
</bsbObject> |
| 121 |
<bsbObject version="2" type="BSBLabel"> |
| 122 |
<objectName/> |
| 123 |
<x>8</x> |
| 124 |
<y>270</y> |
| 125 |
<width>200</width> |
| 126 |
<height>30</height> |
| 127 |
<uuid>{3ebc1139-1fdb-48dc-9150-49ee8dfdbd4a}</uuid> |
| 128 |
<visible>true</visible> |
| 129 |
<midichan>0</midichan> |
| 130 |
<midicc>0</midicc> |
| 131 |
<label>Amplitude</label> |
| 132 |
<alignment>left</alignment> |
| 133 |
<font>Liberation Sans</font> |
| 134 |
<fontsize>10</fontsize> |
| 135 |
<precision>3</precision> |
| 136 |
<color> |
| 137 |
<r>255</r> |
| 138 |
<g>255</g> |
| 139 |
<b>255</b> |
| 140 |
</color> |
| 141 |
<bgcolor mode="nobackground"> |
| 142 |
<r>255</r> |
| 143 |
<g>255</g> |
| 144 |
<b>255</b> |
| 145 |
</bgcolor> |
| 146 |
<bordermode>noborder</bordermode> |
| 147 |
<borderradius>1</borderradius> |
| 148 |
<borderwidth>1</borderwidth> |
| 149 |
</bsbObject> |
| 150 |
<bsbObject version="2" type="BSBHSlider"> |
| 151 |
<objectName>Amplitude</objectName> |
| 152 |
<x>8</x> |
| 153 |
<y>247</y> |
| 154 |
<width>500</width> |
| 155 |
<height>27</height> |
| 156 |
<uuid>{2cf97843-5b49-438e-8034-62a459597e86}</uuid> |
| 157 |
<visible>true</visible> |
| 158 |
<midichan>0</midichan> |
| 159 |
<midicc>0</midicc> |
| 160 |
<minimum>1.00000000</minimum> |
| 161 |
<maximum>32768.00000000</maximum> |
| 162 |
<value>1.00000000</value> |
| 163 |
<mode>lin</mode> |
| 164 |
<mouseControl act="jump">continuous</mouseControl> |
| 165 |
<resolution>-1.00000000</resolution> |
| 166 |
<randomizable group="0">false</randomizable> |
| 167 |
</bsbObject> |
| 168 |
<bsbObject version="2" type="BSBDisplay"> |
| 169 |
<objectName>Amplitude</objectName> |
| 170 |
<x>448</x> |
| 171 |
<y>270</y> |
| 172 |
<width>60</width> |
| 173 |
<height>30</height> |
| 174 |
<uuid>{e54486c5-f9aa-4d0e-9a67-6506dae3c790}</uuid> |
| 175 |
<visible>true</visible> |
| 176 |
<midichan>0</midichan> |
| 177 |
<midicc>0</midicc> |
| 178 |
<label>1.000</label> |
| 179 |
<alignment>right</alignment> |
| 180 |
<font>Liberation Sans</font> |
| 181 |
<fontsize>9</fontsize> |
| 182 |
<precision>3</precision> |
| 183 |
<color> |
| 184 |
<r>255</r> |
| 185 |
<g>255</g> |
| 186 |
<b>255</b> |
| 187 |
</color> |
| 188 |
<bgcolor mode="nobackground"> |
| 189 |
<r>255</r> |
| 190 |
<g>255</g> |
| 191 |
<b>255</b> |
| 192 |
</bgcolor> |
| 193 |
<bordermode>noborder</bordermode> |
| 194 |
<borderradius>1</borderradius> |
| 195 |
<borderwidth>1</borderwidth> |
| 196 |
</bsbObject> |
| 197 |
<bsbObject version="2" type="BSBLabel"> |
| 198 |
<objectName/> |
| 199 |
<x>8</x> |
| 200 |
<y>217</y> |
| 201 |
<width>200</width> |
| 202 |
<height>30</height> |
| 203 |
<uuid>{78a7e9cd-fb57-421c-8e1f-40b60a90dfc0}</uuid> |
| 204 |
<visible>true</visible> |
| 205 |
<midichan>0</midichan> |
| 206 |
<midicc>0</midicc> |
| 207 |
<label>Decibels</label> |
| 208 |
<alignment>left</alignment> |
| 209 |
<font>Liberation Sans</font> |
| 210 |
<fontsize>10</fontsize> |
| 211 |
<precision>3</precision> |
| 212 |
<color> |
| 213 |
<r>255</r> |
| 214 |
<g>255</g> |
| 215 |
<b>255</b> |
| 216 |
</color> |
| 217 |
<bgcolor mode="nobackground"> |
| 218 |
<r>255</r> |
| 219 |
<g>255</g> |
| 220 |
<b>255</b> |
| 221 |
</bgcolor> |
| 222 |
<bordermode>noborder</bordermode> |
| 223 |
<borderradius>1</borderradius> |
| 224 |
<borderwidth>1</borderwidth> |
| 225 |
</bsbObject> |
| 226 |
<bsbObject version="2" type="BSBHSlider"> |
| 227 |
<objectName>Decibels</objectName> |
| 228 |
<x>8</x> |
| 229 |
<y>194</y> |
| 230 |
<width>500</width> |
| 231 |
<height>27</height> |
| 232 |
<uuid>{4b5d3fba-55d0-43d1-a94a-457bc9144a31}</uuid> |
| 233 |
<visible>true</visible> |
| 234 |
<midichan>0</midichan> |
| 235 |
<midicc>0</midicc> |
| 236 |
<minimum>0.00000000</minimum> |
| 237 |
<maximum>90.47300000</maximum> |
| 238 |
<value>0.00000000</value> |
| 239 |
<mode>lin</mode> |
| 240 |
<mouseControl act="jump">continuous</mouseControl> |
| 241 |
<resolution>-1.00000000</resolution> |
| 242 |
<randomizable group="0">false</randomizable> |
| 243 |
</bsbObject> |
| 244 |
<bsbObject version="2" type="BSBDisplay"> |
| 245 |
<objectName>Decibels</objectName> |
| 246 |
<x>448</x> |
| 247 |
<y>217</y> |
| 248 |
<width>60</width> |
| 249 |
<height>30</height> |
| 250 |
<uuid>{58265963-6245-459e-8071-9ed8bba850a4}</uuid> |
| 251 |
<visible>true</visible> |
| 252 |
<midichan>0</midichan> |
| 253 |
<midicc>0</midicc> |
| 254 |
<label>0.000</label> |
| 255 |
<alignment>right</alignment> |
| 256 |
<font>Liberation Sans</font> |
| 257 |
<fontsize>9</fontsize> |
| 258 |
<precision>3</precision> |
| 259 |
<color> |
| 260 |
<r>255</r> |
| 261 |
<g>255</g> |
| 262 |
<b>255</b> |
| 263 |
</color> |
| 264 |
<bgcolor mode="nobackground"> |
| 265 |
<r>255</r> |
| 266 |
<g>255</g> |
| 267 |
<b>255</b> |
| 268 |
</bgcolor> |
| 269 |
<bordermode>noborder</bordermode> |
| 270 |
<borderradius>1</borderradius> |
| 271 |
<borderwidth>1</borderwidth> |
| 272 |
</bsbObject> |
| 273 |
</bsbPanel> |
| 274 |
<bsbPresets> |
| 275 |
</bsbPresets> |
| 276 |
<EventPanel name="" tempo="60.00000000" loop="8.00000000" x="913" y="162" width="655" height="346" visible="true" loopStart="0" loopEnd="0"> </EventPanel> |