| 1 |
/*Getting started.. Function-Tables |
| 2 |
|
| 3 |
It is also possible to create and fill an f-table from within the orchestra. In this case, the 'ftgen' opcode is used. |
| 4 |
|
| 5 |
Filling an f-table directly from within the orchestra looks like this: |
| 6 |
giMyNumbers ftgen 12, 0, -7, -2, 1, 2, 3, 4, 5, 6, 7 |
| 7 |
Here the f-table No. 12 has the size 7 and is filled with this list of numbers: [1, 2, 3, 4, 5, 6, 7] |
| 8 |
|
| 9 |
|
| 10 |
gir ftgen ifn, itime, isize, igen, iarga [, iargb ] [...] |
| 11 |
gir - the number of the table created. Global variables can be read independent from the current instrument, useful here |
| 12 |
ifn - is the number of the F-Table, and will be your later keycode to read it out |
| 13 |
If ifn is zero, the number is assigned automatically and the value placed in gir. |
| 14 |
itime - says when this becomes calculated |
| 15 |
isize - sets the size of the table |
| 16 |
igen - the number of the GEN ROUTINE |
| 17 |
iaga..b - arguments used by the GEN ROUTINES to calculate the numbers |
| 18 |
|
| 19 |
*/ |
| 20 |
<CsoundSynthesizer> |
| 21 |
<CsOptions> |
| 22 |
</CsOptions> |
| 23 |
<CsInstruments> |
| 24 |
|
| 25 |
|
| 26 |
sr = 44100 |
| 27 |
ksmps = 128 |
| 28 |
nchnls = 2 |
| 29 |
0dbfs = 1 |
| 30 |
|
| 31 |
giSine ftgen 1, 0, 4096, 10, 1 ;a sinewave will be generated and stored into Table No. 1 |
| 32 |
giAdd7Sine ftgen 2, 0, 4096, 10, 1, 1, 1, 1, 1, 1, 1, 1 ;a sinewave and 6 harmonics |
| 33 |
giNoise ftgen 3, 0, 4096, 21, 1 ; White Noise |
| 34 |
giMyNumbers ftgen 0, 0, -3, -2, 1, 2, 3 ; [1, 2, 3] - becomes automatically table number 4 |
| 35 |
|
| 36 |
|
| 37 |
instr 1 |
| 38 |
iLength = ftlen(giMyNumbers) |
| 39 |
iMyNumber tab_i (p2%(iLength)), giMyNumbers |
| 40 |
aEnv madsr 0.1, 0.1, 1, 0.3 |
| 41 |
aWavetablePlayer oscili p4, cpspch(p5), (iMyNumber) |
| 42 |
outs aWavetablePlayer*aEnv, aWavetablePlayer*aEnv |
| 43 |
endin |
| 44 |
|
| 45 |
</CsInstruments> |
| 46 |
|
| 47 |
<CsScore> |
| 48 |
;ins strt dur amp freq table-number |
| 49 |
t 0 220 |
| 50 |
|
| 51 |
i 1 1 0.5 0.3 10.0 |
| 52 |
i 1 + 0.5 0.3 10.0 |
| 53 |
i 1 + 0.5 0.3 10.0 |
| 54 |
i 1 + 0.5 0.3 10.0 |
| 55 |
i 1 + 0.5 0.3 10.0 |
| 56 |
i 1 + 0.5 0.3 10.0 |
| 57 |
i 1 + 0.5 0.3 10.0 |
| 58 |
i 1 + 0.5 0.3 10.0 |
| 59 |
i 1 + 0.5 0.3 10.0 |
| 60 |
i 1 + 0.5 0.3 10.0 |
| 61 |
i 1 + 0.5 0.3 10.0 |
| 62 |
i 1 + 0.5 0.3 10.0 |
| 63 |
i 1 + 0.5 0.3 10.0 |
| 64 |
i 1 + 0.5 0.3 10.0 |
| 65 |
i 1 + 0.5 0.3 10.0 |
| 66 |
i 1 + 0.5 0.3 10.0 |
| 67 |
i 1 + 0.5 0.3 10.0 |
| 68 |
i 1 + 0.5 0.3 10.0 |
| 69 |
i 1 + 0.5 0.3 10.0 |
| 70 |
i 1 + 0.5 0.3 10.0 |
| 71 |
|
| 72 |
e |
| 73 |
</CsScore> |
| 74 |
|
| 75 |
</CsoundSynthesizer> |
| 76 |
; written by Alex Hofmann (Mar. 2010) - Incontri HMT-Hannover |
| 77 |
|
| 78 |
<bsbPanel> |
| 79 |
<label>Widgets</label> |
| 80 |
<objectName/> |
| 81 |
<x>1013</x> |
| 82 |
<y>279</y> |
| 83 |
<width>563</width> |
| 84 |
<height>397</height> |
| 85 |
<visible>true</visible> |
| 86 |
<uuid/> |
| 87 |
<bgcolor mode="background"> |
| 88 |
<r>255</r> |
| 89 |
<g>255</g> |
| 90 |
<b>255</b> |
| 91 |
</bgcolor> |
| 92 |
<bsbObject version="2" type="BSBGraph"> |
| 93 |
<objectName/> |
| 94 |
<x>7</x> |
| 95 |
<y>61</y> |
| 96 |
<width>395</width> |
| 97 |
<height>120</height> |
| 98 |
<uuid>{f9ccbabd-c362-420e-b6da-27cecbe668f5}</uuid> |
| 99 |
<visible>true</visible> |
| 100 |
<midichan>0</midichan> |
| 101 |
<midicc>-3</midicc> |
| 102 |
<value>0</value> |
| 103 |
<objectName2/> |
| 104 |
<zoomx>1.00000000</zoomx> |
| 105 |
<zoomy>1.00000000</zoomy> |
| 106 |
<dispx>1.00000000</dispx> |
| 107 |
<dispy>1.00000000</dispy> |
| 108 |
<modex>auto</modex> |
| 109 |
<modey>auto</modey> |
| 110 |
<all>true</all> |
| 111 |
</bsbObject> |
| 112 |
<bsbObject version="2" type="BSBScope"> |
| 113 |
<objectName/> |
| 114 |
<x>6</x> |
| 115 |
<y>223</y> |
| 116 |
<width>400</width> |
| 117 |
<height>158</height> |
| 118 |
<uuid>{ed41ad63-73be-4960-b6fe-183b565ce956}</uuid> |
| 119 |
<visible>true</visible> |
| 120 |
<midichan>0</midichan> |
| 121 |
<midicc>-3</midicc> |
| 122 |
<value>-255.00000000</value> |
| 123 |
<type>scope</type> |
| 124 |
<zoomx>2.00000000</zoomx> |
| 125 |
<zoomy>1.00000000</zoomy> |
| 126 |
<dispx>1.00000000</dispx> |
| 127 |
<dispy>1.00000000</dispy> |
| 128 |
<mode>0.00000000</mode> |
| 129 |
</bsbObject> |
| 130 |
<bsbObject version="2" type="BSBLabel"> |
| 131 |
<objectName/> |
| 132 |
<x>6</x> |
| 133 |
<y>5</y> |
| 134 |
<width>396</width> |
| 135 |
<height>58</height> |
| 136 |
<uuid>{912fe89d-708b-44c9-b6f5-537c335d210f}</uuid> |
| 137 |
<visible>true</visible> |
| 138 |
<midichan>0</midichan> |
| 139 |
<midicc>-3</midicc> |
| 140 |
<label>In this graph, one can see the result of the generated F-Table values.</label> |
| 141 |
<alignment>left</alignment> |
| 142 |
<font>Lucida Grande</font> |
| 143 |
<fontsize>14</fontsize> |
| 144 |
<precision>3</precision> |
| 145 |
<color> |
| 146 |
<r>0</r> |
| 147 |
<g>0</g> |
| 148 |
<b>0</b> |
| 149 |
</color> |
| 150 |
<bgcolor mode="nobackground"> |
| 151 |
<r>255</r> |
| 152 |
<g>255</g> |
| 153 |
<b>255</b> |
| 154 |
</bgcolor> |
| 155 |
<bordermode>noborder</bordermode> |
| 156 |
<borderradius>1</borderradius> |
| 157 |
<borderwidth>1</borderwidth> |
| 158 |
</bsbObject> |
| 159 |
<bsbObject version="2" type="BSBLabel"> |
| 160 |
<objectName/> |
| 161 |
<x>7</x> |
| 162 |
<y>193</y> |
| 163 |
<width>398</width> |
| 164 |
<height>31</height> |
| 165 |
<uuid>{28be8cb0-7e8b-49fd-b163-95402e5aef94}</uuid> |
| 166 |
<visible>true</visible> |
| 167 |
<midichan>0</midichan> |
| 168 |
<midicc>-3</midicc> |
| 169 |
<label>The output-waveform..</label> |
| 170 |
<alignment>left</alignment> |
| 171 |
<font>Lucida Grande</font> |
| 172 |
<fontsize>14</fontsize> |
| 173 |
<precision>3</precision> |
| 174 |
<color> |
| 175 |
<r>0</r> |
| 176 |
<g>0</g> |
| 177 |
<b>0</b> |
| 178 |
</color> |
| 179 |
<bgcolor mode="nobackground"> |
| 180 |
<r>255</r> |
| 181 |
<g>255</g> |
| 182 |
<b>255</b> |
| 183 |
</bgcolor> |
| 184 |
<bordermode>noborder</bordermode> |
| 185 |
<borderradius>1</borderradius> |
| 186 |
<borderwidth>1</borderwidth> |
| 187 |
</bsbObject> |
| 188 |
</bsbPanel> |
| 189 |
<bsbPresets> |
| 190 |
</bsbPresets> |
| 191 |
<EventPanel name="" tempo="60.00000000" loop="8.00000000" x="320" y="218" width="596" height="322" visible="true" loopStart="0" loopEnd="0"> </EventPanel> |