| 1 |
/*Getting started.. 1.6 Instrument Control from the Score |
| 2 |
|
| 3 |
Instrument no. 1 provides two control possibilities for a sine oscillator. |
| 4 |
Volume and pitch can be determined from the score. The different values for a score instruction are called parameter-fields. For example the score below uses 5 p-fields: |
| 5 |
i1 0 2 0.8 440 |
| 6 |
|
| 7 |
When used inside an instrument, the values from the score are referenced using a 'p' and the number of the p-field. |
| 8 |
p1, p2 & p3 are required arguments for each instrument, and they have fixed meaning. All values after that can be freely assigned. |
| 9 |
|
| 10 |
p1 - instrument number |
| 11 |
p2 - start time |
| 12 |
p3 - duration |
| 13 |
--- |
| 14 |
p4 - amplitude (0-1) |
| 15 |
p5 - frequency (Hz) |
| 16 |
|
| 17 |
*/ |
| 18 |
|
| 19 |
<CsoundSynthesizer> |
| 20 |
<CsOptions> |
| 21 |
</CsOptions> |
| 22 |
<CsInstruments> |
| 23 |
|
| 24 |
|
| 25 |
sr = 44100 |
| 26 |
ksmps = 128 |
| 27 |
nchnls = 2 |
| 28 |
0dbfs = 1 |
| 29 |
|
| 30 |
instr 1 |
| 31 |
aSine poscil3 p4, p5, 1 ; Here, a different oscillator type is used, which has more flexibility and higher precision. |
| 32 |
outs aSine, aSine |
| 33 |
endin |
| 34 |
|
| 35 |
</CsInstruments> |
| 36 |
|
| 37 |
<CsScore> |
| 38 |
f 1 0 1024 10 1 |
| 39 |
;ins strt dur amp freq |
| 40 |
i 1 0 2 0.8 440 ; loud |
| 41 |
i 1 3 2 0.1 554.365 ; quiet |
| 42 |
i 1 6 2 0.4 659.255 |
| 43 |
|
| 44 |
i 1 9 3 0.1 440 ; you can layer more instances of the same instrument easily |
| 45 |
i 1 9.5 3.5 0.2 554.365 |
| 46 |
i 1 10 3 0.1 659.255 |
| 47 |
i 1 10.2 2.5 0.15 783.991 |
| 48 |
i 1 10.8 2 0.3 932.328 |
| 49 |
e |
| 50 |
; Keep in mind, that in "realtime mode", the number of layers is limited by your machines CPU power. |
| 51 |
</CsScore> |
| 52 |
</CsoundSynthesizer> |
| 53 |
; written by Alex Hofmann (Nov. 2009) - Incontri HMT-Hannover |
| 54 |
<bsbPanel> |
| 55 |
<label>Widgets</label> |
| 56 |
<objectName/> |
| 57 |
<x>1013</x> |
| 58 |
<y>279</y> |
| 59 |
<width>563</width> |
| 60 |
<height>397</height> |
| 61 |
<visible>true</visible> |
| 62 |
<uuid/> |
| 63 |
<bgcolor mode="background"> |
| 64 |
<r>160</r> |
| 65 |
<g>158</g> |
| 66 |
<b>162</b> |
| 67 |
</bgcolor> |
| 68 |
<bsbObject version="2" type="BSBScope"> |
| 69 |
<objectName/> |
| 70 |
<x>28</x> |
| 71 |
<y>282</y> |
| 72 |
<width>255</width> |
| 73 |
<height>150</height> |
| 74 |
<uuid>{d7080d2c-9587-414f-bd0d-3f9d6f393a49}</uuid> |
| 75 |
<visible>true</visible> |
| 76 |
<midichan>0</midichan> |
| 77 |
<midicc>-3</midicc> |
| 78 |
<value>-255.00000000</value> |
| 79 |
<type>scope</type> |
| 80 |
<zoomx>2.00000000</zoomx> |
| 81 |
<zoomy>1.00000000</zoomy> |
| 82 |
<dispx>1.00000000</dispx> |
| 83 |
<dispy>1.00000000</dispy> |
| 84 |
<mode>0.00000000</mode> |
| 85 |
</bsbObject> |
| 86 |
<bsbObject version="2" type="BSBLabel"> |
| 87 |
<objectName/> |
| 88 |
<x>29</x> |
| 89 |
<y>230</y> |
| 90 |
<width>254</width> |
| 91 |
<height>53</height> |
| 92 |
<uuid>{ede4c1b4-2e64-4b98-98f8-f6179b09cb0f}</uuid> |
| 93 |
<visible>true</visible> |
| 94 |
<midichan>0</midichan> |
| 95 |
<midicc>-3</midicc> |
| 96 |
<label>The scope shows the current output-waveform.</label> |
| 97 |
<alignment>left</alignment> |
| 98 |
<font>Lucida Grande</font> |
| 99 |
<fontsize>14</fontsize> |
| 100 |
<precision>3</precision> |
| 101 |
<color> |
| 102 |
<r>0</r> |
| 103 |
<g>0</g> |
| 104 |
<b>0</b> |
| 105 |
</color> |
| 106 |
<bgcolor mode="nobackground"> |
| 107 |
<r>255</r> |
| 108 |
<g>255</g> |
| 109 |
<b>255</b> |
| 110 |
</bgcolor> |
| 111 |
<bordermode>noborder</bordermode> |
| 112 |
<borderradius>1</borderradius> |
| 113 |
<borderwidth>1</borderwidth> |
| 114 |
</bsbObject> |
| 115 |
<bsbObject version="2" type="BSBGraph"> |
| 116 |
<objectName/> |
| 117 |
<x>29</x> |
| 118 |
<y>80</y> |
| 119 |
<width>251</width> |
| 120 |
<height>109</height> |
| 121 |
<uuid>{1c65da94-898d-49f2-b94f-472fb9a72903}</uuid> |
| 122 |
<visible>true</visible> |
| 123 |
<midichan>0</midichan> |
| 124 |
<midicc>-3</midicc> |
| 125 |
<value>0</value> |
| 126 |
<objectName2/> |
| 127 |
<zoomx>1.00000000</zoomx> |
| 128 |
<zoomy>1.00000000</zoomy> |
| 129 |
<dispx>1.00000000</dispx> |
| 130 |
<dispy>1.00000000</dispy> |
| 131 |
<modex>auto</modex> |
| 132 |
<modey>auto</modey> |
| 133 |
<all>true</all> |
| 134 |
</bsbObject> |
| 135 |
<bsbObject version="2" type="BSBLabel"> |
| 136 |
<objectName/> |
| 137 |
<x>29</x> |
| 138 |
<y>20</y> |
| 139 |
<width>251</width> |
| 140 |
<height>61</height> |
| 141 |
<uuid>{3c3dcb27-288d-4ae0-8022-28c33c7021c5}</uuid> |
| 142 |
<visible>true</visible> |
| 143 |
<midichan>0</midichan> |
| 144 |
<midicc>-3</midicc> |
| 145 |
<label>The pure waveform used by the oscillator is displayed in this Graph widget.</label> |
| 146 |
<alignment>left</alignment> |
| 147 |
<font>DejaVu Sans</font> |
| 148 |
<fontsize>14</fontsize> |
| 149 |
<precision>3</precision> |
| 150 |
<color> |
| 151 |
<r>0</r> |
| 152 |
<g>0</g> |
| 153 |
<b>0</b> |
| 154 |
</color> |
| 155 |
<bgcolor mode="nobackground"> |
| 156 |
<r>255</r> |
| 157 |
<g>255</g> |
| 158 |
<b>255</b> |
| 159 |
</bgcolor> |
| 160 |
<bordermode>noborder</bordermode> |
| 161 |
<borderradius>1</borderradius> |
| 162 |
<borderwidth>1</borderwidth> |
| 163 |
</bsbObject> |
| 164 |
</bsbPanel> |
| 165 |
<bsbPresets> |
| 166 |
</bsbPresets> |
| 167 |
<EventPanel name="" tempo="60.00000000" loop="8.00000000" x="320" y="218" width="604" height="322" visible="true" loopStart="0" loopEnd="0"> </EventPanel> |