| 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 koct display |
| 8 |
|
| 9 |
|
| 10 |
;my flags on Ubuntu: -dm0 -odac -+rtaudio=alsa -b1024 -B2048 -+rtmidi=alsa -Ma |
| 11 |
<CsoundSynthesizer> |
| 12 |
<CsOptions> |
| 13 |
|
| 14 |
</CsOptions> |
| 15 |
<CsInstruments> |
| 16 |
sr = 44100 ;SAMPLE RATE |
| 17 |
ksmps = 2 ;NUMBER OF AUDIO SAMPLES IN EACH CONTROL CYCLE |
| 18 |
nchnls = 2 ;NUMBER OF CHANNELS (2=STEREO) |
| 19 |
0dbfs = 1 ;MAXIMUM AMPLITUDE REGARDLESS OF BIT DEPTH |
| 20 |
|
| 21 |
|
| 22 |
instr 1 ;BEEP INSTRUMENT - ACTIVATED BY A SCORE NOTE - FREQUENCY VARIABLE USING CONTROLLER 1 |
| 23 |
|
| 24 |
;OUTPUT OPCODE CHANNEL | CTRLNUMBER | MINIMUM | MAXIMUM | F.N._USED_TO_RESCALE_SLIDER_VALUES |
| 25 |
koct ctrl7 1, 1, 0, 1, 2 ;READ CONTROLLER INFORMATION FROM CONTINUOUS CONTROLLER NUMBER 1 ON MIDI CHANNEL 1, RESCALE TO BE WITHIN THE RANGE 0 - 1 THEN RESCALE AGAIN ACCORDING TO FUNCTION TABLE NO. 2 |
| 26 |
|
| 27 |
outvalue "ctrl1", koct |
| 28 |
|
| 29 |
;OUTPUT OPCODE AMPLITUDE | FREQ. | F.N. |
| 30 |
asig oscili 0.2, cpsoct(koct), 1 ;FREQUENCY IS CONVERTED FROM 'OCT' FORMAT INTO 'CPS' (CYCLES PER SECOND) FORMAT AS OSCILI EXPECTS |
| 31 |
outs asig, asig ;SEND AUDIO SIGNAL TO THE OUTPUTS |
| 32 |
endin |
| 33 |
</CsInstruments> |
| 34 |
<CsScore> |
| 35 |
f 1 0 129 10 1 ;SINE WAVE |
| 36 |
f 2 0 129 -7 8 64 9 64 7 ;RESCALING FUNCTION (NOTE: UN-NORMALIZED FUNCTION - THE USE OF A MINUS SIGN IN THE GEN ROUTINE NUMBER). REFER TO CSOUND MANUAL REGARDING GEN 07 FOR MORE INFORMATION |
| 37 |
i 1 0 3600 ;INSTRUMENT 1 PLAYS A NOTE FOR 1 HOUR |
| 38 |
</CsScore> |
| 39 |
</CsoundSynthesizer> |
| 40 |
<bsbPanel> |
| 41 |
<label>Widgets</label> |
| 42 |
<objectName/> |
| 43 |
<x>791</x> |
| 44 |
<y>321</y> |
| 45 |
<width>585</width> |
| 46 |
<height>373</height> |
| 47 |
<visible>true</visible> |
| 48 |
<uuid/> |
| 49 |
<bgcolor mode="nobackground"> |
| 50 |
<r>170</r> |
| 51 |
<g>170</g> |
| 52 |
<b>170</b> |
| 53 |
</bgcolor> |
| 54 |
<bsbObject version="2" type="BSBLabel"> |
| 55 |
<objectName/> |
| 56 |
<x>2</x> |
| 57 |
<y>2</y> |
| 58 |
<width>578</width> |
| 59 |
<height>368</height> |
| 60 |
<uuid>{c37e13f6-7642-465f-9b2a-f059eef7bce8}</uuid> |
| 61 |
<visible>true</visible> |
| 62 |
<midichan>0</midichan> |
| 63 |
<midicc>0</midicc> |
| 64 |
<label>Rescaling a ctrl7 derived variable using a function table</label> |
| 65 |
<alignment>center</alignment> |
| 66 |
<font>Liberation Sans</font> |
| 67 |
<fontsize>18</fontsize> |
| 68 |
<precision>3</precision> |
| 69 |
<color> |
| 70 |
<r>0</r> |
| 71 |
<g>0</g> |
| 72 |
<b>0</b> |
| 73 |
</color> |
| 74 |
<bgcolor mode="background"> |
| 75 |
<r>244</r> |
| 76 |
<g>248</g> |
| 77 |
<b>200</b> |
| 78 |
</bgcolor> |
| 79 |
<bordermode>border</bordermode> |
| 80 |
<borderradius>5</borderradius> |
| 81 |
<borderwidth>2</borderwidth> |
| 82 |
</bsbObject> |
| 83 |
<bsbObject version="2" type="BSBLabel"> |
| 84 |
<objectName/> |
| 85 |
<x>6</x> |
| 86 |
<y>28</y> |
| 87 |
<width>569</width> |
| 88 |
<height>291</height> |
| 89 |
<uuid>{e41f02b8-6ad4-46dc-805c-0b2eeafbd476}</uuid> |
| 90 |
<visible>true</visible> |
| 91 |
<midichan>0</midichan> |
| 92 |
<midicc>0</midicc> |
| 93 |
<label>-------------------------------------------------------------------------------------------------------------------------------------------- |
| 94 |
Move controller 1 on MIDI channel 1 (or the modulation wheel on a keyboard set to channel 1). This pitch of the oscillator rises up one octave and then falls by two octaves. Ctrl7 includes an optional argument which can be used to reference a function table which will be used to rescale the range of values already defined for the controller derived varable. This feature can be used to create a non-linear mapping of values as the controller is moved. In this example a function table has been created using GEN 7 (straight line segments) as follows: |
| 95 |
;________GEN_VAL_DUR_VAL_DUR_VAL |
| 96 |
f_2_129___-7____8___64____9___64___7 |
| 97 |
|
| 98 |
A minus sign is placed in front of the the GEN routine number to ensure that the values will not be normalised. When the controller is rescaled using this table its output will rise from 8 to 9 for the first half of the controller's movement at which point it will change direction and descend to a final value of 7. These values are used as 'oct' format values for the oscillators frequency paramenter. Another common use of this feature is to remap logarithmic parameters such as frequency so that the MIDI slider controlling them give a more useful response.</label> |
| 99 |
<alignment>left</alignment> |
| 100 |
<font>Liberation Sans</font> |
| 101 |
<fontsize>14</fontsize> |
| 102 |
<precision>3</precision> |
| 103 |
<color> |
| 104 |
<r>0</r> |
| 105 |
<g>0</g> |
| 106 |
<b>0</b> |
| 107 |
</color> |
| 108 |
<bgcolor mode="nobackground"> |
| 109 |
<r>255</r> |
| 110 |
<g>255</g> |
| 111 |
<b>255</b> |
| 112 |
</bgcolor> |
| 113 |
<bordermode>noborder</bordermode> |
| 114 |
<borderradius>1</borderradius> |
| 115 |
<borderwidth>1</borderwidth> |
| 116 |
</bsbObject> |
| 117 |
<bsbObject version="2" type="BSBLabel"> |
| 118 |
<objectName/> |
| 119 |
<x>6</x> |
| 120 |
<y>315</y> |
| 121 |
<width>188</width> |
| 122 |
<height>50</height> |
| 123 |
<uuid>{b143f42f-2cbc-4532-8df7-4ba643c60b37}</uuid> |
| 124 |
<visible>true</visible> |
| 125 |
<midichan>0</midichan> |
| 126 |
<midicc>0</midicc> |
| 127 |
<label/> |
| 128 |
<alignment>left</alignment> |
| 129 |
<font>Liberation Sans</font> |
| 130 |
<fontsize>10</fontsize> |
| 131 |
<precision>3</precision> |
| 132 |
<color> |
| 133 |
<r>0</r> |
| 134 |
<g>0</g> |
| 135 |
<b>0</b> |
| 136 |
</color> |
| 137 |
<bgcolor mode="nobackground"> |
| 138 |
<r>255</r> |
| 139 |
<g>255</g> |
| 140 |
<b>255</b> |
| 141 |
</bgcolor> |
| 142 |
<bordermode>border</bordermode> |
| 143 |
<borderradius>5</borderradius> |
| 144 |
<borderwidth>2</borderwidth> |
| 145 |
</bsbObject> |
| 146 |
<bsbObject version="2" type="BSBDisplay"> |
| 147 |
<objectName>ctrl1</objectName> |
| 148 |
<x>91</x> |
| 149 |
<y>327</y> |
| 150 |
<width>80</width> |
| 151 |
<height>25</height> |
| 152 |
<uuid>{f8119d82-f052-4a86-8790-440c42c5d41d}</uuid> |
| 153 |
<visible>true</visible> |
| 154 |
<midichan>0</midichan> |
| 155 |
<midicc>0</midicc> |
| 156 |
<label>8.000</label> |
| 157 |
<alignment>left</alignment> |
| 158 |
<font>Liberation Sans</font> |
| 159 |
<fontsize>12</fontsize> |
| 160 |
<precision>3</precision> |
| 161 |
<color> |
| 162 |
<r>255</r> |
| 163 |
<g>0</g> |
| 164 |
<b>0</b> |
| 165 |
</color> |
| 166 |
<bgcolor mode="nobackground"> |
| 167 |
<r>255</r> |
| 168 |
<g>255</g> |
| 169 |
<b>255</b> |
| 170 |
</bgcolor> |
| 171 |
<bordermode>noborder</bordermode> |
| 172 |
<borderradius>1</borderradius> |
| 173 |
<borderwidth>1</borderwidth> |
| 174 |
</bsbObject> |
| 175 |
<bsbObject version="2" type="BSBLabel"> |
| 176 |
<objectName/> |
| 177 |
<x>19</x> |
| 178 |
<y>324</y> |
| 179 |
<width>73</width> |
| 180 |
<height>31</height> |
| 181 |
<uuid>{4dc3e62f-8cd7-48cb-8f7f-25878ba3b97e}</uuid> |
| 182 |
<visible>true</visible> |
| 183 |
<midichan>0</midichan> |
| 184 |
<midicc>0</midicc> |
| 185 |
<label>koct:</label> |
| 186 |
<alignment>right</alignment> |
| 187 |
<font>Liberation Sans</font> |
| 188 |
<fontsize>14</fontsize> |
| 189 |
<precision>3</precision> |
| 190 |
<color> |
| 191 |
<r>255</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> |