Debian Codegraph @

src/Examples/McCurdy Collection/MIDI/cpstmid.csd

raw
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
8
9 ;my flags on Ubuntu: -dm0 -odac -+rtaudio=alsa -b1024 -B2048 -+rtmidi=alsa -Ma
10 <CsoundSynthesizer>
11 <CsOptions>
12
13 </CsOptions>
14 <CsInstruments>
15 sr = 44100 ;SAMPLE RATE
16 ksmps = 100 ;NUMBER OF AUDIO SAMPLES IN EACH CONTROL CYCLE
17 nchnls = 2 ;NUMBER OF CHANNELS (2=STEREO)
18 0dbfs = 1 ;MAXIMUM AMPLITUDE REGARDLESS OF BIT DEPTH
19
20
21 instr 1
22
23 ktable invalue "Tuning_Table"
24
25 icps cpstmid 1+i(ktable) ;PITCH VALUES ARE READ IN FROM THE MIDI KEYBOARD BUT THEY ARE TRANSFORMED ACCORDING TO THE RULES LAID DOWN IN THE TUNING TABLES
26 iamp ampmidi 0.2 ;KEY VELOCITIES READ IN FROM MIDI KEYBOARD
27
28 ;PERCUSSIVE-TYPE AMPLITUDE ENVELOPE
29 ; | ATTACK_TIME | | DECAY_TIME | | RELEASE_TIME |
30 aenv expsegr .001, .01, 1, 5, .001, 2, .001
31 asig oscil aenv*iamp, icps, 99 ;CREATE AN AUDIO SIGNAL USING AS OSCILLATOR BASED ON FUNCTION TABLE 99
32 icfoct veloc 6,12
33 asig butlp asig, cpsoct(icfoct)
34 outs asig, asig ;SEND THE AUDIO SIGNAL CREATED BY THE OSCILLATOR TO THE SPEAKERS
35 endin
36 </CsInstruments>
37 <CsScore>
38 ;TUNING TABLES:
39 ;STANDARD
40 ;FN_NUM | INIT_TIME | SIZE | GEN_ROUTINE | NUM_GRADES | REPEAT | BASE_FREQ | BASE_KEY_MIDI | TUNING_RATIOS:-0-|----1----|---2----|----3----|----4----|----5----|----6----|----7----|----8----|----9----|----10----|---11----|-12-|
41 f 1 0 64 -2 12 2 261.626 60 1 1.059463 1.1224619 1.1892069 1.2599207 1.33483924 1.414213 1.4983063 1.5874001 1.6817917 1.7817962 1.8877471 2
42 ;QUARTER TONES
43 ;fn_num | init_time | size | gen_routine | num_grades | repeat | base_freq | base_key_midi | tuning_ratios:-0-|----1----|---2----|----3----|----4----|----5----|----6----|----7----|----8----|----9----|----10----|---11----|---12---|---13----|----14---|---15--|---16----|----17---|---18----|---19--|---20----|---21----|---22----|---23---|-24-|
44 f 2 0 64 -2 24 2 261.626 60 1 1.0293022 1.059463 1.0905076 1.1224619 1.1553525 1.1892069 1.2240532 1.2599207 1.2968391 1.33483924 1.3739531 1.414213 1.4556525 1.4983063 1.54221 1.5874001 1.6339145 1.6817917 1.73107 1.7817962 1.8340067 1.8877471 1.9430623 2
45 ;STANDARD REVERSED
46 ;fn_num | init_time | size | gen_routine | num_grades | repeat | base_freq | base_key_midi | tuning_ratios:-0-|----1----|---2----|----3----|----4----|----5----|----6----|----7----|----8----|----9----|----10----|---11----|-12-|
47 f 3 0 64 -2 12 .5 261.626 60 2 1.8877471 1.7817962 1.6817917 1.5874001 1.4983063 1.414213 1.33483924 1.2599207 1.1892069 1.1224619 1.059463 1
48 ;QUARTER TONES REVERSED
49 ;fn_num | init_time | size | gen_routine | num_grades | repeat | base_freq | base_key_midi | tuning_ratios:-0-|----1----|---2----|----3----|----4----|----5----|----6----|----7----|----8----|----9----|----10----|---11----|---12---|---13----|----14---|---15--|---16----|----17---|---18----|---19--|---20----|---21----|---22----|---23---|-24-|
50 f 4 0 64 -2 24 .5 261.626 60 2 1.9430623 1.8877471 1.8340067 1.7817962 1.73107 1.6817917 1.6339145 1.5874001 1.54221 1.4983063 1.4556525 1.414213 1.3739531 1.33483924 1.2968391 1.2599207 1.2240532 1.1892069 1.1553525 1.1224619 1.0905076 1.059463 1.0293022 1
51 ;DECATONIC
52 ;fn_num | init_time | size | gen_routine | num_grades | repeat | base_freq | base_key_midi | tuning_ratios:-0-|----1----|---2----|----3----|----4----|----5----|----6----|----7----|----8----|----9----|----10----|
53 f 5 0 64 -2 10 2 261.626 60 1 1.0717734 1.148698 1.2311444 1.3195079 1.4142135 1.5157165 1.6245047 1.7411011 1.8660659 2
54 ;THIRD TONES
55 ;fn_num | init_time | size | gen_routine | num_grades | repeat | base_freq | base_key_midi | tuning_ratios:-0-|----1----|----2----|----3----|----4----|----5----|----6----|----7----|----8----|----9----|----10----|---11----|----12---|---13----|----14---|---15---|---16----|----17---|---18----|---19----|---20----|---21----|---22----|---23----|----24----|----25----|----26----|----27----|----28----|----29----|----30----|----31----|----32----|----33----|----34----|----35----|----36----|
56 f 6 0 64 -2 36 2 261.626 60 1 1.0194406 1.0392591 1.059463 1.0800596 1.1010566 1.1224618 1.1442831 1.1665286 1.1892067 1.2123255 1.2358939 1.2599204 1.284414 1.3093838 1.334839 1.3607891 1.3872436 1.4142125 1.4417056 1.4697332 1.4983057 1.5274337 1.5571279 1.5873994 1.6182594 1.6497193 1.6817909 1.7144859 1.7478165 1.7817951 1.8164343 1.8517469 1.8877459 1.9244448 1.9618572 2
57 ;JUST INTONATION
58 ;FN_NUM | INIT_TIME | SIZE | GEN_ROUTINE | NUM_GRADES | REPEAT | BASE_FREQ | BASE_KEY_MIDI | TUNING_RATIOS:-0-|----1----|---2----|----3----|----4----|----5----|----6----|----7----|----8----|----9----|----10----|---11----|-12-|
59 f 7 0 64 -2 12 2 261.626 60 1 [16/15] [9/8] [6/5] [5/4] [4/3] [45/32] [3/2] [8/5] [5/3] [9/5] [15/8] 2
60
61 f 99 0 2048 10 1 0.5 0.2 .1 .05 .025 .0125 .00625
62
63 f 0 3600 ;DUMMY SCORE EVENT - PERMITS REALTIME PERFORMANCE FOR 1 HOUR
64 </CsScore>
65 </CsoundSynthesizer>
66 <bsbPanel>
67 <label>Widgets</label>
68 <objectName/>
69 <x>654</x>
70 <y>526</y>
71 <width>718</width>
72 <height>352</height>
73 <visible>true</visible>
74 <uuid/>
75 <bgcolor mode="background">
76 <r>170</r>
77 <g>170</g>
78 <b>170</b>
79 </bgcolor>
80 <bsbObject version="2" type="BSBLabel">
81 <objectName/>
82 <x>2</x>
83 <y>2</y>
84 <width>711</width>
85 <height>345</height>
86 <uuid>{aa607456-d368-4d59-8497-d16d608404c3}</uuid>
87 <visible>true</visible>
88 <midichan>0</midichan>
89 <midicc>0</midicc>
90 <label>cpstmid - alternative tunings for MIDI driven instruments</label>
91 <alignment>center</alignment>
92 <font>Liberation Sans</font>
93 <fontsize>18</fontsize>
94 <precision>3</precision>
95 <color>
96 <r>0</r>
97 <g>0</g>
98 <b>0</b>
99 </color>
100 <bgcolor mode="background">
101 <r>244</r>
102 <g>248</g>
103 <b>200</b>
104 </bgcolor>
105 <bordermode>border</bordermode>
106 <borderradius>5</borderradius>
107 <borderwidth>2</borderwidth>
108 </bsbObject>
109 <bsbObject version="2" type="BSBLabel">
110 <objectName/>
111 <x>7</x>
112 <y>21</y>
113 <width>700</width>
114 <height>272</height>
115 <uuid>{d4bdb5ce-87d8-4c8c-9c64-40ec2eed6f5a}</uuid>
116 <visible>true</visible>
117 <midichan>0</midichan>
118 <midicc>0</midicc>
119 <label>--------------------------------------------------------------------------------------------------------------------------
120 The opcode 'cpstmid' is used, in place of the usual opcode that would be used for MIDI pitch scanning, to derive alternative tunings. Cpstmid references tuning data stored in a GEN-02 function table to derive pitches. In this function table the user must supply information about the number of grades in the scale (i.e. '12' for equal temperament), the ratio at which the scale repeats (i.e. '2' for equal temperament), base frequency of the scale in hertz (261.626 for middle C) and then the ratios from grade to grade. For example in an equally tempered system each subsequent grade is the product of the previous grade and the 1/12 root of 2 (about 1.05946).
121 This example offers 7 different tuning systems.
122 1 - equal temperament
123 2 - quarter tone scale
124 3 - equal temperament upside-down
125 4 - quarter tones upside-down
126 5 - an octave divided into 10 equal intervals
127 6 - third tones scale
128 7 - just intonation</label>
129 <alignment>left</alignment>
130 <font>Liberation Sans</font>
131 <fontsize>14</fontsize>
132 <precision>3</precision>
133 <color>
134 <r>0</r>
135 <g>0</g>
136 <b>0</b>
137 </color>
138 <bgcolor mode="nobackground">
139 <r>255</r>
140 <g>255</g>
141 <b>255</b>
142 </bgcolor>
143 <bordermode>noborder</bordermode>
144 <borderradius>1</borderradius>
145 <borderwidth>1</borderwidth>
146 </bsbObject>
147 <bsbObject version="2" type="BSBLabel">
148 <objectName/>
149 <x>7</x>
150 <y>291</y>
151 <width>336</width>
152 <height>49</height>
153 <uuid>{b143f42f-2cbc-4532-8df7-4ba643c60b37}</uuid>
154 <visible>true</visible>
155 <midichan>0</midichan>
156 <midicc>0</midicc>
157 <label/>
158 <alignment>left</alignment>
159 <font>Liberation Sans</font>
160 <fontsize>10</fontsize>
161 <precision>3</precision>
162 <color>
163 <r>0</r>
164 <g>0</g>
165 <b>0</b>
166 </color>
167 <bgcolor mode="nobackground">
168 <r>255</r>
169 <g>255</g>
170 <b>255</b>
171 </bgcolor>
172 <bordermode>border</bordermode>
173 <borderradius>5</borderradius>
174 <borderwidth>2</borderwidth>
175 </bsbObject>
176 <bsbObject version="2" type="BSBDropdown">
177 <objectName>Tuning_Table</objectName>
178 <x>128</x>
179 <y>301</y>
180 <width>188</width>
181 <height>29</height>
182 <uuid>{2c4d74f2-8072-4769-bce7-7b28a632b6ca}</uuid>
183 <visible>true</visible>
184 <midichan>0</midichan>
185 <midicc>0</midicc>
186 <bsbDropdownItemList>
187 <bsbDropdownItem>
188 <name>Standard</name>
189 <value>0</value>
190 <stringvalue/>
191 </bsbDropdownItem>
192 <bsbDropdownItem>
193 <name>Quarter Tones</name>
194 <value>1</value>
195 <stringvalue/>
196 </bsbDropdownItem>
197 <bsbDropdownItem>
198 <name>Standard Reversed</name>
199 <value>2</value>
200 <stringvalue/>
201 </bsbDropdownItem>
202 <bsbDropdownItem>
203 <name>Quarter Tones Reversed</name>
204 <value>3</value>
205 <stringvalue/>
206 </bsbDropdownItem>
207 <bsbDropdownItem>
208 <name>Decatonic</name>
209 <value>4</value>
210 <stringvalue/>
211 </bsbDropdownItem>
212 <bsbDropdownItem>
213 <name>Third Tones</name>
214 <value>5</value>
215 <stringvalue/>
216 </bsbDropdownItem>
217 <bsbDropdownItem>
218 <name>Just Intonation</name>
219 <value>6</value>
220 <stringvalue/>
221 </bsbDropdownItem>
222 </bsbDropdownItemList>
223 <selectedIndex>0</selectedIndex>
224 <randomizable group="0">false</randomizable>
225 </bsbObject>
226 <bsbObject version="2" type="BSBLabel">
227 <objectName/>
228 <x>12</x>
229 <y>300</y>
230 <width>107</width>
231 <height>33</height>
232 <uuid>{a1ec3ab8-544e-4940-abf9-3c6fa212e12a}</uuid>
233 <visible>true</visible>
234 <midichan>0</midichan>
235 <midicc>0</midicc>
236 <label>Tuning Table:</label>
237 <alignment>right</alignment>
238 <font>Liberation Sans</font>
239 <fontsize>14</fontsize>
240 <precision>3</precision>
241 <color>
242 <r>0</r>
243 <g>0</g>
244 <b>0</b>
245 </color>
246 <bgcolor mode="nobackground">
247 <r>255</r>
248 <g>255</g>
249 <b>255</b>
250 </bgcolor>
251 <bordermode>noborder</bordermode>
252 <borderradius>1</borderradius>
253 <borderwidth>1</borderwidth>
254 </bsbObject>
255 </bsbPanel>
256 <bsbPresets>
257 </bsbPresets>
258 <EventPanel name="" tempo="60.00000000" loop="8.00000000" x="913" y="162" width="655" height="346" visible="true" loopStart="0" loopEnd="0"> </EventPanel>