OSDN Git Service

Added randomization. Fixed bugs.
[timewavesynth/Timewave_Synthesizer.git] / timewavesynth3.scd
1 (
2 //To run the synth, click anywhere within the parenthesis above and press "ctrl - enter" or "cmd - return".
3 //A guide to using the instrument is available by clicking on the "i" button in the bottom right corner of the GUI.
4 //Several lines down, where it says "//VARIABLES YOU MAY WISH TO CHANGE", are variables that you can change for various things,
5 //including key codes for keyboard functions.
6
7 //It is recommended to reboot the interpreter in the "Language" toolbar, or by hightlighting - (thisProcess.platform.recompile);
8 //and pressing "ctrl - enter" or "cmd - return", before each server boot. Rebooting the interpreter is not needed to
9 //evaluate the code below if the server is booted.
10
11 //You can program/make a song by using the "timewavesynth8script.scd" file
12
13 //This synth is compatible with the Korg NanoKontrol 2
14
15 s.options.memSize = 2097152/2;
16 MIDIIn.connectAll;
17
18 (
19 s.boot;
20 s.waitForBoot({
21         var point, w, view, view2,
22         vol = 0.02,mute1,mute2,mute3,mute4,mute5,mute6,mute7,mute8,muteall,unmuteall,
23         g1,g2,g6,g8,g33,g48,g64,g72,g88,gm,ngm1,ngm2,ngm6,set1,set2,menu1,menu2,
24         ts,sts,str,spaceb,b1,b2,b3,b4,button,button1,info,
25         n1,n2,n3,n4,n5,n6,n7,n8,keycodeb,
26         f1,f2,f3,f4,f5,f6,f7,f8,f9,f10,f11,f12;
27
28
29         //VARIABLES YOU MAY WISH TO CHANGE
30
31
32         //note A tuning frequency in hz
33
34         ~tuning_frequency = 432; //default 432 hz
35
36         ~freqmap = (i = ~tuning_frequency / (2 ** (69 / 12)); a = (-1); b = (-1); Array.fill(128, {i * (2 ** (((a=a+1) / 12).trunc)) * ( (2 ** (12.reciprocal)) ** ((b=b+1)  % 12));}));/*~freqmap = (i = 8.0271480262684/*-0.0000000000024*/; ~stepratio = 1.0594630943593; Array.fill(128, { i = i*~stepratio;}));*/
37
38
39         //number of KW(King Wen) sequences in a timewave half-cycle (or amplitude x2)
40
41         ~synthdefnum = 12; //default 12
42
43
44         //timewave starting base (lowest) frequency
45
46         x = 432; y = 432; ~basefreqmap = Array.fill(32, {x=x/1.0835058821738}).reverse++[432]++Array.fill(25, {y=y*1.0835058821738}); //create basefreqmap array
47
48         ~base_frequency = ~basefreqmap.at(8); //default 8 (63.027950580203). replace "~basefreqmap.at(#)" for custom value.
49
50
51         //starting synthdef setting
52
53         if((~kws_setting == nil) or: (~ratio_setting == nil), {
54
55                 ~kws_setting = 1; //default type of King Wen sequence interpretation
56
57                 ~ratio_setting = "psine1"; //default ratio setting for synthdef
58         });
59
60
61         //low-pass filter settings
62
63         if(~low_pass_filter_on == nil, {~low_pass_filter_on = 1}); //set starting low-pass filter on/off. 1 means on - switch to 0 for off.
64
65         if(~low_pass_filter_set_value == nil, {~low_pass_filter_freq_limit = 1728; //frequency limit for low-pass filter in synthdefs. default is 1728.
66         });
67
68
69         //default sendreply toggle
70
71         if(~sendreplysynthdef_on == nil, {~sendreplysynthdef_on = 0; //switch for mid-timewave sequence events. 0 is off, 1 is on. default is 0
72         });
73         if(~sendreplyfunc_choose == nil, {~sendreplyfunc_choose = 0; //switch for specific mid-timewave sequence events function. default is 0
74         });
75         if(~sendreplyfuncswitch == nil, {~sendreplyfuncswitch = 1; //1 is random western scale note change per timewave half-cycle, 2 is eastern scale. default is 1
76         });
77
78
79         //volume
80
81         ~vol = 0.005; //default 0.005
82         12.do(x = 0; {("vol"++(x=x+1)).asSymbol.envirPut(~vol)});
83
84
85         //Key codes for keyboard functions - either unicode or keycode. To find key codes, see below:
86
87         ~rightarrow_keycode = 65363; //next note change increase
88         ~leftarrow_keycode = 65361; //next note change decrease
89         ~uparrow_keycode = 65362; //change synth up
90         ~downarrow_keycode = 65364; //change synth down
91
92         ~rightarrow_keycode1 = 114; //next note change increase (old version - may not work)
93         ~leftarrow_keycode1 = 113; //next note change decrease (old version - may not work)
94         ~uparrow_keycode1 = 111; //change synth up (old version - may not work)
95         ~downarrow_keycode1 = 116; //change synth down (old version - may not work)
96
97         ~enter_unicode = 13; //
98         ~s_unicode = 115; //start synth
99         ~m_unicode = 109; //mute/unmute all synths
100         ~r_unicode = 114; //routine/loop function
101         ~u_unicode = 117; //
102         ~t_unicode = 116; //timer function
103         ~c_unicode = 99; //copy function
104         ~i_unicode = 105; //change synth up
105         ~k_unicode = 107; //change synth down
106         ~j_unicode = 106; //next note change decrease
107         ~l_unicode = 108; //next note change increase
108         ~spacebar_unicode = 32; //pause all synths
109         ~one_unicode = 49; //choose synth 1
110         ~two_unicode = 50; //choose synth 2
111         ~three_unicode = 51; //choose synth 3
112         ~four_unicode = 52; //choose synth 4
113         ~five_unicode = 53; //choose synth 5
114         ~six_unicode = 54; //choose synth 6
115         ~seven_unicode = 55; //choose synth 7
116         ~eight_unicode = 56; //choose synth 8
117         ~nine_unicode = 57; //choose synth 9
118         ~ten_unicode = 48; //choose synth 10
119         ~eleven_unicode = 45; //choose synth 11
120         ~twelve_unicode = 61; //choose synth 12
121         ~escape_unicode = 27; //escape function
122
123
124         //To find key codes in post window... Hightlight the function and its parenthesis in red below,
125         //and press "ctrl - enter" or "cmd - return" - then a small window called "test" will pop up...
126         //Press the "type" button inside of the window, then press anywhere on the keyboard to find
127         //the key codes in the right-hand side post window. Layout: [unicode, keycode, modifiers]. It is either a unicode
128         //or a keycode. Do not delete the /* and */ characters, or else the
129         //program will not run.
130
131         /*
132
133         (
134         var win = Window(\test, Rect(10, 100, 100, 50)),
135         btn = Button(win, Rect(5, 5, 90, 40)).states_([["type"]]);
136         btn.keyDownAction =
137         { arg view, char, modifiers, unicode, keycode;
138         ["unicode:"+unicode, "keycode:"+keycode, "modifiers:"+modifiers].postln;
139         };
140         win.front;
141         )
142
143         */
144
145
146         //gui set frequency ranges - currently set at the lowest and highest notes on a 128 key range using 432 hz A tuning
147         //you can change the tuning near top
148         //to insert custom ranges, replace "~freqmap.at()" with a hz frequency
149
150         ~outmin1 = ~freqmap.at(0);       // 8.0271480262684 hz                       //base frequency of upper set
151         ~outmax1 = ~freqmap.at(127);     // 12315.783879572 hz                       //high frequency of upper set
152         ~outmin2 = ~freqmap.at(0)*8;     // (8.0271480262684)*8 hz                   //base frequency of lower set
153         ~outmax2 = ~freqmap.at(127)/8;   // (12315.783879572)/8 hz;                  //high frequency of lower set
154
155         ~outmina = ~outmin2;
156         ~outmaxa = ~outmax2;
157         ~outminb = ~outmin1;
158         ~outmaxb = ~outmax1;
159
160
161         //increase or decrease magnitude of second and third harmonics for synthdefs and synth functions (not recommend changing if uncertain of effects)
162
163         //synthdefs
164
165         ~first_harmonic = 1;  //1
166         ~second_harmonic = 2; //2
167         ~third_harmonic = 6;  //6
168
169         //synth functions
170
171         ~icd3 = 3; //3
172         ~icd6 = 6; //6
173
174
175         //ratio values
176
177         ~fth = 1.4142135623729; //default kws binary interval
178         ~bi = ~fth; //~bi = "binary interval" - intverval of key change to a hexagram line's opposite in King Wen sequence
179         ~stepratio = 1.0594630943593;
180         ~nval = 1.0355417528;
181         ~n9s = 1.86;
182         ~n9 = 1.080059789899;
183         ~n18 = 1.0392592260319;
184         ~n27 = 1.0260044847071;
185         ~n36 = 1.0194406437022;
186         ~n45 = 1.0155225125043;
187         ~n54 = 1.012918794725;
188         ~n63 = 1.0110630844869;
189         ~n72 = 1.0096735332285;
190         ~gm = 1.6180339887499; //phi (golden mean), scaled on 1 key change per King Wen sequence
191         ~gm2 = 1.2720196495141;
192         ~gm6 = 1.0835058821738;
193         ~ngm1 = 1.0549232131786; //phi (golden mean), scaled on 9 key changes per King Wen sequence
194         ~ngm2 = 1.0270945492887;
195         ~ngm6 = 1.0089511542031;
196         ~nngm1 = 1.0075472729363; //phi (golden mean), scaled on 64 key changes per King Wen sequence
197         ~nngm2 = 1.0037665430449;
198         ~nngm6 = 1.0012539413222;
199         ~h1 = 11.10101010101; //based on 19.47:360, scaled on 1 key change per King Wen sequence
200         ~h2 = 4.2999982083345;
201         ~h6 = 1.6261331058274;
202         ~nh1 = 1.3828361607663; //based on 19.47:360, scaled on 9 key changes per King Wen sequence
203         ~nh2 = 1.1759405430404;
204         ~nh6 = 1.0555086286213;
205         ~nnh1 = 1.0466365180627; //based on 19.47:360, scaled on 64 key changes per King Wen sequence
206         ~nnh2 = 1.0230525490231;
207         ~nnh6 = 1.0076258811195;
208
209
210         //edit SAVED s1-s8 frequencies/chords. Replace any "[ ~f1,~f2,~f3 ]" with desired frequencies.
211         //Example: [~f1=31.385685128991,~f2=86.222407114322,~f3=229.95963599755]
212         //You can find frequencies in the "copy" section of GUI under "saved open/flow 1-8 frequencies:" or "saved slide 1-8 frequencies:".
213         //Remove both the "/*" and "*/" around the code to make evaluable. Put them back to make it unevaluable.
214
215         /*
216
217         3.do(x = 0; {("fp"++(x=x+1)).asSymbol.envirPut([ ~f1,~f2,~f3 ].at(x-1))});
218         3.do(x = 0; {("fp"++(x=x+1)++"b").asSymbol.envirPut([ ~f1,~f2,~f3 ].at(x-1))});
219         3.do(x = 0; {("fp"++(x=x+1)++"c").asSymbol.envirPut([ ~f1,~f2,~f3 ].at(x-1))});
220         3.do(x = 0; {("fp"++(x=x+1)++"d").asSymbol.envirPut([ ~f1,~f2,~f3 ].at(x-1))});
221         3.do(x = 0; {("fp"++(x=x+1)++"e").asSymbol.envirPut([ ~f1,~f2,~f3 ].at(x-1))});
222         3.do(x = 0; {("fp"++(x=x+1)++"f").asSymbol.envirPut([ ~f1,~f2,~f3 ].at(x-1))});
223         3.do(x = 0; {("fp"++(x=x+1)++"g").asSymbol.envirPut([ ~f1,~f2,~f3 ].at(x-1))});
224         3.do(x = 0; {("fp"++(x=x+1)++"h").asSymbol.envirPut([ ~f1,~f2,~f3 ].at(x-1))});
225
226         */
227
228
229         //edit STARTING frequencies/chord (not saved s1-s8 frequencies/chords). Replace "[ ~f1,~f2,~f3 ]" with starting frequencies.
230         //Example: [~f1=31.385685128991,~f2=86.222407114322,~f3=229.95963599755]
231         //You can find frequencies in the "copy" section of GUI under "current chord/frequencies".
232         //Remove both the "/*" and "*/" around the code to make evaluable. Put them back to make it unevaluable again.
233
234         /*
235
236         3.do(x = 0; {("f"++(x=x+1)).asSymbol.envirPut(
237
238         [ ~f1,~f2,~f3 ]
239
240         .at(x-1))});
241
242         */
243
244         //^Imoprtant note: "edit STARTING frequencies/chord" must be placed after "edit SAVED frequencies/chords" in code in order for it to work correctly
245
246
247         ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
248
249
250         //default starting notes
251
252         if(([f1,f2,f3] == [nil,nil,nil]), {
253                 #f1,f2,f3 = [
254                         (~freqmap.at(127)/8).rand,
255                         (~freqmap.at(127)/8).rand,
256                         (~freqmap.at(127)/8).rand
257                 ];
258         });
259
260         if(([ ~f1,~f2,~f3 ] == [nil,nil,nil]), {3.do(x = 0; {("f"++(x=x+1)).asSymbol.envirPut([f1,f2,f3].at(x-1))});});
261
262         if([~fp1,~fp2,~fp3,~fp4,~fp5,~fp6,~fp7,~fp8,~fp9,~fp10,~fp11,~fp12] == [nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil], {12.do(x = 0; {("fp"++(x=x+1)).asSymbol.envirPut([ ~f1,~f2,~f3,~f4,~f5,~f6,~f7,~f8,~f9,~f10,~f11,~f12 ].at(x-1))});});
263         if([~fp1b,~fp2b,~fp3b,~fp4b,~fp5b,~fp6b,~fp7b,~fp8b,~fp9b,~fp10b,~fp11b,~fp12b] == [nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil], {12.do(x = 0; {("fp"++(x=x+1)++"b").asSymbol.envirPut([ ~f1,~f2,~f3,~f4,~f5,~f6,~f7,~f8,~f9,~f10,~f11,~f12 ].at(x-1))});});
264         if([~fp1c,~fp2c,~fp3c,~fp4c,~fp5c,~fp6c,~fp7c,~fp8c,~fp9c,~fp10c,~fp11c,~fp12c] == [nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil], {12.do(x = 0; {("fp"++(x=x+1)++"c").asSymbol.envirPut([ ~f1,~f2,~f3,~f4,~f5,~f6,~f7,~f8,~f9,~f10,~f11,~f12 ].at(x-1))});});
265         if([~fp1d,~fp2d,~fp3d,~fp4d,~fp5d,~fp6d,~fp7d,~fp8d,~fp9d,~fp10d,~fp11d,~fp12d] == [nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil], {12.do(x = 0; {("fp"++(x=x+1)++"d").asSymbol.envirPut([ ~f1,~f2,~f3,~f4,~f5,~f6,~f7,~f8,~f9,~f10,~f11,~f12 ].at(x-1))});});
266         if([~fp1e,~fp2e,~fp3e,~fp4e,~fp5e,~fp6e,~fp7e,~fp8e,~fp9e,~fp10e,~fp11e,~fp12e] == [nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil], {12.do(x = 0; {("fp"++(x=x+1)++"e").asSymbol.envirPut([ ~f1,~f2,~f3,~f4,~f5,~f6,~f7,~f8,~f9,~f10,~f11,~f12 ].at(x-1))});});
267         if([~fp1f,~fp2f,~fp3f,~fp4f,~fp5f,~fp6f,~fp7f,~fp8f,~fp9f,~fp10f,~fp11f,~fp12f] == [nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil], {12.do(x = 0; {("fp"++(x=x+1)++"f").asSymbol.envirPut([ ~f1,~f2,~f3,~f4,~f5,~f6,~f7,~f8,~f9,~f10,~f11,~f12 ].at(x-1))});});
268         if([~fp1g,~fp2g,~fp3g,~fp4g,~fp5g,~fp6g,~fp7g,~fp8g,~fp9g,~fp10g,~fp11g,~fp12g] == [nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil], {12.do(x = 0; {("fp"++(x=x+1)++"g").asSymbol.envirPut([ ~f1,~f2,~f3,~f4,~f5,~f6,~f7,~f8,~f9,~f10,~f11,~f12 ].at(x-1))});});
269         if([~fp1h,~fp2h,~fp3h,~fp4h,~fp5h,~fp6h,~fp7h,~fp8h,~fp9h,~fp10h,~fp11h,~fp12h] == [nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil], {12.do(x = 0; {("fp"++(x=x+1)++"h").asSymbol.envirPut([ ~f1,~f2,~f3,~f4,~f5,~f6,~f7,~f8,~f9,~f10,~f11,~f12 ].at(x-1))});});
270
271         12.do(x = 0; {("u"++(x=x+1)).asSymbol.envirPut([~fp1,~fp2,~fp3,~fp4,~fp5,~fp6,~fp7,~fp8,~fp9,~fp10,~fp11,~fp12].at(x-1))});
272         12.do(x = 0; {("u"++(x=x+1)++"b").asSymbol.envirPut([~fp1b,~fp2b,~fp3b,~fp4b,~fp5b,~fp6b,~fp7b,~fp8b,~fp9b,~fp10b,~fp11b,~fp12b].at(x-1))});
273         12.do(x = 0; {("u"++(x=x+1)++"c").asSymbol.envirPut([~fp1c,~fp2c,~fp3c,~fp4c,~fp5c,~fp6c,~fp7c,~fp8c,~fp9c,~fp10c,~fp11c,~fp12c].at(x-1))});
274         12.do(x = 0; {("u"++(x=x+1)++"d").asSymbol.envirPut([~fp1d,~fp2d,~fp3d,~fp4d,~fp5d,~fp6d,~fp7d,~fp8d,~fp9d,~fp10d,~fp11d,~fp12d].at(x-1))});
275         12.do(x = 0; {("u"++(x=x+1)++"e").asSymbol.envirPut([~fp1e,~fp2e,~fp3e,~fp4e,~fp5e,~fp6e,~fp7e,~fp8e,~fp9e,~fp10e,~fp11e,~fp12e].at(x-1))});
276         12.do(x = 0; {("u"++(x=x+1)++"f").asSymbol.envirPut([~fp1f,~fp2f,~fp3f,~fp4f,~fp5f,~fp6f,~fp7f,~fp8f,~fp9f,~fp10f,~fp11f,~fp12f].at(x-1))});
277         12.do(x = 0; {("u"++(x=x+1)++"g").asSymbol.envirPut([~fp1g,~fp2g,~fp3g,~fp4g,~fp5g,~fp6g,~fp7g,~fp8g,~fp9g,~fp10g,~fp11g,~fp12g].at(x-1))});
278         12.do(x = 0; {("u"++(x=x+1)++"h").asSymbol.envirPut([~fp1h,~fp2h,~fp3h,~fp4h,~fp5h,~fp6h,~fp7h,~fp8h,~fp9h,~fp10h,~fp11h,~fp12h].at(x-1))});
279
280         /*if(96.do(x = 1; y = (-1); z = 0; {("sg"++(x)++"a"++(z=z+1)).asSymbol.envirGet; if(z>=12, {x= x+1; y = 0; z = 0;});}).collect.every({arg item; item == nil;}), {96.do(x = 1; y = (-1); z = 0; {("sg"++(x)++"a"++(z=z+1)).asSymbol.envirPut([~fp1,~fp2,~fp3,~fp4,~fp5,~fp6,~fp7,~fp8,~fp9,~fp10,~fp11,~fp12].at(y=y+1)); if(z>=12, {x= x+1; y = 0; z = 0;});});});
281         if(96.do(x = 1; y = (-1); z = 0; {("sg"++(x)++"b"++(z=z+1)).asSymbol.envirGet; if(z>=12, {x= x+1; y = 0; z = 0;});}).collect.every({arg item; item == nil;}), {96.do(x = 1; y = (-1); z = 0; {("sg"++(x)++"a"++(z=z+1)).asSymbol.envirPut([~fp1,~fp2,~fp3,~fp4,~fp5,~fp6,~fp7,~fp8,~fp9,~fp10,~fp11,~fp12].at(y=y+1)); if(z>=12, {x= x+1; y = 0; z = 0;});});});
282         if(96.do(x = 1; y = (-1); z = 0; {("sg"++(x)++"c"++(z=z+1)).asSymbol.envirGet; if(z>=12, {x= x+1; y = 0; z = 0;});}).collect.every({arg item; item == nil;}), {96.do(x = 1; y = (-1); z = 0; {("sg"++(x)++"a"++(z=z+1)).asSymbol.envirPut([~fp1,~fp2,~fp3,~fp4,~fp5,~fp6,~fp7,~fp8,~fp9,~fp10,~fp11,~fp12].at(y=y+1)); if(z>=12, {x= x+1; y = 0; z = 0;});});});
283         if(96.do(x = 1; y = (-1); z = 0; {("sg"++(x)++"d"++(z=z+1)).asSymbol.envirGet; if(z>=12, {x= x+1; y = 0; z = 0;});}).collect.every({arg item; item == nil;}), {96.do(x = 1; y = (-1); z = 0; {("sg"++(x)++"a"++(z=z+1)).asSymbol.envirPut([~fp1,~fp2,~fp3,~fp4,~fp5,~fp6,~fp7,~fp8,~fp9,~fp10,~fp11,~fp12].at(y=y+1)); if(z>=12, {x= x+1; y = 0; z = 0;});});});
284         if(96.do(x = 1; y = (-1); z = 0; {("sg"++(x)++"e"++(z=z+1)).asSymbol.envirGet; if(z>=12, {x= x+1; y = 0; z = 0;});}).collect.every({arg item; item == nil;}), {96.do(x = 1; y = (-1); z = 0; {("sg"++(x)++"a"++(z=z+1)).asSymbol.envirPut([~fp1,~fp2,~fp3,~fp4,~fp5,~fp6,~fp7,~fp8,~fp9,~fp10,~fp11,~fp12].at(y=y+1)); if(z>=12, {x= x+1; y = 0; z = 0;});});});
285         if(96.do(x = 1; y = (-1); z = 0; {("sg"++(x)++"f"++(z=z+1)).asSymbol.envirGet; if(z>=12, {x= x+1; y = 0; z = 0;});}).collect.every({arg item; item == nil;}), {96.do(x = 1; y = (-1); z = 0; {("sg"++(x)++"a"++(z=z+1)).asSymbol.envirPut([~fp1,~fp2,~fp3,~fp4,~fp5,~fp6,~fp7,~fp8,~fp9,~fp10,~fp11,~fp12].at(y=y+1)); if(z>=12, {x= x+1; y = 0; z = 0;});});});
286         if(96.do(x = 1; y = (-1); z = 0; {("sg"++(x)++"g"++(z=z+1)).asSymbol.envirGet; if(z>=12, {x= x+1; y = 0; z = 0;});}).collect.every({arg item; item == nil;}), {96.do(x = 1; y = (-1); z = 0; {("sg"++(x)++"a"++(z=z+1)).asSymbol.envirPut([~fp1,~fp2,~fp3,~fp4,~fp5,~fp6,~fp7,~fp8,~fp9,~fp10,~fp11,~fp12].at(y=y+1)); if(z>=12, {x= x+1; y = 0; z = 0;});});});
287         if(96.do(x = 1; y = (-1); z = 0; {("sg"++(x)++"h"++(z=z+1)).asSymbol.envirGet; if(z>=12, {x= x+1; y = 0; z = 0;});}).collect.every({arg item; item == nil;}), {96.do(x = 1; y = (-1); z = 0; {("sg"++(x)++"a"++(z=z+1)).asSymbol.envirPut([~fp1,~fp2,~fp3,~fp4,~fp5,~fp6,~fp7,~fp8,~fp9,~fp10,~fp11,~fp12].at(y=y+1)); if(z>=12, {x= x+1; y = 0; z = 0;});});});
288         */
289
290         //set n1-n9 ratio values
291
292         case
293         {~ratio_setting == "psine1";}{~n_value1 = ~gm;    ~n_value2 = ~gm2;   ~n_value6 = ~gm6;}
294         {~ratio_setting == "psine2";}{~n_value1 = ~ngm1;  ~n_value2 = ~ngm2;  ~n_value6 = ~ngm6;}
295         {~ratio_setting == "psine3";}{~n_value1 = ~nngm1; ~n_value2 = ~nngm2; ~n_value6 = ~nngm6;}
296         {~ratio_setting == "hsine1";}{~n_value1 = ~h1;    ~n_value2 = ~h2;    ~n_value6 = ~h6;}
297         {~ratio_setting == "hsine2";}{~n_value1 = ~nh1;   ~n_value2 = ~nh2;   ~n_value6 = ~nh6;}
298         {~ratio_setting == "hsine3";}{~n_value1 = ~nnh1;  ~n_value2 = ~nnh2;  ~n_value6 = ~nnh6;};
299
300
301         //King Wen sequence interpretation settings 1-3 for synthdefs
302
303         ~kws_setting_1_a = {[/*1*/      #a,b,c,d,e,f=[ ~a,~b,~c,~d,~e,~f  ],/*2*/       [ a = a/~bi, b = b/~bi, c = c/~bi, d = d/~bi, e = e/~bi, f = f/~bi ],/*3*/      [ a = a,         b = b*~bi,    c = c,         d = d,         e = e,         f = f*~bi  ],/*4*/  [ a = a*~bi,    b = b/~bi,    c = c,         d = d,         e = e*~bi,    f = f/~bi  ],/*5*/    [ a = a/~bi,    b = b*~bi,    c = c,         d = d*~bi,    e = e,         f = f*~bi ],/*6*/     [ a = a*~bi,    b = b,         c = c*~bi,    d = d/~bi,    e = e,         f = f/~bi  ],/*7*/    [ a = a/~bi,    b = b/~bi,    c = c/~bi,    d = d,         e = e,         f = f ],/*8*/ [ a = a,         b = b*~bi,    c = c,         d = d,         e = e/~bi,    f = f ],/*9*/        [ a = a*~bi,    b = b,         c = c,         d = d*~bi,    e = e*~bi,    f = f*~bi ],/*10*/    [ a = a,         b = b,         c = c*~bi,    d = d/~bi,    e = e,         f = f ],/*11*/       [ a = a/~bi,    b = b/~bi,    c = c/~bi,    d = d*~bi,    e = e,         f = f ],/*12*/ [ a = a*~bi, b = b*~bi, c = c*~bi, d = d/~bi, e = e/~bi, f = f/~bi ],/*13*/     [ a = a,         b = b,         c = c,         d = d*~bi,    e = e,         f = f*~bi ],/*14*/  [ a = a,         b = b/~bi,    c = c,         d = d,         e = e*~bi,    f = f],/*15*/        [ a = a/~bi,    b = b,         c = c/~bi,    d = d,         e = e/~bi,    f = f/~bi ],/*16*/    [ a = a,         b = b,         c = c*~bi,    d = d/~bi,    e = e,         f = f ],/*17*/       [ a = a,         b = b*~bi,    c = c,         d = d,         e = e,         f = f*~bi],/*18*/   [ a = a*~bi, b = b/~bi, c = c/~bi, d = d*~bi, e = e*~bi, f = f/~bi ],/*19*/     [ a = a/~bi,    b = b,         c = c,         d = d/~bi,    e = e,         f = f*~bi ],/*20*/   [ a = a*~bi,    b = b*~bi,    c = c,         d = d,         e = e/~bi,    f = f/~bi ],/*21*/    [ a = a,         b = b/~bi,    c = c*~bi,    d = d,         e = e,         f = f*~bi ],/*22*/   [ a = a,         b = b,         c = c/~bi,    d = d*~bi,    e = e,         f = f ],/*23*/       [ a = a,         b = b,         c = c,         d = d/~bi,    e = e,         f = f/~bi ],/*24*/  [ a = a/~bi,    b = b,         c = c,         d = d,         e = e,         f = f*~bi ],/*25*/  [ a = a*~bi,    b = b*~bi,    c = c*~bi,    d = d,         e = e,         f = f ],/*26*/        [ a = a,         b = b/~bi,    c = c/~bi,    d = d*~bi,    e = e*~bi,    f = f ],/*27*/ [ a = a,         b = b,         c = c,         d = d/~bi,    e = e/~bi,    f = f ],/*28*/       [ a = a/~bi, b = b*~bi, c = c*~bi, d = d*~bi, e = e*~bi, f = f/~bi ],/*29*/     [ a = a,         b = b,         c = c/~bi,    d = d/~bi,    e = e,         f = f ],/*30*/       [ a = a*~bi, b = b/~bi, c = c*~bi, d = d*~bi, e = e/~bi, f = f*~bi ],/*31*/     [ a = a/~bi,    b = b*~bi,    c = c,         d = d,         e = e,         f = f/~bi ],/*32*/   [ a = a,         b = b/~bi,    c = c,         d = d,         e = e*~bi,    f = f ],/*33*/       [ a = a*~bi,    b = b*~bi,    c = c,         d = d,         e = e/~bi,    f = f ],/*34*/        [ a = a/~bi,    b = b/~bi,    c = c,         d = d,         e = e*~bi,    f = f*~bi ],/*35*/    [ a = a*~bi,    b = b,         c = c,         d = d/~bi,    e = e/~bi,    f = f/~bi ],/*36*/    [ a = a/~bi,    b = b,         c = c/~bi,    d = d*~bi,    e = e,         f = f*~bi ],/*37*/    [ a = a*~bi,    b = b*~bi,    c = c,         d = d,         e = e,         f = f ],/*38*/       [ a = a,         b = b/~bi,    c = c*~bi,    d = d/~bi,    e = e*~bi,    f = f ],/*39*/ [ a = a/~bi, b = b*~bi, c = c/~bi, d = d*~bi, e = e/~bi, f = f/~bi ],/*40*/     [ a = a,         b = b/~bi,    c = c*~bi,    d = d/~bi,    e = e*~bi,    f = f ],/*41*/ [ a = a*~bi,    b = b,         c = c/~bi,    d = d,         e = e,         f = f*~bi ],/*42*/   [ a = a,         b = b*~bi,    c = c,         d = d,         e = e/~bi,    f = f ],/*43*/       [ a = a/~bi,    b = b,         c = c*~bi,    d = d*~bi,    e = e*~bi,    f = f ],/*44*/ [ a = a*~bi,    b = b,         c = c,         d = d,         e = e,         f = f/~bi ],/*45*/  [ a = a/~bi,    b = b,         c = c,         d = d/~bi,    e = e/~bi,    f = f ],/*46*/        [ a = a,         b = b/~bi,    c = c/~bi,    d = d*~bi,    e = e*~bi,    f = f ],/*47*/ [ a = a,         b = b*~bi,    c = c*~bi,    d = d/~bi,    e = e,         f = f ],/*48*/        [ a = a,         b = b,         c = c/~bi,    d = d*~bi,    e = e,         f = f ],/*49*/       [ a = a,         b = b,         c = c*~bi,    d = d,         e = e/~bi,    f = f*~bi ],/*50*/   [ a = a*~bi,    b = b/~bi,    c = c,         d = d,         e = e*~bi,    f = f/~bi ],/*51*/    [ a = a/~bi,    b = b,         c = c,         d = d/~bi,    e = e/~bi,    f = f*~bi ],/*52*/    [ a = a*~bi,    b = b,         c = c/~bi,    d = d*~bi,    e = e,         f = f/~bi ],/*53*/    [ a = a,         b = b*~bi,    c = c,         d = d,         e = e,         f = f ],/*54*/      [ a = a/~bi, b = b/~bi, c = c*~bi, d = d/~bi, e = e*~bi, f = f*~bi ],/*55*/     [ a = a,         b = b,         c = c,         d = d*~bi,    e = e/~bi,    f = f ],/*56*/       [ a = a*~bi,    b = b,         c = c,         d = d,         e = e,         f = f/~bi ],/*57*/  [ a = a,         b = b*~bi,    c = c/~bi,    d = d,         e = e*~bi,    f = f ],/*58*/        [ a = a/~bi,    b = b,         c = c*~bi,    d = d/~bi,    e = e,         f = f*~bi ],/*59*/    [ a = a*~bi,    b = b,         c = c/~bi,    d = d,         e = e,         f = f/~bi ],/*60*/   [ a = a/~bi,    b = b,         c = c,         d = d,         e = e,         f = f*~bi ],/*61*/  [ a = a*~bi,    b = b,         c = c,         d = d,         e = e,         f = f ],/*62*/      [ a = a/~bi, b = b/~bi, c = c*~bi, d = d*~bi, e = e/~bi, f = f/~bi ],/*63*/     [ a = a,         b = b*~bi,    c = c/~bi,    d = d,         e = e,         f = f*~bi ],/*64*/   [ a = a*~bi, b = b/~bi, c = c*~bi, d = d/~bi, e = e*~bi, f = f/~bi ]]};
304         ~kws_setting_1_b = {[/*1*/      [ a = a*~n1,         b = b*~n1*~bi,    c = c*~n1,         d = d*~n1*~bi,    e = e*~n1,         f = f*~n1*~bi ],/*2*/    [ a = a/~bi, b = b/~bi, c = c/~bi, d = d/~bi, e = e/~bi, f = f/~bi ],/*3*/      [ a = a,         b = b*~bi,    c = c,         d = d,         e = e,         f = f*~bi  ],/*4*/  [ a = a*~bi,    b = b/~bi,    c = c,         d = d,         e = e*~bi,    f = f/~bi  ],/*5*/    [ a = a/~bi,    b = b*~bi,    c = c,         d = d*~bi,    e = e,         f = f*~bi ],/*6*/     [ a = a*~bi,    b = b,         c = c*~bi,    d = d/~bi,    e = e,         f = f/~bi  ],/*7*/    [ a = a/~bi,    b = b/~bi,    c = c/~bi,    d = d,         e = e,         f = f ],/*8*/ [ a = a,         b = b*~bi,    c = c,         d = d,         e = e/~bi,    f = f ],/*9*/        [ a = a*~bi,    b = b,         c = c,         d = d*~bi,    e = e*~bi,    f = f*~bi ],/*10*/    [ a = a,         b = b,         c = c*~bi,    d = d/~bi,    e = e,         f = f ],/*11*/       [ a = a/~bi,    b = b/~bi,    c = c/~bi,    d = d*~bi,    e = e,         f = f ],/*12*/ [ a = a*~bi, b = b*~bi, c = c*~bi, d = d/~bi, e = e/~bi, f = f/~bi ],/*13*/     [ a = a,         b = b,         c = c,         d = d*~bi,    e = e,         f = f*~bi ],/*14*/  [ a = a,         b = b/~bi,    c = c,         d = d,         e = e*~bi,    f = f],/*15*/        [ a = a/~bi,    b = b,         c = c/~bi,    d = d,         e = e/~bi,    f = f/~bi ],/*16*/    [ a = a,         b = b,         c = c*~bi,    d = d/~bi,    e = e,         f = f ],/*17*/       [ a = a,         b = b*~bi,    c = c,         d = d,         e = e,         f = f*~bi],/*18*/   [ a = a*~bi, b = b/~bi, c = c/~bi, d = d*~bi, e = e*~bi, f = f/~bi ],/*19*/     [ a = a/~bi,    b = b,         c = c,         d = d/~bi,    e = e,         f = f*~bi ],/*20*/   [ a = a*~bi,    b = b*~bi,    c = c,         d = d,         e = e/~bi,    f = f/~bi ],/*21*/    [ a = a,         b = b/~bi,    c = c*~bi,    d = d,         e = e,         f = f*~bi ],/*22*/   [ a = a,         b = b,         c = c/~bi,    d = d*~bi,    e = e,         f = f ],/*23*/       [ a = a,         b = b,         c = c,         d = d/~bi,    e = e,         f = f/~bi ],/*24*/  [ a = a/~bi,    b = b,         c = c,         d = d,         e = e,         f = f*~bi ],/*25*/  [ a = a*~bi,    b = b*~bi,    c = c*~bi,    d = d,         e = e,         f = f ],/*26*/        [ a = a,         b = b/~bi,    c = c/~bi,    d = d*~bi,    e = e*~bi,    f = f ],/*27*/ [ a = a,         b = b,         c = c,         d = d/~bi,    e = e/~bi,    f = f ],/*28*/       [ a = a/~bi, b = b*~bi, c = c*~bi, d = d*~bi, e = e*~bi, f = f/~bi ],/*29*/     [ a = a,         b = b,         c = c/~bi,    d = d/~bi,    e = e,         f = f ],/*30*/       [ a = a*~bi, b = b/~bi, c = c*~bi, d = d*~bi, e = e/~bi, f = f*~bi ],/*31*/     [ a = a/~bi,    b = b*~bi,    c = c,         d = d,         e = e,         f = f/~bi ],/*32*/   [ a = a,         b = b/~bi,    c = c,         d = d,         e = e*~bi,    f = f ],/*33*/       [ a = a*~bi,    b = b*~bi,    c = c,         d = d,         e = e/~bi,    f = f ],/*34*/        [ a = a/~bi,    b = b/~bi,    c = c,         d = d,         e = e*~bi,    f = f*~bi ],/*35*/    [ a = a*~bi,    b = b,         c = c,         d = d/~bi,    e = e/~bi,    f = f/~bi ],/*36*/    [ a = a/~bi,    b = b,         c = c/~bi,    d = d*~bi,    e = e,         f = f*~bi ],/*37*/    [ a = a*~bi,    b = b*~bi,    c = c,         d = d,         e = e,         f = f ],/*38*/       [ a = a,         b = b/~bi,    c = c*~bi,    d = d/~bi,    e = e*~bi,    f = f ],/*39*/ [ a = a/~bi, b = b*~bi, c = c/~bi, d = d*~bi, e = e/~bi, f = f/~bi ],/*40*/     [ a = a,         b = b/~bi,    c = c*~bi,    d = d/~bi,    e = e*~bi,    f = f ],/*41*/ [ a = a*~bi,    b = b,         c = c/~bi,    d = d,         e = e,         f = f*~bi ],/*42*/   [ a = a,         b = b*~bi,    c = c,         d = d,         e = e/~bi,    f = f ],/*43*/       [ a = a/~bi,    b = b,         c = c*~bi,    d = d*~bi,    e = e*~bi,    f = f ],/*44*/ [ a = a*~bi,    b = b,         c = c,         d = d,         e = e,         f = f/~bi ],/*45*/  [ a = a/~bi,    b = b,         c = c,         d = d/~bi,    e = e/~bi,    f = f ],/*46*/        [ a = a,         b = b/~bi,    c = c/~bi,    d = d*~bi,    e = e*~bi,    f = f ],/*47*/ [ a = a,         b = b*~bi,    c = c*~bi,    d = d/~bi,    e = e,         f = f ],/*48*/        [ a = a,         b = b,         c = c/~bi,    d = d*~bi,    e = e,         f = f ],/*49*/       [ a = a,         b = b,         c = c*~bi,    d = d,         e = e/~bi,    f = f*~bi ],/*50*/   [ a = a*~bi,    b = b/~bi,    c = c,         d = d,         e = e*~bi,    f = f/~bi ],/*51*/    [ a = a/~bi,    b = b,         c = c,         d = d/~bi,    e = e/~bi,    f = f*~bi ],/*52*/    [ a = a*~bi,    b = b,         c = c/~bi,    d = d*~bi,    e = e,         f = f/~bi ],/*53*/    [ a = a,         b = b*~bi,    c = c,         d = d,         e = e,         f = f ],/*54*/      [ a = a/~bi, b = b/~bi, c = c*~bi, d = d/~bi, e = e*~bi, f = f*~bi ],/*55*/     [ a = a,         b = b,         c = c,         d = d*~bi,    e = e/~bi,    f = f ],/*56*/       [ a = a*~bi,    b = b,         c = c,         d = d,         e = e,         f = f/~bi ],/*57*/  [ a = a,         b = b*~bi,    c = c/~bi,    d = d,         e = e*~bi,    f = f ],/*58*/        [ a = a/~bi,    b = b,         c = c*~bi,    d = d/~bi,    e = e,         f = f*~bi ],/*59*/    [ a = a*~bi,    b = b,         c = c/~bi,    d = d,         e = e,         f = f/~bi ],/*60*/   [ a = a/~bi,    b = b,         c = c,         d = d,         e = e,         f = f*~bi ],/*61*/  [ a = a*~bi,    b = b,         c = c,         d = d,         e = e,         f = f ],/*62*/      [ a = a/~bi, b = b/~bi, c = c*~bi, d = d*~bi, e = e/~bi, f = f/~bi ],/*63*/     [ a = a,         b = b*~bi,    c = c/~bi,    d = d,         e = e,         f = f*~bi ],/*64*/   [ a = a*~bi, b = b/~bi, c = c*~bi, d = d/~bi, e = e*~bi, f = f/~bi ]]};
305
306         ~kws_setting_2_a = {[/*1*/      #a,b,c,d,e,f=[ ~a,~b,~c,~d,~e,~f  ],/*2*/       [ a = a*~n1/~bi, b = b*~n1/~bi, c = c*~n1/~bi, d = d*~n1/~bi, e = e*~n1/~bi, f = f*~n1/~bi ],/*3*/      [ a = a,         b = b*~bi,    c = c,         d = d,         e = e,         f = f*~bi    ],/*4*/        [ a = a*~bi,    b = b/~bi,    c = c,         d = d,         e = e*~bi,    f = f/~bi    ],/*5*/  [ a = a/~bi,    b = b*~bi,    c = c,         d = d*~bi,    e = e,         f = f*~bi    ],/*6*/  [ a = a*~bi,    b = b,         c = c*~bi,    d = d/~bi,    e = e,         f = f/~bi    ],/*7*/  [ a = a/~bi,    b = b/~bi,    c = c/~bi,    d = d,         e = e,         f = f         ],/*8*/ [ a = a,         b = b*~bi,    c = c,         d = d,         e = e/~bi,    f = f         ],/*9*/        [ a = a*~bi,    b = b,         c = c,         d = d*~bi,    e = e*~bi,    f = f*~bi    ],/*10*/ [ a = a,         b = b,         c = c*~bi,    d = d/~bi,    e = e,         f = f         ],/*11*/       [ a = a/~bi,    b = b/~bi,    c = c/~bi,    d = d*~bi,    e = e,         f = f         ],/*12*/ [ a = a*~n2*~bi, b = b*~n2*~bi, c = c*~n2*~bi, d = d*~n2/~bi, e = e*~n2/~bi, f = f*~n2/~bi ],/*13*/     [ a = a,         b = b,         c = c,         d = d*~bi,    e = e,         f = f*~bi    ],/*14*/       [ a = a,         b = b/~bi,    c = c,         d = d,         e = e*~bi,    f = f         ],/*15*/       [ a = a/~bi,    b = b,         c = c/~bi,    d = d,         e = e/~bi,    f = f/~bi    ],/*16*/ [ a = a,         b = b,         c = c*~bi,    d = d/~bi,    e = e,         f = f         ],/*17*/       [ a = a,         b = b*~bi,    c = c,         d = d,         e = e,         f = f*~bi    ],/*18*/       [ a = a*~n3*~bi, b = b*~n3/~bi, c = c*~n3/~bi, d = d*~n3*~bi, e = e*~n3*~bi, f = f*~n3/~bi ],/*19*/     [ a = a/~bi,    b = b,         c = c,         d = d/~bi,    e = e,         f = f*~bi    ],/*20*/        [ a = a*~bi,    b = b*~bi,    c = c,         d = d,         e = e/~bi,    f = f/~bi    ],/*21*/ [ a = a,         b = b/~bi,    c = c*~bi,    d = d,         e = e,         f = f*~bi    ],/*22*/        [ a = a,         b = b,         c = c/~bi,    d = d*~bi,    e = e,         f = f         ],/*23*/       [ a = a,         b = b,         c = c,         d = d/~bi,    e = e,         f = f/~bi    ],/*24*/       [ a = a/~bi,    b = b,         c = c,         d = d,         e = e,         f = f*~bi    ],/*25*/       [ a = a*~bi,    b = b*~bi,    c = c*~bi,    d = d,         e = e,         f = f         ],/*26*/        [ a = a,         b = b/~bi,    c = c/~bi,    d = d*~bi,    e = e*~bi,    f = f         ],/*27*/ [ a = a,         b = b,         c = c,         d = d/~bi,    e = e/~bi,    f = f         ],/*28*/       [ a = a*~n4/~bi, b = b*~n4*~bi, c = c*~n4*~bi, d = d*~n4*~bi, e = e*~n4*~bi, f = f*~n4/~bi ],/*29*/     [ a = a,         b = b,         c = c/~bi,    d = d/~bi,    e = e,         f = f         ],/*30*/       [ a = a*~n5*~bi, b = b*~n5/~bi, c = c*~n5*~bi, d = d*~n5*~bi, e = e*~n5/~bi, f = f*~n5*~bi ],/*31*/     [ a = a/~bi,    b = b*~bi,    c = c,         d = d,         e = e,         f = f/~bi    ],/*32*/        [ a = a,         b = b/~bi,    c = c,         d = d,         e = e*~bi,    f = f         ],/*33*/       [ a = a*~bi,    b = b*~bi,    c = c,         d = d,         e = e/~bi,    f = f         ],/*34*/        [ a = a/~bi,    b = b/~bi,    c = c,         d = d,         e = e*~bi,    f = f*~bi    ],/*35*/ [ a = a*~bi,    b = b,         c = c,         d = d/~bi,    e = e/~bi,    f = f/~bi    ],/*36*/ [ a = a/~bi,    b = b,         c = c/~bi,    d = d*~bi,    e = e,         f = f*~bi    ],/*37*/ [ a = a*~bi,    b = b*~bi,    c = c,         d = d,         e = e,         f = f         ],/*38*/       [ a = a,         b = b/~bi,    c = c*~bi,    d = d/~bi,    e = e*~bi,    f = f         ],/*39*/ [ a = a*~n6/~bi, b = b*~n6*~bi, c = c*~n6/~bi, d = d*~n6*~bi, e = e*~n6/~bi, f = f*~n6/~bi ],/*40*/     [ a = a,         b = b/~bi,    c = c*~bi,    d = d/~bi,    e = e*~bi,    f = f         ],/*41*/ [ a = a*~bi,    b = b,         c = c/~bi,    d = d,         e = e,         f = f*~bi    ],/*42*/        [ a = a,         b = b*~bi,    c = c,         d = d,         e = e/~bi,    f = f         ],/*43*/       [ a = a/~bi,    b = b,         c = c*~bi,    d = d*~bi,    e = e*~bi,    f = f         ],/*44*/ [ a = a*~bi,    b = b,         c = c,         d = d,         e = e,         f = f/~bi    ],/*45*/       [ a = a/~bi,    b = b,         c = c,         d = d/~bi,    e = e/~bi,    f = f         ],/*46*/        [ a = a,         b = b/~bi,    c = c/~bi,    d = d*~bi,    e = e*~bi,    f = f         ],/*47*/ [ a = a,         b = b*~bi,    c = c*~bi,    d = d/~bi,    e = e,         f = f         ],/*48*/        [ a = a,         b = b,         c = c/~bi,    d = d*~bi,    e = e,         f = f         ],/*49*/       [ a = a,         b = b,         c = c*~bi,    d = d,         e = e/~bi,    f = f*~bi    ],/*50*/        [ a = a*~bi,    b = b/~bi,    c = c,         d = d,         e = e*~bi,    f = f/~bi    ],/*51*/ [ a = a/~bi,    b = b,         c = c,         d = d/~bi,    e = e/~bi,    f = f*~bi    ],/*52*/ [ a = a*~bi,    b = b,         c = c/~bi,    d = d*~bi,    e = e,         f = f/~bi    ],/*53*/ [ a = a,         b = b*~bi,    c = c,         d = d,         e = e,         f = f         ],/*54*/      [ a = a*~n7/~bi, b = b*~n7/~bi, c = c*~n7*~bi, d = d*~n7/~bi, e = e*~n7*~bi, f = f*~n7*~bi ],/*55*/     [ a = a,         b = b,         c = c,         d = d*~bi,    e = e/~bi,    f = f         ],/*56*/       [ a = a*~bi,    b = b,         c = c,         d = d,         e = e,         f = f/~bi    ],/*57*/       [ a = a,         b = b*~bi,    c = c/~bi,    d = d,         e = e*~bi,    f = f         ],/*58*/        [ a = a/~bi,    b = b,         c = c*~bi,    d = d/~bi,    e = e,         f = f*~bi    ],/*59*/ [ a = a*~bi,    b = b,         c = c/~bi,    d = d,         e = e,         f = f/~bi    ],/*60*/        [ a = a/~bi,    b = b,         c = c,         d = d,         e = e,         f = f*~bi    ],/*61*/       [ a = a*~bi,    b = b,         c = c,         d = d,         e = e,         f = f         ],/*62*/      [ a = a*~n8/~bi, b = b*~n8/~bi, c = c*~n8*~bi, d = d*~n8*~bi, e = e*~n8/~bi, f = f*~n8/~bi ],/*63*/     [ a = a,         b = b*~bi,    c = c/~bi,    d = d,         e = e,         f = f*~bi    ],/*64*/        [ a = a*~n9*~bi, b = b*~n9/~bi, c = c*~n9*~bi, d = d*~n9/~bi, e = e*~n9*~bi, f = f*~n9/~bi ]]};
307         ~kws_setting_2_b = {[/*1*/      [ a = a,         b = b*~bi,    c = c,         d = d*~bi,    e = e,         f = f*~bi    ],/*2*/ [ a = a*~n1/~bi, b = b*~n1/~bi, c = c*~n1/~bi, d = d*~n1/~bi, e = e*~n1/~bi, f = f*~n1/~bi ],/*3*/      [ a = a,         b = b*~bi,    c = c,         d = d,         e = e,         f = f*~bi    ],/*4*/        [ a = a*~bi,    b = b/~bi,    c = c,         d = d,         e = e*~bi,    f = f/~bi    ],/*5*/  [ a = a/~bi,    b = b*~bi,    c = c,         d = d*~bi,    e = e,         f = f*~bi    ],/*6*/  [ a = a*~bi,    b = b,         c = c*~bi,    d = d/~bi,    e = e,         f = f/~bi    ],/*7*/  [ a = a/~bi,    b = b/~bi,    c = c/~bi,    d = d,         e = e,         f = f         ],/*8*/ [ a = a,         b = b*~bi,    c = c,         d = d,         e = e/~bi,    f = f         ],/*9*/        [ a = a*~bi,    b = b,         c = c,         d = d*~bi,    e = e*~bi,    f = f*~bi    ],/*10*/ [ a = a,         b = b,         c = c*~bi,    d = d/~bi,    e = e,         f = f         ],/*11*/       [ a = a/~bi,    b = b/~bi,    c = c/~bi,    d = d*~bi,    e = e,         f = f         ],/*12*/ [ a = a*~n2*~bi, b = b*~n2*~bi, c = c*~n2*~bi, d = d*~n2/~bi, e = e*~n2/~bi, f = f*~n2/~bi ],/*13*/     [ a = a,         b = b,         c = c,         d = d*~bi,    e = e,         f = f*~bi    ],/*14*/       [ a = a,         b = b/~bi,    c = c,         d = d,         e = e*~bi,    f = f         ],/*15*/       [ a = a/~bi,    b = b,         c = c/~bi,    d = d,         e = e/~bi,    f = f/~bi    ],/*16*/ [ a = a,         b = b,         c = c*~bi,    d = d/~bi,    e = e,         f = f         ],/*17*/       [ a = a,         b = b*~bi,    c = c,         d = d,         e = e,         f = f*~bi    ],/*18*/       [ a = a*~n3*~bi, b = b*~n3/~bi, c = c*~n3/~bi, d = d*~n3*~bi, e = e*~n3*~bi, f = f*~n3/~bi ],/*19*/     [ a = a/~bi,    b = b,         c = c,         d = d/~bi,    e = e,         f = f*~bi    ],/*20*/        [ a = a*~bi,    b = b*~bi,    c = c,         d = d,         e = e/~bi,    f = f/~bi    ],/*21*/ [ a = a,         b = b/~bi,    c = c*~bi,    d = d,         e = e,         f = f*~bi    ],/*22*/        [ a = a,         b = b,         c = c/~bi,    d = d*~bi,    e = e,         f = f         ],/*23*/       [ a = a,         b = b,         c = c,         d = d/~bi,    e = e,         f = f/~bi    ],/*24*/       [ a = a/~bi,    b = b,         c = c,         d = d,         e = e,         f = f*~bi    ],/*25*/       [ a = a*~bi,    b = b*~bi,    c = c*~bi,    d = d,         e = e,         f = f         ],/*26*/        [ a = a,         b = b/~bi,    c = c/~bi,    d = d*~bi,    e = e*~bi,    f = f         ],/*27*/ [ a = a,         b = b,         c = c,         d = d/~bi,    e = e/~bi,    f = f         ],/*28*/       [ a = a*~n4/~bi, b = b*~n4*~bi, c = c*~n4*~bi, d = d*~n4*~bi, e = e*~n4*~bi, f = f*~n4/~bi ],/*29*/     [ a = a,         b = b,         c = c/~bi,    d = d/~bi,    e = e,         f = f         ],/*30*/       [ a = a*~n5*~bi, b = b*~n5/~bi, c = c*~n5*~bi, d = d*~n5*~bi, e = e*~n5/~bi, f = f*~n5*~bi ],/*31*/     [ a = a/~bi,    b = b*~bi,    c = c,         d = d,         e = e,         f = f/~bi    ],/*32*/        [ a = a,         b = b/~bi,    c = c,         d = d,         e = e*~bi,    f = f         ],/*33*/       [ a = a*~bi,    b = b*~bi,    c = c,         d = d,         e = e/~bi,    f = f         ],/*34*/        [ a = a/~bi,    b = b/~bi,    c = c,         d = d,         e = e*~bi,    f = f*~bi    ],/*35*/ [ a = a*~bi,    b = b,         c = c,         d = d/~bi,    e = e/~bi,    f = f/~bi    ],/*36*/ [ a = a/~bi,    b = b,         c = c/~bi,    d = d*~bi,    e = e,         f = f*~bi    ],/*37*/ [ a = a*~bi,    b = b*~bi,    c = c,         d = d,         e = e,         f = f         ],/*38*/       [ a = a,         b = b/~bi,    c = c*~bi,    d = d/~bi,    e = e*~bi,    f = f         ],/*39*/ [ a = a*~n6/~bi, b = b*~n6*~bi, c = c*~n6/~bi, d = d*~n6*~bi, e = e*~n6/~bi, f = f*~n6/~bi ],/*40*/     [ a = a,         b = b/~bi,    c = c*~bi,    d = d/~bi,    e = e*~bi,    f = f         ],/*41*/ [ a = a*~bi,    b = b,         c = c/~bi,    d = d,         e = e,         f = f*~bi    ],/*42*/        [ a = a,         b = b*~bi,    c = c,         d = d,         e = e/~bi,    f = f         ],/*43*/       [ a = a/~bi,    b = b,         c = c*~bi,    d = d*~bi,    e = e*~bi,    f = f         ],/*44*/ [ a = a*~bi,    b = b,         c = c,         d = d,         e = e,         f = f/~bi    ],/*45*/       [ a = a/~bi,    b = b,         c = c,         d = d/~bi,    e = e/~bi,    f = f         ],/*46*/        [ a = a,         b = b/~bi,    c = c/~bi,    d = d*~bi,    e = e*~bi,    f = f         ],/*47*/ [ a = a,         b = b*~bi,    c = c*~bi,    d = d/~bi,    e = e,         f = f         ],/*48*/        [ a = a,         b = b,         c = c/~bi,    d = d*~bi,    e = e,         f = f         ],/*49*/       [ a = a,         b = b,         c = c*~bi,    d = d,         e = e/~bi,    f = f*~bi    ],/*50*/        [ a = a*~bi,    b = b/~bi,    c = c,         d = d,         e = e*~bi,    f = f/~bi    ],/*51*/ [ a = a/~bi,    b = b,         c = c,         d = d/~bi,    e = e/~bi,    f = f*~bi    ],/*52*/ [ a = a*~bi,    b = b,         c = c/~bi,    d = d*~bi,    e = e,         f = f/~bi    ],/*53*/ [ a = a,         b = b*~bi,    c = c,         d = d,         e = e,         f = f         ],/*54*/      [ a = a*~n7/~bi, b = b*~n7/~bi, c = c*~n7*~bi, d = d*~n7/~bi, e = e*~n7*~bi, f = f*~n7*~bi ],/*55*/     [ a = a,         b = b,         c = c,         d = d*~bi,    e = e/~bi,    f = f         ],/*56*/       [ a = a*~bi,    b = b,         c = c,         d = d,         e = e,         f = f/~bi    ],/*57*/       [ a = a,         b = b*~bi,    c = c/~bi,    d = d,         e = e*~bi,    f = f         ],/*58*/        [ a = a/~bi,    b = b,         c = c*~bi,    d = d/~bi,    e = e,         f = f*~bi    ],/*59*/ [ a = a*~bi,    b = b,         c = c/~bi,    d = d,         e = e,         f = f/~bi    ],/*60*/        [ a = a/~bi,    b = b,         c = c,         d = d,         e = e,         f = f*~bi    ],/*61*/       [ a = a*~bi,    b = b,         c = c,         d = d,         e = e,         f = f         ],/*62*/      [ a = a*~n8/~bi, b = b*~n8/~bi, c = c*~n8*~bi, d = d*~n8*~bi, e = e*~n8/~bi, f = f*~n8/~bi ],/*63*/     [ a = a,         b = b*~bi,    c = c/~bi,    d = d,         e = e,         f = f*~bi    ],/*64*/        [ a = a*~n9*~bi, b = b*~n9/~bi, c = c*~n9*~bi, d = d*~n9/~bi, e = e*~n9*~bi, f = f*~n9/~bi ]]};
308
309         ~kws_setting_3_a = {[/*1*/      #a,b,c,d,e,f=[ ~a,~b,~c,~d,~e,~f  ],/*2*/       [ a = a*~n1/~bi,    b = b*~n1/~bi,    c = c*~n1/~bi,    d = d*~n1/~bi,    e = e*~n1/~bi,    f = f*~n1/~bi    ],/*3*/    [ a = a*~n1,         b = b*~n1*~bi,    c = c*~n1,         d = d*~n1,         e = e*~n1,         f = f*~n1*~bi    ],/*4*/        [ a = a*~n1*~bi,    b = b*~n1/~bi,    c = c*~n1,         d = d*~n1,         e = e*~n1*~bi,    f = f*~n1/~bi    ],/*5*/  [ a = a*~n1/~bi,    b = b*~n1*~bi,    c = c*~n1,         d = d*~n1*~bi,    e = e*~n1,         f = f*~n1*~bi    ],/*6*/  [ a = a*~n1*~bi,    b = b*~n1,         c = c*~n1*~bi,    d = d*~n1/~bi,    e = e*~n1,         f = f*~n1/~bi    ],/*7*/  [ a = a*~n1/~bi,    b = b*~n1/~bi,    c = c*~n1/~bi,    d = d*~n1,         e = e*~n1,         f = f*~n1         ],/*8*/ [ a = a*~n1,         b = b*~n1*~bi,    c = c*~n1,         d = d*~n1,         e = e*~n1/~bi,    f = f*~n1         ],/*9*/        [ a = a*~n1*~bi,    b = b*~n1,         c = c*~n1,         d = d*~n1*~bi,    e = e*~n1*~bi,    f = f*~n1*~bi    ],/*10*/ [ a = a*~n1,         b = b*~n1,         c = c*~n1*~bi,    d = d*~n1/~bi,    e = e*~n1,         f = f*~n1         ],/*11*/       [ a = a*~n1/~bi,    b = b*~n1/~bi,    c = c*~n1/~bi,    d = d*~n1*~bi,    e = e*~n1,         f = f*~n1         ],/*12*/ [ a = a*~n1*~bi,    b = b*~n1*~bi,    c = c*~n1*~bi,    d = d*~n1/~bi,    e = e*~n1/~bi,    f = f*~n1/~bi    ],/*13*/   [ a = a*~n1,         b = b*~n1,         c = c*~n1,         d = d*~n1*~bi,    e = e*~n1,         f = f*~n1*~bi    ],/*14*/       [ a = a*~n1,         b = b*~n1/~bi,    c = c*~n1,         d = d*~n1,         e = e*~n1*~bi,    f = f*~n1         ],/*15*/       [ a = a*~n1/~bi,    b = b*~n1,         c = c*~n1/~bi,    d = d*~n1,         e = e*~n1/~bi,    f = f*~n1/~bi    ],/*16*/ [ a = a*~n1,         b = b*~n1,         c = c*~n1*~bi,    d = d*~n1/~bi,    e = e*~n1,         f = f*~n1         ],/*17*/       [ a = a*~n1,         b = b*~n1*~bi,    c = c*~n1,         d = d*~n1,         e = e*~n1,         f = f*~n1*~bi    ],/*18*/       [ a = a*~n1*~bi,    b = b*~n1/~bi,    c = c*~n1/~bi,    d = d*~n1*~bi,    e = e*~n1*~bi,    f = f*~n1/~bi    ],/*19*/   [ a = a*~n1/~bi,    b = b*~n1,         c = c*~n1,         d = d*~n1/~bi,    e = e*~n1,         f = f*~n1*~bi    ],/*20*/        [ a = a*~n1*~bi,    b = b*~n1*~bi,    c = c*~n1,         d = d*~n1,         e = e*~n1/~bi,    f = f*~n1/~bi    ],/*21*/ [ a = a*~n1,         b = b*~n1/~bi,    c = c*~n1*~bi,    d = d*~n1,         e = e*~n1,         f = f*~n1*~bi    ],/*22*/        [ a = a*~n1,         b = b*~n1,         c = c*~n1/~bi,    d = d*~n1*~bi,    e = e*~n1,         f = f*~n1         ],/*23*/       [ a = a*~n1,         b = b*~n1,         c = c*~n1,         d = d*~n1/~bi,    e = e*~n1,         f = f*~n1/~bi    ],/*24*/       [ a = a*~n1/~bi,    b = b*~n1,         c = c*~n1,         d = d*~n1,         e = e*~n1,         f = f*~n1*~bi    ],/*25*/       [ a = a*~n1*~bi,    b = b*~n1*~bi,    c = c*~n1*~bi,    d = d*~n1,         e = e*~n1,         f = f*~n1         ],/*26*/        [ a = a*~n1,         b = b*~n1/~bi,    c = c*~n1/~bi,    d = d*~n1*~bi,    e = e*~n1*~bi,    f = f*~n1         ],/*27*/ [ a = a*~n1,         b = b*~n1,         c = c*~n1,         d = d*~n1/~bi,    e = e*~n1/~bi,    f = f*~n1         ],/*28*/       [ a = a*~n1/~bi,    b = b*~n1*~bi,    c = c*~n1*~bi,    d = d*~n1*~bi,    e = e*~n1*~bi,    f = f*~n1/~bi    ],/*29*/   [ a = a*~n1,         b = b*~n1,         c = c*~n1/~bi,    d = d*~n1/~bi,    e = e*~n1,         f = f*~n1         ],/*30*/       [ a = a*~n1*~bi,    b = b*~n1/~bi,    c = c*~n1*~bi,    d = d*~n1*~bi,    e = e*~n1/~bi,    f = f*~n1*~bi    ],/*31*/   [ a = a*~n1/~bi,    b = b*~n1*~bi,    c = c*~n1,         d = d*~n1,         e = e*~n1,         f = f*~n1/~bi    ],/*32*/        [ a = a*~n1,         b = b*~n1/~bi,    c = c*~n1,         d = d*~n1,         e = e*~n1*~bi,    f = f*~n1         ],/*33*/       [ a = a*~n1*~bi,    b = b*~n1*~bi,    c = c*~n1,         d = d*~n1,         e = e*~n1/~bi,    f = f*~n1         ],/*34*/        [ a = a*~n1/~bi,    b = b*~n1/~bi,    c = c*~n1,         d = d*~n1,         e = e*~n1*~bi,    f = f*~n1*~bi    ],/*35*/ [ a = a*~n1*~bi,    b = b*~n1,         c = c*~n1,         d = d*~n1/~bi,    e = e*~n1/~bi,    f = f*~n1/~bi    ],/*36*/ [ a = a*~n1/~bi,    b = b*~n1,         c = c*~n1/~bi,    d = d*~n1*~bi,    e = e*~n1,         f = f*~n1*~bi    ],/*37*/ [ a = a*~n1*~bi,    b = b*~n1*~bi,    c = c*~n1,         d = d*~n1,         e = e*~n1,         f = f*~n1         ],/*38*/       [ a = a*~n1,         b = b*~n1/~bi,    c = c*~n1*~bi,    d = d*~n1/~bi,    e = e*~n1*~bi,    f = f*~n1         ],/*39*/ [ a = a*~n1/~bi,    b = b*~n1*~bi,    c = c*~n1/~bi,    d = d*~n1*~bi,    e = e*~n1/~bi,    f = f*~n1/~bi    ],/*40*/   [ a = a*~n1,         b = b*~n1/~bi,    c = c*~n1*~bi,    d = d*~n1/~bi,    e = e*~n1*~bi,    f = f*~n1         ],/*41*/ [ a = a*~n1*~bi,    b = b*~n1,         c = c*~n1/~bi,    d = d*~n1,         e = e*~n1,         f = f*~n1*~bi    ],/*42*/        [ a = a*~n1,         b = b*~n1*~bi,    c = c*~n1,         d = d*~n1,         e = e*~n1/~bi,    f = f*~n1         ],/*43*/       [ a = a*~n1/~bi,    b = b*~n1,         c = c*~n1*~bi,    d = d*~n1*~bi,    e = e*~n1*~bi,    f = f*~n1         ],/*44*/ [ a = a*~n1*~bi,    b = b*~n1,         c = c*~n1,         d = d*~n1,         e = e*~n1,         f = f*~n1/~bi    ],/*45*/       [ a = a*~n1/~bi,    b = b*~n1,         c = c*~n1,         d = d*~n1/~bi,    e = e*~n1/~bi,    f = f*~n1         ],/*46*/        [ a = a*~n1,         b = b*~n1/~bi,    c = c*~n1/~bi,    d = d*~n1*~bi,    e = e*~n1*~bi,    f = f*~n1         ],/*47*/ [ a = a*~n1,         b = b*~n1*~bi,    c = c*~n1*~bi,    d = d*~n1/~bi,    e = e*~n1,         f = f*~n1         ],/*48*/        [ a = a*~n1,         b = b*~n1,         c = c*~n1/~bi,    d = d*~n1*~bi,    e = e*~n1,         f = f*~n1         ],/*49*/       [ a = a*~n1,         b = b*~n1,         c = c*~n1*~bi,    d = d*~n1,         e = e*~n1/~bi,    f = f*~n1*~bi    ],/*50*/        [ a = a*~n1*~bi,    b = b*~n1/~bi,    c = c*~n1,         d = d*~n1,         e = e*~n1*~bi,    f = f*~n1/~bi    ],/*51*/ [ a = a*~n1/~bi,    b = b*~n1,         c = c*~n1,         d = d*~n1/~bi,    e = e*~n1/~bi,    f = f*~n1*~bi    ],/*52*/ [ a = a*~n1*~bi,    b = b*~n1,         c = c*~n1/~bi,    d = d*~n1*~bi,    e = e*~n1,         f = f*~n1/~bi    ],/*53*/ [ a = a*~n1,         b = b*~n1*~bi,    c = c*~n1,         d = d*~n1,         e = e*~n1,         f = f*~n1         ],/*54*/      [ a = a*~n1/~bi,    b = b*~n1/~bi,    c = c*~n1*~bi,    d = d*~n1/~bi,    e = e*~n1*~bi,    f = f*~n1*~bi    ],/*55*/   [ a = a*~n1,         b = b*~n1,         c = c*~n1,         d = d*~n1*~bi,    e = e*~n1/~bi,    f = f*~n1         ],/*56*/       [ a = a*~n1*~bi,    b = b*~n1,         c = c*~n1,         d = d*~n1,         e = e*~n1,         f = f*~n1/~bi    ],/*57*/       [ a = a*~n1,         b = b*~n1*~bi,    c = c*~n1/~bi,    d = d*~n1,         e = e*~n1*~bi,    f = f*~n1         ],/*58*/        [ a = a*~n1/~bi,    b = b*~n1,         c = c*~n1*~bi,    d = d*~n1/~bi,    e = e*~n1,         f = f*~n1*~bi    ],/*59*/ [ a = a*~n1*~bi,    b = b*~n1,         c = c*~n1/~bi,    d = d*~n1,         e = e*~n1,         f = f*~n1/~bi    ],/*60*/        [ a = a*~n1/~bi,    b = b*~n1,         c = c*~n1,         d = d*~n1,         e = e*~n1,         f = f*~n1*~bi    ],/*61*/       [ a = a*~n1*~bi,    b = b*~n1,         c = c*~n1,         d = d*~n1,         e = e*~n1,         f = f*~n1         ],/*62*/      [ a = a*~n1/~bi,    b = b*~n1/~bi,    c = c*~n1*~bi,    d = d*~n1*~bi,    e = e*~n1/~bi,    f = f*~n1/~bi    ],/*63*/   [ a = a*~n1,         b = b*~n1*~bi,    c = c*~n1/~bi,    d = d*~n1,         e = e*~n1,         f = f*~n1*~bi    ],/*64*/        [ a = a*~n1*~bi,    b = b*~n1/~bi,    c = c*~n1*~bi,    d = d*~n1/~bi,    e = e*~n1*~bi,    f = f*~n1/~bi    ]]};
310         ~kws_setting_3_b = {[/*1*/      [ a = a*~n1,         b = b*~n1*~bi,    c = c*~n1,         d = d*~n1*~bi,    e = e*~n1,         f = f*~n1*~bi    ],/*2*/ [ a = a*~n1/~bi,    b = b*~n1/~bi,    c = c*~n1/~bi,    d = d*~n1/~bi,    e = e*~n1/~bi,    f = f*~n1/~bi    ],/*3*/    [ a = a*~n1,         b = b*~n1*~bi,    c = c*~n1,         d = d*~n1,         e = e*~n1,         f = f*~n1*~bi    ],/*4*/        [ a = a*~n1*~bi,    b = b*~n1/~bi,    c = c*~n1,         d = d*~n1,         e = e*~n1*~bi,    f = f*~n1/~bi    ],/*5*/  [ a = a*~n1/~bi,    b = b*~n1*~bi,    c = c*~n1,         d = d*~n1*~bi,    e = e*~n1,         f = f*~n1*~bi    ],/*6*/  [ a = a*~n1*~bi,    b = b*~n1,         c = c*~n1*~bi,    d = d*~n1/~bi,    e = e*~n1,         f = f*~n1/~bi    ],/*7*/  [ a = a*~n1/~bi,    b = b*~n1/~bi,    c = c*~n1/~bi,    d = d*~n1,         e = e*~n1,         f = f*~n1         ],/*8*/ [ a = a*~n1,         b = b*~n1*~bi,    c = c*~n1,         d = d*~n1,         e = e*~n1/~bi,    f = f*~n1         ],/*9*/        [ a = a*~n1*~bi,    b = b*~n1,         c = c*~n1,         d = d*~n1*~bi,    e = e*~n1*~bi,    f = f*~n1*~bi    ],/*10*/ [ a = a*~n1,         b = b*~n1,         c = c*~n1*~bi,    d = d*~n1/~bi,    e = e*~n1,         f = f*~n1         ],/*11*/       [ a = a*~n1/~bi,    b = b*~n1/~bi,    c = c*~n1/~bi,    d = d*~n1*~bi,    e = e*~n1,         f = f*~n1         ],/*12*/ [ a = a*~n1*~bi,    b = b*~n1*~bi,    c = c*~n1*~bi,    d = d*~n1/~bi,    e = e*~n1/~bi,    f = f*~n1/~bi    ],/*13*/   [ a = a*~n1,         b = b*~n1,         c = c*~n1,         d = d*~n1*~bi,    e = e*~n1,         f = f*~n1*~bi    ],/*14*/       [ a = a*~n1,         b = b*~n1/~bi,    c = c*~n1,         d = d*~n1,         e = e*~n1*~bi,    f = f*~n1         ],/*15*/       [ a = a*~n1/~bi,    b = b*~n1,         c = c*~n1/~bi,    d = d*~n1,         e = e*~n1/~bi,    f = f*~n1/~bi    ],/*16*/ [ a = a*~n1,         b = b*~n1,         c = c*~n1*~bi,    d = d*~n1/~bi,    e = e*~n1,         f = f*~n1         ],/*17*/       [ a = a*~n1,         b = b*~n1*~bi,    c = c*~n1,         d = d*~n1,         e = e*~n1,         f = f*~n1*~bi    ],/*18*/       [ a = a*~n1*~bi,    b = b*~n1/~bi,    c = c*~n1/~bi,    d = d*~n1*~bi,    e = e*~n1*~bi,    f = f*~n1/~bi    ],/*19*/   [ a = a*~n1/~bi,    b = b*~n1,         c = c*~n1,         d = d*~n1/~bi,    e = e*~n1,         f = f*~n1*~bi    ],/*20*/        [ a = a*~n1*~bi,    b = b*~n1*~bi,    c = c*~n1,         d = d*~n1,         e = e*~n1/~bi,    f = f*~n1/~bi    ],/*21*/ [ a = a*~n1,         b = b*~n1/~bi,    c = c*~n1*~bi,    d = d*~n1,         e = e*~n1,         f = f*~n1*~bi    ],/*22*/        [ a = a*~n1,         b = b*~n1,         c = c*~n1/~bi,    d = d*~n1*~bi,    e = e*~n1,         f = f*~n1         ],/*23*/       [ a = a*~n1,         b = b*~n1,         c = c*~n1,         d = d*~n1/~bi,    e = e*~n1,         f = f*~n1/~bi    ],/*24*/       [ a = a*~n1/~bi,    b = b*~n1,         c = c*~n1,         d = d*~n1,         e = e*~n1,         f = f*~n1*~bi    ],/*25*/       [ a = a*~n1*~bi,    b = b*~n1*~bi,    c = c*~n1*~bi,    d = d*~n1,         e = e*~n1,         f = f*~n1         ],/*26*/        [ a = a*~n1,         b = b*~n1/~bi,    c = c*~n1/~bi,    d = d*~n1*~bi,    e = e*~n1*~bi,    f = f*~n1         ],/*27*/ [ a = a*~n1,         b = b*~n1,         c = c*~n1,         d = d*~n1/~bi,    e = e*~n1/~bi,    f = f*~n1         ],/*28*/       [ a = a*~n1/~bi,    b = b*~n1*~bi,    c = c*~n1*~bi,    d = d*~n1*~bi,    e = e*~n1*~bi,    f = f*~n1/~bi    ],/*29*/   [ a = a*~n1,         b = b*~n1,         c = c*~n1/~bi,    d = d*~n1/~bi,    e = e*~n1,         f = f*~n1         ],/*30*/       [ a = a*~n1*~bi,    b = b*~n1/~bi,    c = c*~n1*~bi,    d = d*~n1*~bi,    e = e*~n1/~bi,    f = f*~n1*~bi    ],/*31*/   [ a = a*~n1/~bi,    b = b*~n1*~bi,    c = c*~n1,         d = d*~n1,         e = e*~n1,         f = f*~n1/~bi    ],/*32*/        [ a = a*~n1,         b = b*~n1/~bi,    c = c*~n1,         d = d*~n1,         e = e*~n1*~bi,    f = f*~n1         ],/*33*/       [ a = a*~n1*~bi,    b = b*~n1*~bi,    c = c*~n1,         d = d*~n1,         e = e*~n1/~bi,    f = f*~n1         ],/*34*/        [ a = a*~n1/~bi,    b = b*~n1/~bi,    c = c*~n1,         d = d*~n1,         e = e*~n1*~bi,    f = f*~n1*~bi    ],/*35*/ [ a = a*~n1*~bi,    b = b*~n1,         c = c*~n1,         d = d*~n1/~bi,    e = e*~n1/~bi,    f = f*~n1/~bi    ],/*36*/ [ a = a*~n1/~bi,    b = b*~n1,         c = c*~n1/~bi,    d = d*~n1*~bi,    e = e*~n1,         f = f*~n1*~bi    ],/*37*/ [ a = a*~n1*~bi,    b = b*~n1*~bi,    c = c*~n1,         d = d*~n1,         e = e*~n1,         f = f*~n1         ],/*38*/       [ a = a*~n1,         b = b*~n1/~bi,    c = c*~n1*~bi,    d = d*~n1/~bi,    e = e*~n1*~bi,    f = f*~n1         ],/*39*/ [ a = a*~n1/~bi,    b = b*~n1*~bi,    c = c*~n1/~bi,    d = d*~n1*~bi,    e = e*~n1/~bi,    f = f*~n1/~bi    ],/*40*/   [ a = a*~n1,         b = b*~n1/~bi,    c = c*~n1*~bi,    d = d*~n1/~bi,    e = e*~n1*~bi,    f = f*~n1         ],/*41*/ [ a = a*~n1*~bi,    b = b*~n1,         c = c*~n1/~bi,    d = d*~n1,         e = e*~n1,         f = f*~n1*~bi    ],/*42*/        [ a = a*~n1,         b = b*~n1*~bi,    c = c*~n1,         d = d*~n1,         e = e*~n1/~bi,    f = f*~n1         ],/*43*/       [ a = a*~n1/~bi,    b = b*~n1,         c = c*~n1*~bi,    d = d*~n1*~bi,    e = e*~n1*~bi,    f = f*~n1         ],/*44*/ [ a = a*~n1*~bi,    b = b*~n1,         c = c*~n1,         d = d*~n1,         e = e*~n1,         f = f*~n1/~bi    ],/*45*/       [ a = a*~n1/~bi,    b = b*~n1,         c = c*~n1,         d = d*~n1/~bi,    e = e*~n1/~bi,    f = f*~n1         ],/*46*/        [ a = a*~n1,         b = b*~n1/~bi,    c = c*~n1/~bi,    d = d*~n1*~bi,    e = e*~n1*~bi,    f = f*~n1         ],/*47*/ [ a = a*~n1,         b = b*~n1*~bi,    c = c*~n1*~bi,    d = d*~n1/~bi,    e = e*~n1,         f = f*~n1         ],/*48*/        [ a = a*~n1,         b = b*~n1,         c = c*~n1/~bi,    d = d*~n1*~bi,    e = e*~n1,         f = f*~n1         ],/*49*/       [ a = a*~n1,         b = b*~n1,         c = c*~n1*~bi,    d = d*~n1,         e = e*~n1/~bi,    f = f*~n1*~bi    ],/*50*/        [ a = a*~n1*~bi,    b = b*~n1/~bi,    c = c*~n1,         d = d*~n1,         e = e*~n1*~bi,    f = f*~n1/~bi    ],/*51*/ [ a = a*~n1/~bi,    b = b*~n1,         c = c*~n1,         d = d*~n1/~bi,    e = e*~n1/~bi,    f = f*~n1*~bi    ],/*52*/ [ a = a*~n1*~bi,    b = b*~n1,         c = c*~n1/~bi,    d = d*~n1*~bi,    e = e*~n1,         f = f*~n1/~bi    ],/*53*/ [ a = a*~n1,         b = b*~n1*~bi,    c = c*~n1,         d = d*~n1,         e = e*~n1,         f = f*~n1         ],/*54*/      [ a = a*~n1/~bi,    b = b*~n1/~bi,    c = c*~n1*~bi,    d = d*~n1/~bi,    e = e*~n1*~bi,    f = f*~n1*~bi    ],/*55*/   [ a = a*~n1,         b = b*~n1,         c = c*~n1,         d = d*~n1*~bi,    e = e*~n1/~bi,    f = f*~n1         ],/*56*/       [ a = a*~n1*~bi,    b = b*~n1,         c = c*~n1,         d = d*~n1,         e = e*~n1,         f = f*~n1/~bi    ],/*57*/       [ a = a*~n1,         b = b*~n1*~bi,    c = c*~n1/~bi,    d = d*~n1,         e = e*~n1*~bi,    f = f*~n1         ],/*58*/        [ a = a*~n1/~bi,    b = b*~n1,         c = c*~n1*~bi,    d = d*~n1/~bi,    e = e*~n1,         f = f*~n1*~bi    ],/*59*/ [ a = a*~n1*~bi,    b = b*~n1,         c = c*~n1/~bi,    d = d*~n1,         e = e*~n1,         f = f*~n1/~bi    ],/*60*/        [ a = a*~n1/~bi,    b = b*~n1,         c = c*~n1,         d = d*~n1,         e = e*~n1,         f = f*~n1*~bi    ],/*61*/       [ a = a*~n1*~bi,    b = b*~n1,         c = c*~n1,         d = d*~n1,         e = e*~n1,         f = f*~n1         ],/*62*/      [ a = a*~n1/~bi,    b = b*~n1/~bi,    c = c*~n1*~bi,    d = d*~n1*~bi,    e = e*~n1/~bi,    f = f*~n1/~bi    ],/*63*/   [ a = a*~n1,         b = b*~n1*~bi,    c = c*~n1/~bi,    d = d*~n1,         e = e*~n1,         f = f*~n1*~bi    ],/*64*/        [ a = a*~n1*~bi,    b = b*~n1/~bi,    c = c*~n1*~bi,    d = d*~n1/~bi,    e = e*~n1*~bi,    f = f*~n1/~bi    ]]};
311
312
313         //synthdefs
314
315         ~gsine = {
316
317                 SynthDef(\gsineicfld1, {arg graindur = 0.04, dur = 2000, atk = 0.007, rel = 0.01, gate = 1, amp = 1, i = 1, vol = ~vol, rate = 20, tune = 0,dseqval,
318                         a, b, c, d, e, f, pan=0, fc = 1;
319                         var s1, out, env1, s2, dseq;
320                         9.do(x = 0; {("n"++(x=x+1)).asSymbol.envirPut(~n_value1)}); //for custom values replace "~n_value1" with "[a, b, c, d, etc...].at(x-1)" with the variable amount the same as the #.do value - for all synthdefs
321                         dseq = Dseq(
322                                 case
323                                 {~kws_setting == 1}{~kws_setting_1_a.value;}
324                                 {~kws_setting == 2}{~kws_setting_2_a.value;}
325                                 {~kws_setting == 3}{~kws_setting_3_a.value;} ++ Array.fill((~gsinenum*~first_harmonic -1), {
326                                         case
327                                         {~kws_setting == 1}{~kws_setting_1_b.value;}
328                                         {~kws_setting == 2}{~kws_setting_2_b.value;}
329                                         {~kws_setting == 3}{~kws_setting_3_b.value;}}).flatten, inf);
330                         s1 = GrainSin.ar(1, Impulse.ar(dur), 1/(dur),Demand.ar(Impulse.ar(dur), 0, dseq));
331                         if(~low_pass_filter_on == 1, {s1 = BLowPass.ar(s1, ~low_pass_filter_freq_limit);}, {s1 = s1});
332                         OffsetOut.ar(0, s1.dup*vol);
333                 }, [\ir]).add;
334
335                 SynthDef(\gsineicrld1, {arg graindur = 0.04, dur = 2000, atk = 0.007, rel = 0.01, gate = 1, amp = 1, i = 1, vol = ~vol, rate = 20, tune = 0,dseqval,
336                         a, b, c, d, e, f, pan=0, fc = 1, id = -1;
337                         var s1, out, env1, s2, dseq;
338                         9.do(x = 0; {("n"++(x=x+1)).asSymbol.envirPut(~n_value1)});
339                         dseq = Dseq([
340                                 case
341                                 {~kws_setting == 1}{~kws_setting_1_a.value;}
342                                 {~kws_setting == 2}{~kws_setting_2_a.value;}
343                                 {~kws_setting == 3}{~kws_setting_3_a.value;} ++ Array.fill((~gsinenum*~first_harmonic -1), {
344                                         case
345                                         {~kws_setting == 1}{~kws_setting_1_b.value;}
346                                         {~kws_setting == 2}{~kws_setting_2_b.value;}
347                                         {~kws_setting == 3}{~kws_setting_3_b.value;}}).flatten].flatten.reverse, inf);
348                         s1 = GrainSin.ar(1, Impulse.ar(dur), 1/(dur), Demand.ar(Impulse.ar(dur), 0, dseq));
349                         if(~low_pass_filter_on == 1, {s1 = BLowPass.ar(s1, ~low_pass_filter_freq_limit);}, {s1 = s1});
350                         OffsetOut.ar(0, s1.dup*vol);
351                 }, [\ir]).add;
352
353                 SynthDef(\gsineicfld2, {arg graindur = 0.04, dur = 2000, atk = 0.007, rel = 0.01, gate = 1, amp = 1, i = 1, vol = ~vol, rate = 20, tune = 0,dseqval,
354                         a, b, c, d, e, f, pan=0, fc = 1;
355                         var s1, out, env1, s2, dseq;
356                         9.do(x = 0; {("n"++(x=x+1)).asSymbol.envirPut(~n_value2)});
357                         dseq = Dseq(
358                                 case
359                                 {~kws_setting == 1}{~kws_setting_1_a.value;}
360                                 {~kws_setting == 2}{~kws_setting_2_a.value;}
361                                 {~kws_setting == 3}{~kws_setting_3_a.value;} ++ Array.fill((~gsinenum*~second_harmonic -1), {
362                                         case
363                                         {~kws_setting == 1}{~kws_setting_1_b.value;}
364                                         {~kws_setting == 2}{~kws_setting_2_b.value;}
365                                         {~kws_setting == 3}{~kws_setting_3_b.value;}}).flatten, inf);
366                         s1 = GrainSin.ar(1, Impulse.ar(dur), 1/(dur),Demand.ar(Impulse.ar(dur), 0, dseq));
367                         if(~low_pass_filter_on == 1, {s1 = BLowPass.ar(s1, ~low_pass_filter_freq_limit);}, {s1 = s1});
368                         OffsetOut.ar(0, s1.dup*vol);
369                 }, [\ir]).add;
370
371                 SynthDef(\gsineicrld2, {arg graindur = 0.04, dur = 2000, atk = 0.007, rel = 0.01, gate = 1, amp = 1, i = 1, vol = ~vol, rate = 20, tune = 0,dseqval,
372                         a, b, c, d, e, f, pan=0, fc = 1, id = -1;
373                         var s1, out, env1, s2, dseq;
374                         9.do(x = 0; {("n"++(x=x+1)).asSymbol.envirPut(~n_value2)});
375                         dseq = Dseq([
376                                 case
377                                 {~kws_setting == 1}{~kws_setting_1_a.value;}
378                                 {~kws_setting == 2}{~kws_setting_2_a.value;}
379                                 {~kws_setting == 3}{~kws_setting_3_a.value;} ++ Array.fill((~gsinenum*~second_harmonic -1), {
380                                         case
381                                         {~kws_setting == 1}{~kws_setting_1_b.value;}
382                                         {~kws_setting == 2}{~kws_setting_2_b.value;}
383                                         {~kws_setting == 3}{~kws_setting_3_b.value;}}).flatten].flatten.reverse, inf);
384                         s1 = GrainSin.ar(1, Impulse.ar(dur), 1/(dur), Demand.ar(Impulse.ar(dur), 0, dseq));
385                         if(~low_pass_filter_on == 1, {s1 = BLowPass.ar(s1, ~low_pass_filter_freq_limit);}, {s1 = s1});
386                         OffsetOut.ar(0, s1.dup*vol);
387                 }, [\ir]).add;
388
389                 SynthDef(\gsineicfld6, {arg graindur = 0.04, dur = 2000, atk = 0.007, rel = 0.01, gate = 1, amp = 1, i = 1, vol = ~vol, rate = 20, tune = 0,dseqval,
390                         a, b, c, d, e, f, pan=0, fc = 1;
391                         var s1, out, env1, s2, dseq;
392                         9.do(x = 0; {("n"++(x=x+1)).asSymbol.envirPut(~n_value6)});
393                         dseq = Dseq(
394                                 case
395                                 {~kws_setting == 1}{~kws_setting_1_a.value;}
396                                 {~kws_setting == 2}{~kws_setting_2_a.value;}
397                                 {~kws_setting == 3}{~kws_setting_3_a.value;} ++ Array.fill((~gsinenum*~third_harmonic -1), {
398                                         case
399                                         {~kws_setting == 1}{~kws_setting_1_b.value;}
400                                         {~kws_setting == 2}{~kws_setting_2_b.value;}
401                                         {~kws_setting == 3}{~kws_setting_3_b.value;}}).flatten, inf);
402                         s1 = GrainSin.ar(1, Impulse.ar(dur), 1/(dur),Demand.ar(Impulse.ar(dur), 0, dseq));
403                         if(~low_pass_filter_on == 1, {s1 = BLowPass.ar(s1, ~low_pass_filter_freq_limit);}, {s1 = s1});
404                         OffsetOut.ar(0, s1.dup*vol);
405                 }, [\ir]).add;
406
407                 SynthDef(\gsineicrld6, {arg graindur = 0.04, dur = 2000, atk = 0.007, rel = 0.01, gate = 1, amp = 1, i = 1, vol = ~vol, rate = 20, tune = 0,dseqval,
408                         a, b, c, d, e, f, pan=0, fc = 1;
409                         var s1, out, env1, s2, dseq;
410                         9.do(x = 0; {("n"++(x=x+1)).asSymbol.envirPut(~n_value6)});
411                         dseq = Dseq([
412                                 case
413                                 {~kws_setting == 1}{~kws_setting_1_a.value;}
414                                 {~kws_setting == 2}{~kws_setting_2_a.value;}
415                                 {~kws_setting == 3}{~kws_setting_3_a.value;} ++ Array.fill((~gsinenum*~third_harmonic -1), {
416                                         case
417                                         {~kws_setting == 1}{~kws_setting_1_b.value;}
418                                         {~kws_setting == 2}{~kws_setting_2_b.value;}
419                                         {~kws_setting == 3}{~kws_setting_3_b.value;}}).flatten].flatten.reverse, inf);
420                         s1 = GrainSin.ar(1, Impulse.ar(dur), 1/(dur), Demand.ar(Impulse.ar(dur), 0, dseq));
421                         if(~low_pass_filter_on == 1, {s1 = BLowPass.ar(s1, ~low_pass_filter_freq_limit);}, {s1 = s1});
422                         OffsetOut.ar(0, s1.dup*vol);
423                 }, [\ir]).add;
424
425                 if(~sendreplysynthdef_on == 1, {
426
427                         ~synthflow_random_sendreply_answer_f1 = '/synthflow_random_sendreply_answer_f1';
428                         ~synthflow_random_sendreply_answer_f2 = '/synthflow_random_sendreply_answer_f2';
429                         ~synthflow_random_sendreply_answer_f3 = '/synthflow_random_sendreply_answer_f3';
430
431                         3.do(~sendreply_x = 0; {
432
433                                 ~sendreply_x=~sendreply_x+1;
434
435                                 SynthDef(\gsineicfld1_f++(~sendreply_x), {arg graindur = 0.04, dur = 2000, atk = 0.007, rel = 0.01, gate = 1, amp = 1, i = 1, vol = ~vol, rate = 20, tune = 0,dseqval,
436                                         a, b, c, d, e, f, pan=0, fc = 1;
437                                         var s1, out, env1, s2, dseq;
438                                         9.do(x = 0; {("n"++(x=x+1)).asSymbol.envirPut(~n_value1)});
439                                         dseq = Dseq(
440                                                 case
441                                                 {~kws_setting == 1}{~kws_setting_1_a.value;}
442                                                 {~kws_setting == 2}{~kws_setting_2_a.value;}
443                                                 {~kws_setting == 3}{~kws_setting_3_a.value;} ++ Array.fill((~gsinenum*~first_harmonic -1), {
444                                                         case
445                                                         {~kws_setting == 1}{~kws_setting_1_b.value;}
446                                                         {~kws_setting == 2}{~kws_setting_2_b.value;}
447                                                         {~kws_setting == 3}{~kws_setting_3_b.value;}}).flatten, inf);
448                                         s1 = GrainSin.ar(1, Impulse.ar(dur), 1/(dur),Demand.ar(Impulse.ar(dur), 0, dseq));
449                                         if(~low_pass_filter_on == 1, {s1 = BLowPass.ar(s1, ~low_pass_filter_freq_limit);}, {s1 = s1});
450                                         OffsetOut.ar(0, s1.dup*vol);
451                                         SendReply.ar(PulseDivider.ar(Impulse.ar(dur), (~kws_setting_1_a.value.size*(~gsinenum*~first_harmonic))),
452                                                 case
453                                                 {~sendreplyfunc_choose == 0}{("synthflow_gmf_sendreply_answer_f"++(~sendreply_x)).asSymbol.envirGet;}
454                                                 {~sendreplyfunc_choose == 1}{("synthflow_random_sendreply_answer_f"++(~sendreply_x)).asSymbol.envirGet;};
455                                         );
456                                 }, [\ir]).add;
457
458                         });
459                 });
460         };
461
462
463         //sendreply functions
464
465         ~sendreplyfunc_choose = 0;
466
467         ~send_reply_random_func_western = {~freqmap.at(rrand(60, 91));};
468         ~send_reply_random_func_eastern = {(rrand(~freqmap.at(60), ~freqmap.at(91);))};
469
470         if(~sendreply_gm_fth_y_1 == nil, {3.do(x = 0; {("sendreply_gm_fth_y_"++(x=x+1)).asSymbol.envirPut((-1);)});});
471         ~sendreply_gm_fth_func_1 = {if((x <= 1539.4729849465) and: (x >= 256.86873684059), {
472                 x = x*[[a = 1.6842135623729, a = 0.5937489296732].choose, [a = 1.4142135623729, a = 0.70710678118665].choose].at(y=y+1); if(y>=1, {y=(-1)});
473
474         }, {
475                 if(x > 1539.4729849465, {
476                         case
477                         {(a == 1.6842135623729) or: (a == 0.5937489296732)}{x = x/2; x = x*[a = 1.4142135623729, a = 0.70710678118665].choose; y=y+1; if(y>=1, {y=(-1)});}
478                         {(a == 1.4142135623729) or: (a == 0.70710678118665)}{x = x/2; x = x*[a = 1.6842135623729, a = 0.5937489296732].choose; y=y+1; if(y>=1, {y=(-1)});};
479                 }, {
480                         case
481                         {(a == 1.6842135623729) or: (a == 0.5937489296732)}{x = x*2; x = x*[a = 1.4142135623729, a = 0.70710678118665].choose; y=y+1; if(y>=1, {y=(-1)});}
482                         {(a == 1.4142135623729) or: (a == 0.70710678118665)}{x = x*2; x = x*[a = 1.6842135623729, a = 0.5937489296732].choose; y=y+1; if(y>=1, {y=(-1)});};
483                 });
484         });
485         };
486         ~sendreply_gm_fth_func_2 = {if((x <= 1539.4729849465) and: (x >= 256.86873684059), {
487                 x = x*[a = 1.6842135623729, a = 0.5937489296732].choose;}, {
488                 if(x > 1539.4729849465, {x = x/2; x = x*[1.6842135623729, 0.5937489296732].choose;}, {x = x*2; x = x*[1.6842135623729, 0.5937489296732].choose;});
489         });
490         };
491         if(~sendreply_gm_fth_func == nil, {~sendreply_gm_fth_func = ~sendreply_gm_fth_func_1});
492
493         case
494         {~sendreplyfuncswitch == 1;}{~send_reply_random_func = ~send_reply_random_func_western;}
495         {~sendreplyfuncswitch == 2;}{~send_reply_random_func = ~send_reply_random_func_eastern;};
496
497         ~synthflow_random_sendreply_answer_f1 = '/synthflow_random_sendreply_answer_f1';
498         ~synthflow_random_sendreply_answer_f2 = '/synthflow_random_sendreply_answer_f2';
499         ~synthflow_random_sendreply_answer_f3 = '/synthflow_random_sendreply_answer_f3';
500
501         ~synthflow_gmf_sendreply_answer_f1 = '/synthflow_gmf_sendreply_answer_f1';
502         ~synthflow_gmf_sendreply_answer_f2 = '/synthflow_gmf_sendreply_answer_f2';
503         ~synthflow_gmf_sendreply_answer_f3 = '/synthflow_gmf_sendreply_answer_f3';
504
505         OSCFunc({~f1 = ~send_reply_random_func.value; AppClock.sched(0,{~synthflow.value;});}, '/synthflow_random_sendreply_answer_f1');
506         OSCFunc({~f2 = ~send_reply_random_func.value; AppClock.sched(0,{~synthflow.value;});}, '/synthflow_random_sendreply_answer_f2');
507         OSCFunc({~f3 = ~send_reply_random_func.value; AppClock.sched(0,{~synthflow.value;});}, '/synthflow_random_sendreply_answer_f3');
508
509         OSCFunc({x = ~f1; y = ~sendreply_gm_fth_y_1; ~sendreply_gm_fth_func.value; ~f1 = x; AppClock.sched(0,{~synthflow.value;}); ~sendreply_gm_fth_y_1 = y;}, '/synthflow_gmf_sendreply_answer_f1');
510         OSCFunc({x = ~f2; y = ~sendreply_gm_fth_y_2; ~sendreply_gm_fth_func.value; ~f2 = x; AppClock.sched(0,{~synthflow.value;}); ~sendreply_gm_fth_y_2 = y;}, '/synthflow_gmf_sendreply_answer_f2');
511         OSCFunc({x = ~f3; y = ~sendreply_gm_fth_y_3; ~sendreply_gm_fth_func.value; ~f3 = x; AppClock.sched(0,{~synthflow.value;}); ~sendreply_gm_fth_y_3 = y;}, '/synthflow_gmf_sendreply_answer_f3');
512
513
514         //set base (lowest) frequencies, set starting values for synthdef, and load synthdef on server boot
515
516         if((~gsinenum == nil) or: (~synthdef != "gsineicld"), {
517                 (
518                         if(~basefreq == nil, {~basefreq = ~base_frequency});
519                         ~fmult = 16;
520                         (#a,b,c,d,e,f = [ ~basefreq,~basefreq,~basefreq,~basefreq,~basefreq,~basefreq  ];
521                                 ~a = a; ~b = b; ~c =c; ~d = d; ~e = e;~f=f;);
522
523                         ~synthdef = "gsineicld"; ~gsinenum = ~synthdefnum;
524
525                         ~gsine.value;
526                 );
527         });
528
529
530         //generate GUI window
531
532         w = Window("Timewave Synth", Rect(0,0,Window.screenBounds.width,Window.screenBounds.height), border:true);
533
534         view = UserView(w, Window.screenBounds);
535         view.clearOnRefresh = false;
536         view.background = Color.black;
537
538         //vertical grid (inactive)
539
540         /*~b1 = Window.screenBounds.width/(12*4) /*25.462962962963*/; ~btu = 31; ~btd = 375; ~bw = 0.5; ~bh = 80; ~bcolor = Color.grey;
541         View(w, Rect(~b1, ~btu, ~bw, ~bh)).background = ~bcolor;
542         View(w, Rect(~b1, ~btd, ~bw, ~bh)).background = ~bcolor;
543         54.do({View(w, Rect(~b1 = ~b1+(Window.screenBounds.width/(12*4)), ~btu, ~bw, ~bh)).background = ~bcolor;});
544         ~b1 = Window.screenBounds.width/(12*4);
545         54.do({View(w, Rect(~b1 = ~b1+(Window.screenBounds.width/(12*4)), ~btd, ~bw, ~bh)).background = ~bcolor;});*/
546
547
548         //horizontal grid
549
550         ~nh = 2;
551         ~nw = ~nh*1.6180339887499;
552
553         ~tgrid = 30;
554         ~bgrid = Window.screenBounds.height-(Window.screenBounds.height/1.6180339887499)+30;
555
556         ~dc1 = ~tgrid-5; ~dc2 = ~bgrid-5; ~dca = 10;
557
558         4.do(x=~tgrid-10; {View(w, Rect(1, x=x+10, Window.screenBounds.width, 0.5)).background = Color.new255(51, 51, 51)});
559         4.do(x=~bgrid-10; {View(w, Rect(1, x=x+10, Window.screenBounds.width, 0.5)).background = Color.new255(51, 51, 51)});
560
561         ~z1 = (View(w, Rect((if(~f1 == nil, {f1.value},{~f1.value}).explin(~outmin1,~outmax1,0,Window.screenBounds.width)), ~dc1=~dc1+10, ~nw, 2)).background = Color.white;);
562         ~z2 = (View(w, Rect((if(~f2 == nil, {f2.value},{~f2.value}).explin(~outmin1,~outmax1,0,Window.screenBounds.width)), ~dc1=~dc1+10, ~nw, 2)).background = Color.white;);
563         ~z3 = (View(w, Rect((if(~f3 == nil, {f3.value},{~f3.value}).explin(~outmin1,~outmax1,0,Window.screenBounds.width)), ~dc1=~dc1+10, ~nw, 2)).background = Color.white;);
564         ~zmid = (View(w, Rect(x, 280, ~nw, 2)).background = Color.clear;);
565         ~z25 = (View(w, Rect((if(~f1 == nil, {f1.value},{~f1.value}).explin(~outmin2,~outmax2,0,Window.screenBounds.width)), ~dc2=~dc2+10, ~nw, 2)).background = Color.white;);
566         ~z26 = (View(w, Rect((if(~f2 == nil, {f2.value},{~f2.value}).explin(~outmin2,~outmax2,0,Window.screenBounds.width)), ~dc2=~dc2+10, ~nw, 2)).background = Color.white;);
567         ~z27 = (View(w, Rect((if(~f3 == nil, {f3.value},{~f3.value}).explin(~outmin2,~outmax2,0,Window.screenBounds.width)), ~dc2=~dc2+10, ~nw, 2)).background = Color.white;);
568
569         ~dc1 = ~tgrid-5; ~dc2 = ~bgrid-5; ~dca = 10;
570
571
572         //synth functions (open, flow, slide, pause, free)
573
574         ~synthopen = {
575                 case
576                 {((~l1a.isRunning == false) and: (~l1a1.isRunning == false)) or: ~l1a1.isRunning == true}{
577                         if(~l1a1.isRunning == true, {
578                                 (1.do({var vol1,vol2,vol3,s1,s2,s3,s4,s5,s6,f1,f2,f3;
579                                         #vol1,vol2,vol3 = [~vol1,~vol2,~vol3];
580                                         #f1,f2,f3 = [ 0,0,0 ];
581                                         s.makeBundle(0, {
582                                                 ~l1a1.set(\dur, f1,     \vol, vol1);  ~l1b1.set(\dur, f1,  \vol, vol1);
583                                                 ~l1c1.set(\dur, f1/~icd3,       \vol, vol1);  ~l1d1.set(\dur, f1/~icd3,  \vol, vol1);
584                                                 ~l1e1.set(\dur, f1/~icd6,       \vol, vol1);  ~l1f1.set(\dur, f1/~icd6,  \vol, vol1);
585                                                 ~l2a1.set(\dur, f2,     \vol, vol2);          ~l2b1.set(\dur, f2,  \vol, vol2);
586                                                 ~l2c1.set(\dur, f2/~icd3,       \vol, vol2);  ~l2d1.set(\dur, f2/~icd3,  \vol, vol2);
587                                                 ~l2e1.set(\dur, f2/~icd6,       \vol, vol2);  ~l2f1.set(\dur, f2/~icd6,  \vol, vol2);
588                                                 ~l3a1.set(\dur, f3,     \vol, vol3);          ~l3b1.set(\dur, f3,  \vol, vol3);
589                                                 ~l3c1.set(\dur, f3/~icd3,       \vol, vol3);  ~l3d1.set(\dur, f3/~icd3,  \vol, vol3);
590                                                 ~l3e1.set(\dur, f3/~icd6,       \vol, vol3);  ~l3f1.set(\dur, f3/~icd6,  \vol, vol3);
591                                         });
592                                 }););
593                         });
594
595                         (
596                                 1.do({var vol1,vol2,vol3,s1,s2,s3,s4,s5,s6,s5_1,s5_2,s5_3;
597                                         #vol1,vol2,vol3 = [~vol1,~vol2,~vol3];
598                                         #s1,s2,s3,s4,s5,s6 = [\gsineicfld6, \gsineicrld6, \gsineicfld2, \gsineicrld2, \gsineicfld1, \gsineicrld1];
599                                         case
600                                         {~sendreplysynthdef_on == 0}{#s5_1,s5_2,s5_3 = \gsineicfld1!3;}
601                                         {~sendreplysynthdef_on == 1}{#s5_1,s5_2,s5_3 =
602                                                 [\gsineicfld1_f1, \gsineicfld1_f2, \gsineicfld1_f3];};
603                                         s.makeBundle(0, {
604                                                 ~l1a = Synth(s1, [\dur, ~f1,    \vol, vol1]).register;    ~l1b = Synth(s2, [\dur, ~f1,    \vol, vol1]);
605                                                 ~l1c = Synth(s3, [\dur, ~f1/~icd3,  \vol, vol1]);   ~l1d = Synth(s4, [\dur, ~f1/~icd3,  \vol, vol1]);
606                                                 ~l1e = Synth(s5_1, [\dur, ~f1/~icd6,  \vol, vol1]);   ~l1f = Synth(s6, [\dur, ~f1/~icd6,  \vol, vol1]);
607                                                 ~l2a = Synth(s1, [\dur, ~f2,    \vol, vol2]);        ~l2b = Synth(s2, [\dur, ~f2,    \vol, vol2]);
608                                                 ~l2c = Synth(s3, [\dur, ~f2/~icd3,  \vol, vol2]);   ~l2d = Synth(s4, [\dur, ~f2/~icd3,  \vol, vol2]);
609                                                 ~l2e = Synth(s5_2, [\dur, ~f2/~icd6,  \vol, vol2]);   ~l2f = Synth(s6, [\dur, ~f2/~icd6,  \vol, vol2]);
610                                                 ~l3a = Synth(s1, [\dur, ~f3,    \vol, vol3]);        ~l3b = Synth(s2, [\dur, ~f3,   \vol, vol3]);
611                                                 ~l3c = Synth(s3, [\dur, ~f3/~icd3,  \vol, vol3]);   ~l3d = Synth(s4, [\dur, ~f3/~icd3, \vol, vol3]);
612                                                 ~l3e = Synth(s5_3, [\dur, ~f3/~icd6,  \vol, vol3]);   ~l3f = Synth(s6, [\dur, ~f3/~icd6, \vol, vol3]);
613                                         });
614                                 });
615                         );
616                         if(~l1a1.isRunning == true, {
617                                 AppClock.sched(0.161803398875,{
618                                         ([~l1a1,~l1b1,~l1c1,~l1d1,~l1e1,~l1f1,~l2a1,~l2b1,~l2c1,~l2d1,~l2e1,~l2f1,~l3a1,~l3b1,~l3c1,~l3d1,~l3e1,~l3f1 ].do(_.free)); ~slideroutine.stop;
619                                 });
620                         });
621                 }
622                 {~l1a.isRunning == true}{
623                         (1.do({var vol1,vol2,vol3,s1,s2,s3,s4,s5,s6,f1,f2,f3;
624                                 #vol1,vol2,vol3 = [~vol1,~vol2,~vol3];
625                                 #f1,f2,f3 = [ 0,0,0 ];
626                                 s.makeBundle(0, {
627                                         ~l1a.set(\dur, f1,     \vol, vol1);  ~l1b.set(\dur, f1,  \vol, vol1);
628                                         ~l1c.set(\dur, f1/~icd3,       \vol, vol1);  ~l1d.set(\dur, f1/~icd3,  \vol, vol1);
629                                         ~l1e.set(\dur, f1/~icd6,       \vol, vol1);  ~l1f.set(\dur, f1/~icd6,  \vol, vol1);
630                                         ~l2a.set(\dur, f2,     \vol, vol2);          ~l2b.set(\dur, f2,  \vol, vol2);
631                                         ~l2c.set(\dur, f2/~icd3,       \vol, vol2);  ~l2d.set(\dur, f2/~icd3,  \vol, vol2);
632                                         ~l2e.set(\dur, f2/~icd6,       \vol, vol2);  ~l2f.set(\dur, f2/~icd6,  \vol, vol2);
633                                         ~l3a.set(\dur, f3,     \vol, vol3);          ~l3b.set(\dur, f3,  \vol, vol3);
634                                         ~l3c.set(\dur, f3/~icd3,       \vol, vol3);  ~l3d.set(\dur, f3/~icd3,  \vol, vol3);
635                                         ~l3e.set(\dur, f3/~icd6,       \vol, vol3);  ~l3f.set(\dur, f3/~icd6,  \vol, vol3);
636                                 });
637                         }););
638
639                         (
640                                 1.do({var vol1,vol2,vol3,s1,s2,s3,s4,s5,s6,s5_1,s5_2,s5_3;
641                                         #vol1,vol2,vol3 = [~vol1,~vol2,~vol3];
642                                         #s1,s2,s3,s4,s5,s6 = [\gsineicfld6, \gsineicrld6, \gsineicfld2, \gsineicrld2, \gsineicfld1, \gsineicrld1];
643                                         case
644                                         {~sendreplysynthdef_on == 0}{#s5_1,s5_2,s5_3 = \gsineicfld1!3;}
645                                         {~sendreplysynthdef_on == 1}{#s5_1,s5_2,s5_3 =
646                                                 [\gsineicfld1_f1, \gsineicfld1_f2, \gsineicfld1_f3];};
647                                         s.makeBundle(0, {
648                                                 ~l1a1 = Synth(s1, [\dur, ~f1,    \vol, vol1]).register;    ~l1b1 = Synth(s2, [\dur, ~f1,    \vol, vol1]);
649                                                 ~l1c1 = Synth(s3, [\dur, ~f1/~icd3,  \vol, vol1]);   ~l1d1 = Synth(s4, [\dur, ~f1/~icd3,  \vol, vol1]);
650                                                 ~l1e1 = Synth(s5_1, [\dur, ~f1/~icd6,  \vol, vol1]);   ~l1f1 = Synth(s6, [\dur, ~f1/~icd6,  \vol, vol1]);
651                                                 ~l2a1 = Synth(s1, [\dur, ~f2,    \vol, vol2]);        ~l2b1 = Synth(s2, [\dur, ~f2,    \vol, vol2]);
652                                                 ~l2c1 = Synth(s3, [\dur, ~f2/~icd3,  \vol, vol2]);   ~l2d1 = Synth(s4, [\dur, ~f2/~icd3,  \vol, vol2]);
653                                                 ~l2e1 = Synth(s5_2, [\dur, ~f2/~icd6,  \vol, vol2]);   ~l2f1 = Synth(s6, [\dur, ~f2/~icd6,  \vol, vol2]);
654                                                 ~l3a1 = Synth(s1, [\dur, ~f3,    \vol, vol3]);        ~l3b1 = Synth(s2, [\dur, ~f3,   \vol, vol3]);
655                                                 ~l3c1 = Synth(s3, [\dur, ~f3/~icd3,  \vol, vol3]);   ~l3d1 = Synth(s4, [\dur, ~f3/~icd3, \vol, vol3]);
656                                                 ~l3e1 = Synth(s5_3, [\dur, ~f3/~icd6,  \vol, vol3]);   ~l3f1 = Synth(s6, [\dur, ~f3/~icd6, \vol, vol3]);
657                                         });
658                                 });
659                         );
660                         AppClock.sched(0.161803398875,{
661                                 ([~l1a,~l1b,~l1c,~l1d,~l1e,~l1f,~l2a,~l2b,~l2c,~l2d,~l2e,~l2f,~l3a,~l3b,~l3c,~l3d,~l3e,~l3f].do(_.free)); ~slideroutine.stop;
662                         });
663                 };
664
665                 if((~f1 > ~outmaxa) or: (~f1 < ~outmina), {~z25.close;~z1.close;~z25 = (View(w, Rect((~f1.explin(~outminb,~outmaxb,0,Window.screenBounds.width)), ~dc1+10, ~nw, 2)).background = Color.white;);}, {~z1.close;~z25.close;~z1 = (View(w, Rect((~f1.explin(~outmina,~outmaxa,0,Window.screenBounds.width)), ~dc2+10, ~nw, 2)).background = Color.white;);});
666                 if((~f2 > ~outmaxa) or: (~f2 < ~outmina), {~z26.close;~z2.close;~z26 = (View(w, Rect((~f2.explin(~outminb,~outmaxb,0,Window.screenBounds.width)), ~dc1+20, ~nw, 2)).background = Color.white;);}, {~z2.close;~z26.close;~z2 = (View(w, Rect((~f2.explin(~outmina,~outmaxa,0,Window.screenBounds.width)), ~dc2+20, ~nw, 2)).background = Color.white;);});
667                 if((~f3 > ~outmaxa) or: (~f3 < ~outmina), {~z27.close;~z3.close;~z27 = (View(w, Rect((~f3.explin(~outminb,~outmaxb,0,Window.screenBounds.width)), ~dc1+30, ~nw, 2)).background = Color.white;);}, {~z3.close;~z27.close;~z3 = (View(w, Rect((~f3.explin(~outmina,~outmaxa,0,Window.screenBounds.width)), ~dc2+30, ~nw, 2)).background = Color.white;);});
668
669                 b3.value = 1;
670         };
671
672         ~synthflow = {
673                 case
674                 {~l1a1.isRunning == true}{
675                         (1.do({var vol1,vol2,vol3,s1,s2,s3,s4,s5,s6;
676                                 #vol1,vol2,vol3 = [~vol1,~vol2,~vol3];
677                                 s.makeBundle(0, {
678                                         ~l1a1.set(\dur, ~f1,     \vol, vol1);  ~l1b1.set(\dur, ~f1,  \vol, vol1);
679                                         ~l1c1.set(\dur, ~f1/~icd3,       \vol, vol1);  ~l1d1.set(\dur, ~f1/~icd3,  \vol, vol1);
680                                         ~l1e1.set(\dur, ~f1/~icd6,       \vol, vol1);  ~l1f1.set(\dur, ~f1/~icd6,  \vol, vol1);
681                                         ~l2a1.set(\dur, ~f2,     \vol, vol2);          ~l2b1.set(\dur, ~f2,  \vol, vol2);
682                                         ~l2c1.set(\dur, ~f2/~icd3,       \vol, vol2);  ~l2d1.set(\dur, ~f2/~icd3,  \vol, vol2);
683                                         ~l2e1.set(\dur, ~f2/~icd6,       \vol, vol2);  ~l2f1.set(\dur, ~f2/~icd6,  \vol, vol2);
684                                         ~l3a1.set(\dur, ~f3,     \vol, vol3);          ~l3b1.set(\dur, ~f3,  \vol, vol3);
685                                         ~l3c1.set(\dur, ~f3/~icd3,       \vol, vol3);  ~l3d1.set(\dur, ~f3/~icd3,  \vol, vol3);
686                                         ~l3e1.set(\dur, ~f3/~icd6,       \vol, vol3);  ~l3f1.set(\dur, ~f3/~icd6,  \vol, vol3);
687                                 });
688                         }););
689                 }
690                 {~l1a.isRunning == true} {
691                         (1.do({var vol1,vol2,vol3,s1,s2,s3,s4,s5,s6;
692                                 #vol1,vol2,vol3 = [~vol1,~vol2,~vol3];
693                                 s.makeBundle(0, {
694                                         ~l1a.set(\dur, ~f1,     \vol, vol1);  ~l1b.set(\dur, ~f1,  \vol, vol1);
695                                         ~l1c.set(\dur, ~f1/~icd3,       \vol, vol1);  ~l1d.set(\dur, ~f1/~icd3,  \vol, vol1);
696                                         ~l1e.set(\dur, ~f1/~icd6,       \vol, vol1);  ~l1f.set(\dur, ~f1/~icd6,  \vol, vol1);
697                                         ~l2a.set(\dur, ~f2,     \vol, vol2);          ~l2b.set(\dur, ~f2,  \vol, vol2);
698                                         ~l2c.set(\dur, ~f2/~icd3,       \vol, vol2);  ~l2d.set(\dur, ~f2/~icd3,  \vol, vol2);
699                                         ~l2e.set(\dur, ~f2/~icd6,       \vol, vol2);  ~l2f.set(\dur, ~f2/~icd6,  \vol, vol2);
700                                         ~l3a.set(\dur, ~f3,     \vol, vol3);          ~l3b.set(\dur, ~f3,  \vol, vol3);
701                                         ~l3c.set(\dur, ~f3/~icd3,       \vol, vol3);  ~l3d.set(\dur, ~f3/~icd3,  \vol, vol3);
702                                         ~l3e.set(\dur, ~f3/~icd6,       \vol, vol3);  ~l3f.set(\dur, ~f3/~icd6,  \vol, vol3);
703                                 });
704                         }););
705                 };
706
707                 if((~f1 > ~outmaxa) or: (~f1 < ~outmina), {~z25.close;~z1.close;~z25 = (View(w, Rect((~f1.explin(~outminb,~outmaxb,0,Window.screenBounds.width)), ~dc1+10, ~nw, 2)).background = Color.white;);}, {~z1.close;~z25.close;~z1 = (View(w, Rect((~f1.explin(~outmina,~outmaxa,0,Window.screenBounds.width)), ~dc2+10, ~nw, 2)).background = Color.white;);});
708                 if((~f2 > ~outmaxa) or: (~f2 < ~outmina), {~z26.close;~z2.close;~z26 = (View(w, Rect((~f2.explin(~outminb,~outmaxb,0,Window.screenBounds.width)), ~dc1+20, ~nw, 2)).background = Color.white;);}, {~z2.close;~z26.close;~z2 = (View(w, Rect((~f2.explin(~outmina,~outmaxa,0,Window.screenBounds.width)), ~dc2+20, ~nw, 2)).background = Color.white;);});
709                 if((~f3 > ~outmaxa) or: (~f3 < ~outmina), {~z27.close;~z3.close;~z27 = (View(w, Rect((~f3.explin(~outminb,~outmaxb,0,Window.screenBounds.width)), ~dc1+30, ~nw, 2)).background = Color.white;);}, {~z3.close;~z27.close;~z3 = (View(w, Rect((~f3.explin(~outmina,~outmaxa,0,Window.screenBounds.width)), ~dc2+30, ~nw, 2)).background = Color.white;);});
710         };
711
712         ~synthslide = {
713                 case
714                 {~l1a1.isRunning == true}{(//fprog
715                         ~slideroutine = Routine({1.do({var vol1,vol2,vol3,s1,s2,s3,s4,s5,s6;
716                                 #vol1,vol2,vol3 = [~vol1,~vol2,~vol3];
717                                 ~slidedo.do({~slidecount=~slidecount-1;
718                                         (
719                                                 [ ~f1=~f1+g,~f2=~f2+h,~f3=~f3+i ];
720                                                 s.makeBundle(0, {
721                                                         ~l1a1.set(\dur, ~f1,     \vol, vol1);  ~l1b1.set(\dur, ~f1,  \vol, vol1);
722                                                         ~l1c1.set(\dur, ~f1/~icd3,       \vol, vol1);  ~l1d1.set(\dur, ~f1/~icd3,  \vol, vol1);
723                                                         ~l1e1.set(\dur, ~f1/~icd6,       \vol, vol1);  ~l1f1.set(\dur, ~f1/~icd6,  \vol, vol1);
724                                                         ~l2a1.set(\dur, ~f2,     \vol, vol2);          ~l2b1.set(\dur, ~f2,  \vol, vol2);
725                                                         ~l2c1.set(\dur, ~f2/~icd3,       \vol, vol2);  ~l2d1.set(\dur, ~f2/~icd3,  \vol, vol2);
726                                                         ~l2e1.set(\dur, ~f2/~icd6,       \vol, vol2);  ~l2f1.set(\dur, ~f2/~icd6,  \vol, vol2);
727                                                         ~l3a1.set(\dur, ~f3,     \vol, vol3);          ~l3b1.set(\dur, ~f3,  \vol, vol3);
728                                                         ~l3c1.set(\dur, ~f3/~icd3,       \vol, vol3);  ~l3d1.set(\dur, ~f3/~icd3,  \vol, vol3);
729                                                         ~l3e1.set(\dur, ~f3/~icd6,       \vol, vol3);  ~l3f1.set(\dur, ~f3/~icd6,  \vol, vol3);
730                                                 });
731                                         );
732
733                                         {if(~slidecount==0,{
734                                                 if((~f1 > ~outmaxa) or: (~f1 < ~outmina), {~z25.close;~z1.close;~z25 = (View(w, Rect((~f1.explin(~outminb,~outmaxb,0,Window.screenBounds.width)), ~dc1+10, ~nw, 2)).background = Color.white;);}, {~z1.close;~z25.close;~z1 = (View(w, Rect((~f1.explin(~outmina,~outmaxa,0,Window.screenBounds.width)), ~dc2+10, ~nw, 2)).background = Color.white;);});
735                                                 if((~f2 > ~outmaxa) or: (~f2 < ~outmina), {~z26.close;~z2.close;~z26 = (View(w, Rect((~f2.explin(~outminb,~outmaxb,0,Window.screenBounds.width)), ~dc1+20, ~nw, 2)).background = Color.white;);}, {~z2.close;~z26.close;~z2 = (View(w, Rect((~f2.explin(~outmina,~outmaxa,0,Window.screenBounds.width)), ~dc2+20, ~nw, 2)).background = Color.white;);});
736                                                 if((~f3 > ~outmaxa) or: (~f3 < ~outmina), {~z27.close;~z3.close;~z27 = (View(w, Rect((~f3.explin(~outminb,~outmaxb,0,Window.screenBounds.width)), ~dc1+30, ~nw, 2)).background = Color.white;);}, {~z3.close;~z27.close;~z3 = (View(w, Rect((~f3.explin(~outmina,~outmaxa,0,Window.screenBounds.width)), ~dc2+30, ~nw, 2)).background = Color.white;);});
737                                         });}.defer;
738
739                                         (~slidetime/~slidedo).wait;});});}).play;);}
740                 {~l1a.isRunning == true} {(//fprog
741                         ~slideroutine = Routine({1.do({var vol1,vol2,vol3,s1,s2,s3,s4,s5,s6;
742                                 #vol1,vol2,vol3= [~vol1,~vol2,~vol3];
743                                 ~slidedo.do({~slidecount=~slidecount-1;
744                                         (
745                                                 [ ~f1=~f1+g,~f2=~f2+h,~f3=~f3+i ];
746                                                 s.makeBundle(0, {
747                                                         ~l1a.set(\dur, ~f1,     \vol, vol1);  ~l1b.set(\dur, ~f1,  \vol, vol1);
748                                                         ~l1c.set(\dur, ~f1/~icd3,       \vol, vol1);  ~l1d.set(\dur, ~f1/~icd3,  \vol, vol1);
749                                                         ~l1e.set(\dur, ~f1/~icd6,       \vol, vol1);  ~l1f.set(\dur, ~f1/~icd6,  \vol, vol1);
750                                                         ~l2a.set(\dur, ~f2,     \vol, vol2);          ~l2b.set(\dur, ~f2,  \vol, vol2);
751                                                         ~l2c.set(\dur, ~f2/~icd3,       \vol, vol2);  ~l2d.set(\dur, ~f2/~icd3,  \vol, vol2);
752                                                         ~l2e.set(\dur, ~f2/~icd6,       \vol, vol2);  ~l2f.set(\dur, ~f2/~icd6,  \vol, vol2);
753                                                         ~l3a.set(\dur, ~f3,     \vol, vol3);          ~l3b.set(\dur, ~f3,  \vol, vol3);
754                                                         ~l3c.set(\dur, ~f3/~icd3,       \vol, vol3);  ~l3d.set(\dur, ~f3/~icd3,  \vol, vol3);
755                                                         ~l3e.set(\dur, ~f3/~icd6,       \vol, vol3);  ~l3f.set(\dur, ~f3/~icd6,  \vol, vol3);
756                                                 });
757                                         );
758
759                                         {if(~slidecount==0,{if((~f1 > ~outmaxa) or: (~f1 < ~outmina), {~z25.close;~z1.close;~z25 = (View(w, Rect((~f1.explin(~outminb,~outmaxb,0,Window.screenBounds.width)), ~dc1+10, ~nw, 2)).background = Color.white;);}, {~z1.close;~z25.close;~z1 = (View(w, Rect((~f1.explin(~outmina,~outmaxa,0,Window.screenBounds.width)), ~dc2+10, ~nw, 2)).background = Color.white;);});
760                                                 if((~f2 > ~outmaxa) or: (~f2 < ~outmina), {~z26.close;~z2.close;~z26 = (View(w, Rect((~f2.explin(~outminb,~outmaxb,0,Window.screenBounds.width)), ~dc1+20, ~nw, 2)).background = Color.white;);}, {~z2.close;~z26.close;~z2 = (View(w, Rect((~f2.explin(~outmina,~outmaxa,0,Window.screenBounds.width)), ~dc2+20, ~nw, 2)).background = Color.white;);});
761                                                 if((~f3 > ~outmaxa) or: (~f3 < ~outmina), {~z27.close;~z3.close;~z27 = (View(w, Rect((~f3.explin(~outminb,~outmaxb,0,Window.screenBounds.width)), ~dc1+30, ~nw, 2)).background = Color.white;);}, {~z3.close;~z27.close;~z3 = (View(w, Rect((~f3.explin(~outmina,~outmaxa,0,Window.screenBounds.width)), ~dc2+30, ~nw, 2)).background = Color.white;);});
762                                         });}.defer;
763
764                                         (~slidetime/~slidedo).wait;});});}).play;);};
765         };
766
767         ~synthpause = {(
768                 case
769                 {~l1a1.isRunning == true}{
770                         (1.do({var vol1,vol2,vol3,s1,s2,s3,s4,s5,s6,f1,f2,f3;
771                                 #vol1,vol2,vol3 = [~vol1,~vol2,~vol3];
772                                 #f1,f2,f3 = [ 0,0,0 ];
773                                 s.makeBundle(0, {
774                                         ~l1a1.set(\dur, f1,     \vol, vol1);          ~l1b1.set(\dur, f1,  \vol, vol1);
775                                         ~l1c1.set(\dur, f1/~icd3,       \vol, vol1);  ~l1d1.set(\dur, f1/~icd3,  \vol, vol1);
776                                         ~l1e1.set(\dur, f1/~icd6,       \vol, vol1);  ~l1f1.set(\dur, f1/~icd6,  \vol, vol1);
777                                         ~l2a1.set(\dur, f2,     \vol, vol2);          ~l2b1.set(\dur, f2,  \vol, vol2);
778                                         ~l2c1.set(\dur, f2/~icd3,       \vol, vol2);  ~l2d1.set(\dur, f2/~icd3,  \vol, vol2);
779                                         ~l2e1.set(\dur, f2/~icd6,       \vol, vol2);  ~l2f1.set(\dur, f2/~icd6,  \vol, vol2);
780                                         ~l3a1.set(\dur, f3,     \vol, vol3);          ~l3b1.set(\dur, f3,  \vol, vol3);
781                                         ~l3c1.set(\dur, f3/~icd3,       \vol, vol3);  ~l3d1.set(\dur, f3/~icd3,  \vol, vol3);
782                                         ~l3e1.set(\dur, f3/~icd6,       \vol, vol3);  ~l3f1.set(\dur, f3/~icd6,  \vol, vol3);
783                                 });
784                         }););
785                 }
786                 {~l1a.isRunning == true} {
787                         (1.do({var vol1,vol2,vol3,s1,s2,s3,s4,s5,s6,f1,f2,f3;
788                                 #vol1,vol2,vol3 = [~vol1,~vol2,~vol3];
789                                 #f1,f2,f3 = [ 0,0,0 ];
790                                 s.makeBundle(0, {
791                                         ~l1a.set(\dur, f1,     \vol, vol1);  ~l1b.set(\dur, f1,  \vol, vol1);
792                                         ~l1c.set(\dur, f1/~icd3,       \vol, vol1);  ~l1d.set(\dur, f1/~icd3,  \vol, vol1);
793                                         ~l1e.set(\dur, f1/~icd6,       \vol, vol1);  ~l1f.set(\dur, f1/~icd6,  \vol, vol1);
794                                         ~l2a.set(\dur, f2,     \vol, vol2);          ~l2b.set(\dur, f2,  \vol, vol2);
795                                         ~l2c.set(\dur, f2/~icd3,       \vol, vol2);  ~l2d.set(\dur, f2/~icd3,  \vol, vol2);
796                                         ~l2e.set(\dur, f2/~icd6,       \vol, vol2);  ~l2f.set(\dur, f2/~icd6,  \vol, vol2);
797                                         ~l3a.set(\dur, f3,     \vol, vol3);          ~l3b.set(\dur, f3,  \vol, vol3);
798                                         ~l3c.set(\dur, f3/~icd3,       \vol, vol3);  ~l3d.set(\dur, f3/~icd3,  \vol, vol3);
799                                         ~l3e.set(\dur, f3/~icd6,       \vol, vol3);  ~l3f.set(\dur, f3/~icd6,  \vol, vol3);
800                                 });
801                         }););
802                 };
803         );
804         };
805
806         ~synthfree = {
807                 (
808                         case
809                         {~l1a1.isRunning == true}{
810                                 (1.do({var vol1,vol2,vol3,s1,s2,s3,s4,s5,s6,f1,f2,f3;
811                                         #vol1,vol2,vol3 = [~vol1,~vol2,~vol3];
812                                         #f1,f2,f3 = [ 0,0,0 ];
813                                         s.makeBundle(0, {
814                                                 ~l1a1.set(\dur, f1,     \vol, vol1);  ~l1b1.set(\dur, f1,  \vol, vol1);
815                                                 ~l1c1.set(\dur, f1/~icd3,       \vol, vol1);  ~l1d1.set(\dur, f1/~icd3,  \vol, vol1);
816                                                 ~l1e1.set(\dur, f1/~icd6,       \vol, vol1);  ~l1f1.set(\dur, f1/~icd6,  \vol, vol1);
817                                                 ~l2a1.set(\dur, f2,     \vol, vol2);          ~l2b1.set(\dur, f2,  \vol, vol2);
818                                                 ~l2c1.set(\dur, f2/~icd3,       \vol, vol2);  ~l2d1.set(\dur, f2/~icd3,  \vol, vol2);
819                                                 ~l2e1.set(\dur, f2/~icd6,       \vol, vol2);  ~l2f1.set(\dur, f2/~icd6,  \vol, vol2);
820                                                 ~l3a1.set(\dur, f3,     \vol, vol3);          ~l3b1.set(\dur, f3,  \vol, vol3);
821                                                 ~l3c1.set(\dur, f3/~icd3,       \vol, vol3);  ~l3d1.set(\dur, f3/~icd3,  \vol, vol3);
822                                                 ~l3e1.set(\dur, f3/~icd6,       \vol, vol3);  ~l3f1.set(\dur, f3/~icd6,  \vol, vol3);
823                                         });
824                                 }););
825                                 AppClock.sched(0.161803398875,{
826                                         ([~l1a1,~l1b1,~l1c1,~l1d1,~l1e1,~l1f1,~l2a1,~l2b1,~l2c1,~l2d1,~l2e1,~l2f1,~l3a1,~l3b1,~l3c1,~l3d1,~l3e1,~l3f1 ].do(_.free)); ~slideroutine.stop;
827                                 });
828                         }
829                         {~l1a.isRunning == true}{
830                                 (1.do({var vol1,vol2,vol3,s1,s2,s3,s4,s5,s6,f1,f2,f3;
831                                         #vol1,vol2,vol3 = [~vol1,~vol2,~vol3];
832                                         #f1,f2,f3 = [ 0,0,0 ];
833                                         s.makeBundle(0, {
834                                                 ~l1a.set(\dur, f1,     \vol, vol1);  ~l1b.set(\dur, f1,  \vol, vol1);
835                                                 ~l1c.set(\dur, f1/~icd3,       \vol, vol1);  ~l1d.set(\dur, f1/~icd3,  \vol, vol1);
836                                                 ~l1e.set(\dur, f1/~icd6,       \vol, vol1);  ~l1f.set(\dur, f1/~icd6,  \vol, vol1);
837                                                 ~l2a.set(\dur, f2,     \vol, vol2);          ~l2b.set(\dur, f2,  \vol, vol2);
838                                                 ~l2c.set(\dur, f2/~icd3,       \vol, vol2);  ~l2d.set(\dur, f2/~icd3,  \vol, vol2);
839                                                 ~l2e.set(\dur, f2/~icd6,       \vol, vol2);  ~l2f.set(\dur, f2/~icd6,  \vol, vol2);
840                                                 ~l3a.set(\dur, f3,     \vol, vol3);          ~l3b.set(\dur, f3,  \vol, vol3);
841                                                 ~l3c.set(\dur, f3/~icd3,       \vol, vol3);  ~l3d.set(\dur, f3/~icd3,  \vol, vol3);
842                                                 ~l3e.set(\dur, f3/~icd6,       \vol, vol3);  ~l3f.set(\dur, f3/~icd6,  \vol, vol3);
843                                         });
844                                 }););
845                                 AppClock.sched(0.161803398875,{
846                                         ([~l1a,~l1b,~l1c,~l1d,~l1e,~l1f,~l2a,~l2b,~l2c,~l2d,~l2e,~l2f,~l3a,~l3b,~l3c,~l3d,~l3e,~l3f].do(_.free)); ~slideroutine.stop;
847                                 });
848                         };
849                 );
850         };
851
852
853         //timer values
854
855         case
856         {~slot1 == nil}{""}
857         {~slot2 == nil}{""}
858         {~slot3 == nil}{""}
859         {~slot4 == nil}{""}
860         {~slot5 == nil}{""}
861         {~slot6 == nil}{""}
862         {~slot7 == nil}{""}
863         {~slot8 == nil}{""};
864
865         ~timevals = {(~tst = TextView(w, Rect(~tspl,~tspt, ~tspw, ~tsph)).background_(Color.black);
866                 (~tst.string =
867                         "o1:_"++~time1o.value.asString++"_f1:_"++~time1f.value.asString++"_s1:_"++~time1s.value.asString++"\n" ++
868                         "o2:_"++~time2o.value.asString++"_f2:_"++~time2f.value.asString++"_s2:_"++~time2s.value.asString++"\n" ++
869                         "o3:_"++~time3o.value.asString++"_f3:_"++~time3f.value.asString++"_s3:_"++~time3s.value.asString++"\n" ++
870                         "o4:_"++~time4o.value.asString++"_f4:_"++~time4f.value.asString++"_s4:_"++~time4s.value.asString++"\n" ++
871                         "o5:_"++~time5o.value.asString++"_f5:_"++~time5f.value.asString++"_s5:_"++~time5s.value.asString++"\n" ++
872                         "o6:_"++~time6o.value.asString++"_f6:_"++~time6f.value.asString++"_s6:_"++~time6s.value.asString++"\n" ++
873                         "o7:_"++~time7o.value.asString++"_f7:_"++~time7f.value.asString++"_s7:_"++~time7s.value.asString++"\n" ++
874                         "o8:_"++~time8o.value.asString++"_f8:_"++~time8f.value.asString++"_s8:_"++~time8s.value.asString++"\n" ++"\n" ++
875                         if(~slot8 != ~slot, {
876                                 (~slot1 = ~slot2).asString++"\n" ++
877                                 (~slot2 = ~slot3).asString++"\n" ++
878                                 (~slot3 = ~slot4).asString++"\n" ++
879                                 (~slot4 = ~slot5).asString++"\n" ++
880                                 (~slot5 = ~slot6).asString++"\n" ++
881                                 (~slot6 = ~slot7).asString++"\n" ++
882                                 (~slot7 = ~slot8).asString++"\n" ++
883                                 (~slot8 = ~slot).asString;
884                         },{
885                                 (~slot1).asString++"\n" ++
886                                 (~slot2).asString++"\n" ++
887                                 (~slot3).asString++"\n" ++
888                                 (~slot4).asString++"\n" ++
889                                 (~slot5).asString++"\n" ++
890                                 (~slot6).asString++"\n" ++
891                                 (~slot7).asString++"\n" ++
892                                 (~slot8).asString;
893                         });
894
895                 );
896                 ~tst.stringColor = Color.white;
897         )};
898
899
900         //monitoring number of synths function
901
902         ~numsynthsfunc = {
903                 if((~numsynths != nil) or: (~numsynths.isPlaying == true), {~numsynths.stop;});
904                 ~numsynths = Routine({inf.do({if((s.numSynths > 19) and: (3.wait; s.numSynths > 19) and: (6.wait; s.numSynths > 19), {
905
906                         AppClock.sched(0, {
907                                 if(~numsynthmessage != nil, {~numsynthmessage.close;});
908                                 ~numsynthmessage = View(w, Rect(Window.screenBounds.width-(340+46),Window.screenBounds.height-(340+46/1.6180339887499)-110,340+46,340+46/1.6180339887499)).background_(Color.black).front;
909                                 ~numsynthmessagestring = StaticText(~numsynthmessage, Rect(0,0,340+46,340+46/1.6180339887499)).background_(Color.black);
910                                 ~numsynthmessagestring.align = \topLeft;
911                                 ~numsynthmessagestring.string ="Warning:"++"\n"++"\n"++"More than the normal amount of synths are currently running. It is recommended to free the server by pressing "+"ctrl/cmd - period".quote+" and then pressing the "+"ok".quote+" button. Otherwise, you can press the "+"cancel".quote+" button to allow the synths to keep running. If you press the "+"cancel".quote+" button this message will not show again unless "+"synth0".quote+" has been pressed.";
912                                 ~numsynthmessagestring.stringColor = Color.white;
913                                 ~numsynthmessagebutton1 = Button.new(~numsynthmessage,Rect(120-46,340/1.6180339887499-30,46,46/1.6180339887499)).states_([["ok",Color.white,Color.black]]).action_({AppClock.sched(0, {~numsynthmessage.close; ~numsynths.play; ~midifunc.value;});});
914                                 ~numsynthmessagebutton2 = Button.new(~numsynthmessage,Rect(320+46-100,340/1.6180339887499-30,46,46/1.6180339887499)).states_([["cancel",Color.white,Color.black]]).action_({AppClock.sched(0, {~numsynths.stop; ~numsynthmessage.close;});});
915                                 ~numsynthmessage.front;
916                         });
917                 }); 1.wait;});}).play;
918         };
919
920         ~numsynthsfunc.value;
921
922
923         //mouse down action
924
925         view.mouseDownAction = {
926                 |v, x, y, mod, butNum|
927                 point = [x,y];
928                 if(butNum == 0, { v.refresh;
929
930                         //generate dots on mouse down action
931
932                         ~tgrid = 30;
933                         ~bgrid = Window.screenBounds.height-(Window.screenBounds.height/1.6180339887499)+30;
934
935                         case
936                         {y<~tgrid} {nil}
937                         {y>=(~tgrid) and: y<=(~tgrid=~tgrid+10)}  {~z1.close;~z1 = (View(w, Rect(x, y, ~nw, 2)).background = Color.white;)}
938                         {y>=(~tgrid) and: y<=(~tgrid=~tgrid+10)}  {~z2.close;~z2 = (View(w, Rect(x, y, ~nw, 2)).background = Color.white;)}
939                         {y>=(~tgrid) and: y<=(~tgrid=~tgrid+10)}  {~z3.close;~z3 = (View(w, Rect(x, y, ~nw, 2)).background = Color.white;)}
940                         {y>~tgrid and: y<~bgrid} {nil}
941                         {y>=(~bgrid) and: y<=(~bgrid=~bgrid+10)} {~z1.close;~z1 = (View(w, Rect(x, y, ~nw, 2)).background = Color.white;)}
942                         {y>=(~bgrid) and: y<=(~bgrid=~bgrid+10)} {~z2.close;~z2 = (View(w, Rect(x, y, ~nw, 2)).background = Color.white;)}
943                         {y>=(~bgrid) and: y<=(~bgrid=~bgrid+10)} {~z3.close;~z3 = (View(w, Rect(x, y, ~nw, 2)).background = Color.white;)};
944                 }, {});
945
946                 ~tgrid = 30;
947                 ~bgrid = Window.screenBounds.height-(Window.screenBounds.height/1.6180339887499)+30;
948
949                 //set synth values on mouse down action
950
951                 case
952                 {~l1a.isRunning == true}{
953                         case
954                         {y<~tgrid} {nil}
955                         {y>=(~tgrid) and: y<=(~tgrid=~tgrid+10)} {
956                                 ~l1a.set(\dur, ((x/(Window.screenBounds.width)).linexp(0,1,~outmin1,~outmax1)));
957                                 ~l1b.set(\dur, q=((x/(Window.screenBounds.width)).linexp(0,1,~outmin1,~outmax1)).value); ~f1=q.value; ~undof1=~f1;
958                                 ~l1c.set(\dur, ((x/(Window.screenBounds.width)).linexp(0,1,~outmin1,~outmax1))/~icd3);
959                                 ~l1d.set(\dur, q=((x/(Window.screenBounds.width)).linexp(0,1,~outmin1,~outmax1)).value/~icd3);
960                                 ~l1e.set(\dur, ((x/(Window.screenBounds.width)).linexp(0,1,~outmin1,~outmax1))/~icd6);
961                                 ~l1f.set(\dur, q=((x/(Window.screenBounds.width)).linexp(0,1,~outmin1,~outmax1)).value/~icd6);}
962                         {y>=(~tgrid) and: y<=(~tgrid=~tgrid+10)} {
963                                 ~l2a.set(\dur, ((x/(Window.screenBounds.width)).linexp(0,1,~outmin1,~outmax1)));
964                                 ~l2b.set(\dur, q=((x/(Window.screenBounds.width)).linexp(0,1,~outmin1,~outmax1)).value); ~f2=q.value; ~undof2=~f2;
965                                 ~l2c.set(\dur, ((x/(Window.screenBounds.width)).linexp(0,1,~outmin1,~outmax1))/~icd3);
966                                 ~l2d.set(\dur, q=((x/(Window.screenBounds.width)).linexp(0,1,~outmin1,~outmax1)).value/~icd3);
967                                 ~l2e.set(\dur, ((x/(Window.screenBounds.width)).linexp(0,1,~outmin1,~outmax1))/~icd6);
968                                 ~l2f.set(\dur, q=((x/(Window.screenBounds.width)).linexp(0,1,~outmin1,~outmax1)).value/~icd6);}
969                         {y>=(~tgrid) and: y<=(~tgrid=~tgrid+10)} {
970                                 ~l3a.set(\dur, ((x/(Window.screenBounds.width)).linexp(0,1,~outmin1,~outmax1)));
971                                 ~l3b.set(\dur, q=((x/(Window.screenBounds.width)).linexp(0,1,~outmin1,~outmax1)).value); ~f3=q.value; ~undof3=~f3;
972                                 ~l3c.set(\dur, ((x/(Window.screenBounds.width)).linexp(0,1,~outmin1,~outmax1))/~icd3);
973                                 ~l3d.set(\dur, q=((x/(Window.screenBounds.width)).linexp(0,1,~outmin1,~outmax1)).value/~icd3);
974                                 ~l3e.set(\dur, ((x/(Window.screenBounds.width)).linexp(0,1,~outmin1,~outmax1))/~icd6);
975                                 ~l3f.set(\dur, q=((x/(Window.screenBounds.width)).linexp(0,1,~outmin1,~outmax1)).value/~icd6);}
976                         {y>~tgrid and: y<~bgrid} {nil}
977                         {y>=(~bgrid) and: y<=(~bgrid=~bgrid+10)} {
978                                 ~l1a.set(\dur, ((x/(Window.screenBounds.width)).linexp(0,1,~outmin2,~outmax2)));
979                                 ~l1b.set(\dur, q=((x/(Window.screenBounds.width)).linexp(0,1,~outmin2,~outmax2)).value); ~f1=q.value; ~undof1=~f1;
980                                 ~l1c.set(\dur, ((x/(Window.screenBounds.width)).linexp(0,1,~outmin2,~outmax2))/~icd3);
981                                 ~l1d.set(\dur, q=((x/(Window.screenBounds.width)).linexp(0,1,~outmin2,~outmax2)).value/~icd3);
982                                 ~l1e.set(\dur, ((x/(Window.screenBounds.width)).linexp(0,1,~outmin2,~outmax2))/~icd6);
983                                 ~l1f.set(\dur, q=((x/(Window.screenBounds.width)).linexp(0,1,~outmin2,~outmax2)).value/~icd6);}
984                         {y>=(~bgrid) and: y<=(~bgrid=~bgrid+10)} {
985                                 ~l2a.set(\dur, ((x/(Window.screenBounds.width)).linexp(0,1,~outmin2,~outmax2)));
986                                 ~l2b.set(\dur, q=((x/(Window.screenBounds.width)).linexp(0,1,~outmin2,~outmax2)).value); ~f2=q.value; ~undof2=~f2;
987                                 ~l2c.set(\dur, ((x/(Window.screenBounds.width)).linexp(0,1,~outmin2,~outmax2))/~icd3);
988                                 ~l2d.set(\dur, q=((x/(Window.screenBounds.width)).linexp(0,1,~outmin2,~outmax2)).value/~icd3);
989                                 ~l2e.set(\dur, ((x/(Window.screenBounds.width)).linexp(0,1,~outmin2,~outmax2))/~icd6);
990                                 ~l2f.set(\dur, q=((x/(Window.screenBounds.width)).linexp(0,1,~outmin2,~outmax2)).value/~icd6);}
991                         {y>=(~bgrid) and: y<=(~bgrid=~bgrid+10)} {
992                                 ~l3a.set(\dur, ((x/(Window.screenBounds.width)).linexp(0,1,~outmin2,~outmax2)));
993                                 ~l3b.set(\dur, q=((x/(Window.screenBounds.width)).linexp(0,1,~outmin2,~outmax2)).value); ~f3=q.value; ~undof3=~f3;
994                                 ~l3c.set(\dur, ((x/(Window.screenBounds.width)).linexp(0,1,~outmin2,~outmax2))/~icd3);
995                                 ~l3d.set(\dur, q=((x/(Window.screenBounds.width)).linexp(0,1,~outmin2,~outmax2)).value/~icd3);
996                                 ~l3e.set(\dur, ((x/(Window.screenBounds.width)).linexp(0,1,~outmin2,~outmax2))/~icd6);
997                                 ~l3f.set(\dur, q=((x/(Window.screenBounds.width)).linexp(0,1,~outmin2,~outmax2)).value/~icd6);};
998                 }
999                 {~l1a1.isRunning == true}{
1000                         case
1001                         {y<~tgrid} {nil}
1002                         {y>=(~tgrid) and: y<=(~tgrid=~tgrid+10)} {
1003                                 ~l1a1.set(\dur, ((x/(Window.screenBounds.width)).linexp(0,1,~outmin1,~outmax1)));
1004                                 ~l1b1.set(\dur, q=((x/(Window.screenBounds.width)).linexp(0,1,~outmin1,~outmax1)).value); ~f1=q.value; ~undof1=~f1;
1005                                 ~l1c1.set(\dur, ((x/(Window.screenBounds.width)).linexp(0,1,~outmin1,~outmax1))/~icd3);
1006                                 ~l1d1.set(\dur, q=((x/(Window.screenBounds.width)).linexp(0,1,~outmin1,~outmax1)).value/~icd3);
1007                                 ~l1e1.set(\dur, ((x/(Window.screenBounds.width)).linexp(0,1,~outmin1,~outmax1))/~icd6);
1008                                 ~l1f1.set(\dur, q=((x/(Window.screenBounds.width)).linexp(0,1,~outmin1,~outmax1)).value/~icd6);}
1009                         {y>=(~tgrid) and: y<=(~tgrid=~tgrid+10)} {
1010                                 ~l2a1.set(\dur, ((x/(Window.screenBounds.width)).linexp(0,1,~outmin1,~outmax1)));
1011                                 ~l2b1.set(\dur, q=((x/(Window.screenBounds.width)).linexp(0,1,~outmin1,~outmax1)).value); ~f2=q.value; ~undof2=~f2;
1012                                 ~l2c1.set(\dur, ((x/(Window.screenBounds.width)).linexp(0,1,~outmin1,~outmax1))/~icd3);
1013                                 ~l2d1.set(\dur, q=((x/(Window.screenBounds.width)).linexp(0,1,~outmin1,~outmax1)).value/~icd3);
1014                                 ~l2e1.set(\dur, ((x/(Window.screenBounds.width)).linexp(0,1,~outmin1,~outmax1))/~icd6);
1015                                 ~l2f1.set(\dur, q=((x/(Window.screenBounds.width)).linexp(0,1,~outmin1,~outmax1)).value/~icd6);}
1016                         {y>=(~tgrid) and: y<=(~tgrid=~tgrid+10)} {
1017                                 ~l3a1.set(\dur, ((x/(Window.screenBounds.width)).linexp(0,1,~outmin1,~outmax1)));
1018                                 ~l3b1.set(\dur, q=((x/(Window.screenBounds.width)).linexp(0,1,~outmin1,~outmax1)).value); ~f3=q.value; ~undof3=~f3;
1019                                 ~l3c1.set(\dur, ((x/(Window.screenBounds.width)).linexp(0,1,~outmin1,~outmax1))/~icd3);
1020                                 ~l3d1.set(\dur, q=((x/(Window.screenBounds.width)).linexp(0,1,~outmin1,~outmax1)).value/~icd3);
1021                                 ~l3e1.set(\dur, ((x/(Window.screenBounds.width)).linexp(0,1,~outmin1,~outmax1))/~icd6);
1022                                 ~l3f1.set(\dur, q=((x/(Window.screenBounds.width)).linexp(0,1,~outmin1,~outmax1)).value/~icd6);}
1023                         {y>~tgrid and: y<~bgrid} {nil}
1024                         {y>=(~bgrid) and: y<=(~bgrid=~bgrid+10)} {
1025                                 ~l1a1.set(\dur, ((x/(Window.screenBounds.width)).linexp(0,1,~outmin2,~outmax2)));
1026                                 ~l1b1.set(\dur, q=((x/(Window.screenBounds.width)).linexp(0,1,~outmin2,~outmax2)).value); ~f1=q.value; ~undof1=~f1;
1027                                 ~l1c1.set(\dur, ((x/(Window.screenBounds.width)).linexp(0,1,~outmin2,~outmax2))/~icd3);
1028                                 ~l1d1.set(\dur, q=((x/(Window.screenBounds.width)).linexp(0,1,~outmin2,~outmax2)).value/~icd3);
1029                                 ~l1e1.set(\dur, ((x/(Window.screenBounds.width)).linexp(0,1,~outmin2,~outmax2))/~icd6);
1030                                 ~l1f1.set(\dur, q=((x/(Window.screenBounds.width)).linexp(0,1,~outmin2,~outmax2)).value/~icd6);}
1031                         {y>=(~bgrid) and: y<=(~bgrid=~bgrid+10)} {
1032                                 ~l2a1.set(\dur, ((x/(Window.screenBounds.width)).linexp(0,1,~outmin2,~outmax2)));
1033                                 ~l2b1.set(\dur, q=((x/(Window.screenBounds.width)).linexp(0,1,~outmin2,~outmax2)).value); ~f2=q.value; ~undof2=~f2;
1034                                 ~l2c1.set(\dur, ((x/(Window.screenBounds.width)).linexp(0,1,~outmin2,~outmax2))/~icd3);
1035                                 ~l2d1.set(\dur, q=((x/(Window.screenBounds.width)).linexp(0,1,~outmin2,~outmax2)).value/~icd3);
1036                                 ~l2e1.set(\dur, ((x/(Window.screenBounds.width)).linexp(0,1,~outmin2,~outmax2))/~icd6);
1037                                 ~l2f1.set(\dur, q=((x/(Window.screenBounds.width)).linexp(0,1,~outmin2,~outmax2)).value/~icd6);}
1038                         {y>=(~bgrid) and: y<=(~bgrid=~bgrid+10)} {
1039                                 ~l3a1.set(\dur, ((x/(Window.screenBounds.width)).linexp(0,1,~outmin2,~outmax2)));
1040                                 ~l3b1.set(\dur, q=((x/(Window.screenBounds.width)).linexp(0,1,~outmin2,~outmax2)).value); ~f3=q.value; ~undof3=~f3;
1041                                 ~l3c1.set(\dur, ((x/(Window.screenBounds.width)).linexp(0,1,~outmin2,~outmax2))/~icd3);
1042                                 ~l3d1.set(\dur, q=((x/(Window.screenBounds.width)).linexp(0,1,~outmin2,~outmax2)).value/~icd3);
1043                                 ~l3e1.set(\dur, ((x/(Window.screenBounds.width)).linexp(0,1,~outmin2,~outmax2))/~icd6);
1044                                 ~l3f1.set(\dur, q=((x/(Window.screenBounds.width)).linexp(0,1,~outmin2,~outmax2)).value/~icd6);};
1045                 };
1046         };
1047
1048
1049         //mouse move action
1050
1051         view.mouseMoveAction = {
1052                 |v, x, y|
1053
1054                 ~nh = 2;
1055                 ~nw = ~nh*1.6180339887499;
1056
1057                 //generate dots on mouse move action
1058
1059                 ~tgrid = 30;
1060                 ~bgrid = Window.screenBounds.height-(Window.screenBounds.height/1.6180339887499)+30;
1061
1062                 case
1063                 {y<~tgrid} {nil}
1064                 {y>=(~tgrid) and: y<=(~tgrid=~tgrid+10)}  {~z1.close;~z25.close;~z1 = (View(w, Rect(x, y, ~nw, 2)).background = Color.white;)}
1065                 {y>=(~tgrid) and: y<=(~tgrid=~tgrid+10)}  {~z2.close;~z26.close;~z2 = (View(w, Rect(x, y, ~nw, 2)).background = Color.white;)}
1066                 {y>=(~tgrid) and: y<=(~tgrid=~tgrid+10)}  {~z3.close;~z27.close;~z3 = (View(w, Rect(x, y, ~nw, 2)).background = Color.white;)}
1067                 {y>~tgrid and: y<~bgrid} {nil}
1068                 {y>=(~bgrid) and: y<=(~bgrid=~bgrid+10)} {~z1.close;~z25.close;~z1 = (View(w, Rect(x, y, ~nw, 2)).background = Color.white;)}
1069                 {y>=(~bgrid) and: y<=(~bgrid=~bgrid+10)} {~z2.close;~z26.close;~z2 = (View(w, Rect(x, y, ~nw, 2)).background = Color.white;)}
1070                 {y>=(~bgrid) and: y<=(~bgrid=~bgrid+10)} {~z3.close;~z27.close;~z3 = (View(w, Rect(x, y, ~nw, 2)).background = Color.white;)};
1071                 w.refresh;
1072
1073                 ~tgrid = 30;
1074                 ~bgrid = Window.screenBounds.height-(Window.screenBounds.height/1.6180339887499)+30;
1075
1076                 //set synth values on mouse move action
1077
1078                 case
1079                 {~l1a.isRunning == true}{
1080                         case
1081                         {y<~tgrid} {nil}
1082                         {y>=(~tgrid) and: y<=(~tgrid=~tgrid+10)} {
1083                                 ~l1a.set(\dur, ((x/(Window.screenBounds.width)).linexp(0,1,~outmin1,~outmax1)));
1084                                 ~l1b.set(\dur, q=((x/(Window.screenBounds.width)).linexp(0,1,~outmin1,~outmax1)).value); ~f1=q.value; ~undof1=~f1;
1085                                 ~l1c.set(\dur, ((x/(Window.screenBounds.width)).linexp(0,1,~outmin1,~outmax1))/~icd3);
1086                                 ~l1d.set(\dur, q=((x/(Window.screenBounds.width)).linexp(0,1,~outmin1,~outmax1)).value/~icd3);
1087                                 ~l1e.set(\dur, ((x/(Window.screenBounds.width)).linexp(0,1,~outmin1,~outmax1))/~icd6);
1088                                 ~l1f.set(\dur, q=((x/(Window.screenBounds.width)).linexp(0,1,~outmin1,~outmax1)).value/~icd6);}
1089                         {y>=(~tgrid) and: y<=(~tgrid=~tgrid+10)} {
1090                                 ~l2a.set(\dur, ((x/(Window.screenBounds.width)).linexp(0,1,~outmin1,~outmax1)));
1091                                 ~l2b.set(\dur, q=((x/(Window.screenBounds.width)).linexp(0,1,~outmin1,~outmax1)).value); ~f2=q.value; ~undof2=~f2;
1092                                 ~l2c.set(\dur, ((x/(Window.screenBounds.width)).linexp(0,1,~outmin1,~outmax1))/~icd3);
1093                                 ~l2d.set(\dur, q=((x/(Window.screenBounds.width)).linexp(0,1,~outmin1,~outmax1)).value/~icd3);
1094                                 ~l2e.set(\dur, ((x/(Window.screenBounds.width)).linexp(0,1,~outmin1,~outmax1))/~icd6);
1095                                 ~l2f.set(\dur, q=((x/(Window.screenBounds.width)).linexp(0,1,~outmin1,~outmax1)).value/~icd6);}
1096                         {y>=(~tgrid) and: y<=(~tgrid=~tgrid+10)} {
1097                                 ~l3a.set(\dur, ((x/(Window.screenBounds.width)).linexp(0,1,~outmin1,~outmax1)));
1098                                 ~l3b.set(\dur, q=((x/(Window.screenBounds.width)).linexp(0,1,~outmin1,~outmax1)).value); ~f3=q.value; ~undof3=~f3;
1099                                 ~l3c.set(\dur, ((x/(Window.screenBounds.width)).linexp(0,1,~outmin1,~outmax1))/~icd3);
1100                                 ~l3d.set(\dur, q=((x/(Window.screenBounds.width)).linexp(0,1,~outmin1,~outmax1)).value/~icd3);
1101                                 ~l3e.set(\dur, ((x/(Window.screenBounds.width)).linexp(0,1,~outmin1,~outmax1))/~icd6);
1102                                 ~l3f.set(\dur, q=((x/(Window.screenBounds.width)).linexp(0,1,~outmin1,~outmax1)).value/~icd6);}
1103                         {y>~tgrid and: y<~bgrid} {nil}
1104                         {y>=(~bgrid) and: y<=(~bgrid=~bgrid+10)} {
1105                                 ~l1a.set(\dur, ((x/(Window.screenBounds.width)).linexp(0,1,~outmin2,~outmax2)));
1106                                 ~l1b.set(\dur, q=((x/(Window.screenBounds.width)).linexp(0,1,~outmin2,~outmax2)).value); ~f1=q.value; ~undof1=~f1;
1107                                 ~l1c.set(\dur, ((x/(Window.screenBounds.width)).linexp(0,1,~outmin2,~outmax2))/~icd3);
1108                                 ~l1d.set(\dur, q=((x/(Window.screenBounds.width)).linexp(0,1,~outmin2,~outmax2)).value/~icd3);
1109                                 ~l1e.set(\dur, ((x/(Window.screenBounds.width)).linexp(0,1,~outmin2,~outmax2))/~icd6);
1110                                 ~l1f.set(\dur, q=((x/(Window.screenBounds.width)).linexp(0,1,~outmin2,~outmax2)).value/~icd6);}
1111                         {y>=(~bgrid) and: y<=(~bgrid=~bgrid+10)} {
1112                                 ~l2a.set(\dur, ((x/(Window.screenBounds.width)).linexp(0,1,~outmin2,~outmax2)));
1113                                 ~l2b.set(\dur, q=((x/(Window.screenBounds.width)).linexp(0,1,~outmin2,~outmax2)).value); ~f2=q.value; ~undof2=~f2;
1114                                 ~l2c.set(\dur, ((x/(Window.screenBounds.width)).linexp(0,1,~outmin2,~outmax2))/~icd3);
1115                                 ~l2d.set(\dur, q=((x/(Window.screenBounds.width)).linexp(0,1,~outmin2,~outmax2)).value/~icd3);
1116                                 ~l2e.set(\dur, ((x/(Window.screenBounds.width)).linexp(0,1,~outmin2,~outmax2))/~icd6);
1117                                 ~l2f.set(\dur, q=((x/(Window.screenBounds.width)).linexp(0,1,~outmin2,~outmax2)).value/~icd6);}
1118                         {y>=(~bgrid) and: y<=(~bgrid=~bgrid+10)} {
1119                                 ~l3a.set(\dur, ((x/(Window.screenBounds.width)).linexp(0,1,~outmin2,~outmax2)));
1120                                 ~l3b.set(\dur, q=((x/(Window.screenBounds.width)).linexp(0,1,~outmin2,~outmax2)).value); ~f3=q.value; ~undof3=~f3;
1121                                 ~l3c.set(\dur, ((x/(Window.screenBounds.width)).linexp(0,1,~outmin2,~outmax2))/~icd3);
1122                                 ~l3d.set(\dur, q=((x/(Window.screenBounds.width)).linexp(0,1,~outmin2,~outmax2)).value/~icd3);
1123                                 ~l3e.set(\dur, ((x/(Window.screenBounds.width)).linexp(0,1,~outmin2,~outmax2))/~icd6);
1124                                 ~l3f.set(\dur, q=((x/(Window.screenBounds.width)).linexp(0,1,~outmin2,~outmax2)).value/~icd6);};
1125                 }
1126                 {~l1a1.isRunning == true}{
1127                         case
1128                         {y<~tgrid} {nil}
1129                         {y>=(~tgrid) and: y<=(~tgrid=~tgrid+10)} {
1130                                 ~l1a1.set(\dur, ((x/(Window.screenBounds.width)).linexp(0,1,~outmin1,~outmax1)));
1131                                 ~l1b1.set(\dur, q=((x/(Window.screenBounds.width)).linexp(0,1,~outmin1,~outmax1)).value); ~f1=q.value; ~undof1=~f1;
1132                                 ~l1c1.set(\dur, ((x/(Window.screenBounds.width)).linexp(0,1,~outmin1,~outmax1))/~icd3);
1133                                 ~l1d1.set(\dur, q=((x/(Window.screenBounds.width)).linexp(0,1,~outmin1,~outmax1)).value/~icd3);
1134                                 ~l1e1.set(\dur, ((x/(Window.screenBounds.width)).linexp(0,1,~outmin1,~outmax1))/~icd6);
1135                                 ~l1f1.set(\dur, q=((x/(Window.screenBounds.width)).linexp(0,1,~outmin1,~outmax1)).value/~icd6);}
1136                         {y>=(~tgrid) and: y<=(~tgrid=~tgrid+10)} {
1137                                 ~l2a1.set(\dur, ((x/(Window.screenBounds.width)).linexp(0,1,~outmin1,~outmax1)));
1138                                 ~l2b1.set(\dur, q=((x/(Window.screenBounds.width)).linexp(0,1,~outmin1,~outmax1)).value); ~f2=q.value; ~undof2=~f2;
1139                                 ~l2c1.set(\dur, ((x/(Window.screenBounds.width)).linexp(0,1,~outmin1,~outmax1))/~icd3);
1140                                 ~l2d1.set(\dur, q=((x/(Window.screenBounds.width)).linexp(0,1,~outmin1,~outmax1)).value/~icd3);
1141                                 ~l2e1.set(\dur, ((x/(Window.screenBounds.width)).linexp(0,1,~outmin1,~outmax1))/~icd6);
1142                                 ~l2f1.set(\dur, q=((x/(Window.screenBounds.width)).linexp(0,1,~outmin1,~outmax1)).value/~icd6);}
1143                         {y>=(~tgrid) and: y<=(~tgrid=~tgrid+10)} {
1144                                 ~l3a1.set(\dur, ((x/(Window.screenBounds.width)).linexp(0,1,~outmin1,~outmax1)));
1145                                 ~l3b1.set(\dur, q=((x/(Window.screenBounds.width)).linexp(0,1,~outmin1,~outmax1)).value); ~f3=q.value; ~undof3=~f3;
1146                                 ~l3c1.set(\dur, ((x/(Window.screenBounds.width)).linexp(0,1,~outmin1,~outmax1))/~icd3);
1147                                 ~l3d1.set(\dur, q=((x/(Window.screenBounds.width)).linexp(0,1,~outmin1,~outmax1)).value/~icd3);
1148                                 ~l3e1.set(\dur, ((x/(Window.screenBounds.width)).linexp(0,1,~outmin1,~outmax1))/~icd6);
1149                                 ~l3f1.set(\dur, q=((x/(Window.screenBounds.width)).linexp(0,1,~outmin1,~outmax1)).value/~icd6);}
1150                         {y>~tgrid and: y<~bgrid} {nil}
1151                         {y>=(~bgrid) and: y<=(~bgrid=~bgrid+10)} {
1152                                 ~l1a1.set(\dur, ((x/(Window.screenBounds.width)).linexp(0,1,~outmin2,~outmax2)));
1153                                 ~l1b1.set(\dur, q=((x/(Window.screenBounds.width)).linexp(0,1,~outmin2,~outmax2)).value); ~f1=q.value; ~undof1=~f1;
1154                                 ~l1c1.set(\dur, ((x/(Window.screenBounds.width)).linexp(0,1,~outmin2,~outmax2))/~icd3);
1155                                 ~l1d1.set(\dur, q=((x/(Window.screenBounds.width)).linexp(0,1,~outmin2,~outmax2)).value/~icd3);
1156                                 ~l1e1.set(\dur, ((x/(Window.screenBounds.width)).linexp(0,1,~outmin2,~outmax2))/~icd6);
1157                                 ~l1f1.set(\dur, q=((x/(Window.screenBounds.width)).linexp(0,1,~outmin2,~outmax2)).value/~icd6);}
1158                         {y>=(~bgrid) and: y<=(~bgrid=~bgrid+10)} {
1159                                 ~l2a1.set(\dur, ((x/(Window.screenBounds.width)).linexp(0,1,~outmin2,~outmax2)));
1160                                 ~l2b1.set(\dur, q=((x/(Window.screenBounds.width)).linexp(0,1,~outmin2,~outmax2)).value); ~f2=q.value; ~undof2=~f2;
1161                                 ~l2c1.set(\dur, ((x/(Window.screenBounds.width)).linexp(0,1,~outmin2,~outmax2))/~icd3);
1162                                 ~l2d1.set(\dur, q=((x/(Window.screenBounds.width)).linexp(0,1,~outmin2,~outmax2)).value/~icd3);
1163                                 ~l2e1.set(\dur, ((x/(Window.screenBounds.width)).linexp(0,1,~outmin2,~outmax2))/~icd6);
1164                                 ~l2f1.set(\dur, q=((x/(Window.screenBounds.width)).linexp(0,1,~outmin2,~outmax2)).value/~icd6);}
1165                         {y>=(~bgrid) and: y<=(~bgrid=~bgrid+10)} {
1166                                 ~l3a1.set(\dur, ((x/(Window.screenBounds.width)).linexp(0,1,~outmin2,~outmax2)));
1167                                 ~l3b1.set(\dur, q=((x/(Window.screenBounds.width)).linexp(0,1,~outmin2,~outmax2)).value); ~f3=q.value; ~undof3=~f3;
1168                                 ~l3c1.set(\dur, ((x/(Window.screenBounds.width)).linexp(0,1,~outmin2,~outmax2))/~icd3);
1169                                 ~l3d1.set(\dur, q=((x/(Window.screenBounds.width)).linexp(0,1,~outmin2,~outmax2)).value/~icd3);
1170                                 ~l3e1.set(\dur, ((x/(Window.screenBounds.width)).linexp(0,1,~outmin2,~outmax2))/~icd6);
1171                                 ~l3f1.set(\dur, q=((x/(Window.screenBounds.width)).linexp(0,1,~outmin2,~outmax2)).value/~icd6);};
1172                 };
1173         };
1174
1175         ~tgrid = 30;
1176         ~bgrid = Window.screenBounds.height-(Window.screenBounds.height/1.6180339887499)+30;
1177         ~dc1 = ~tgrid-5; ~dc2 = ~bgrid-5; ~dca = 10;
1178
1179         ~bpl = Window.screenBounds.width-340;
1180         ~bpt = Window.screenBounds.height-88;
1181         ~bph = 40;
1182         ~bpw = 40/1.6180339887499;
1183
1184
1185         //copy button
1186
1187         b = Button.new(w,Rect(Window.screenBounds.width*0+80,Window.screenBounds.height-52,60,60/1.6180339887499)).states_([["copy",Color.white,Color.black],["copy",Color.white,Color.black]]).action_({arg button; button.value.postln}).action_({arg button;
1188                 if(button.value == 1, {
1189
1190                         ~tsc = TextView(w, Rect(0,5, Window.screenBounds.width, 354)).background_(Color.black);
1191                         (~tsc.string =
1192                                 "current chord/frequencies: "++"\n"++"\n"++
1193
1194                                 "[~f1="++~f1.asString++",~f2="++~f2.asString++",~f3="++~f3.asString++"]"++"\n"++"\n"++
1195
1196                                 "saved open/flow 1-8 frequencies (in script format): "++"\n"++"\n"++
1197
1198                                 "[~f1="++~fp1.asString++",~f2="++~fp2.asString++",~f3="++~fp3.asString++"];"++" "++"~synthopen.value; ~trace.value; (a).wait;"++"\n"++
1199                                 "[~f1="++~fp1b.asString++",~f2="++~fp2b.asString++",~f3="++~fp3b.asString++"];"++" "++"~synthflow.value; ~trace.value; (a).wait;"++"\n"++
1200                                 "[~f1="++~fp1c.asString++",~f2="++~fp2c.asString++",~f3="++~fp3c.asString++"];"++" "++"~synthflow.value; ~trace.value; (a).wait;"++"\n"++
1201                                 "[~f1="++~fp1d.asString++",~f2="++~fp2d.asString++",~f3="++~fp3d.asString++"];"++" "++"~synthflow.value; ~trace.value; (a).wait;"++"\n"++
1202                                 "[~f1="++~fp1e.asString++",~f2="++~fp2e.asString++",~f3="++~fp3e.asString++"];"++" "++"~synthflow.value; ~trace.value; (a).wait;"++"\n"++
1203                                 "[~f1="++~fp1f.asString++",~f2="++~fp2f.asString++",~f3="++~fp3f.asString++"];"++" "++"~synthflow.value; ~trace.value; (a).wait;"++"\n"++
1204                                 "[~f1="++~fp1g.asString++",~f2="++~fp2g.asString++",~f3="++~fp3g.asString++"];"++" "++"~synthflow.value; ~trace.value; (a).wait;"++"\n"++
1205                                 "[~f1="++~fp1h.asString++",~f2="++~fp2h.asString++",~f3="++~fp3h.asString++"];"++" "++"~synthflow.value; ~trace.value; (a).wait;"++"\n"++"\n"++
1206
1207                                 "saved slide 1-8 frequencies (in script format): "++"\n"++"\n"++
1208
1209                                 "#s,t,u = [ ~f1,~f2,~f3 ]; [~f1="++~fp1.asString++",~f2="++~fp2.asString++",~f3="++~fp3.asString++"];"++" "++"~slidetime = 1; ~slidedo = 432; ~synthslide.value; ~trace.value; (a).wait;"++"\n"++
1210                                 "#s,t,u = [ ~f1,~f2,~f3 ]; [~f1="++~fp1b.asString++",~f2="++~fp2b.asString++",~f3="++~fp3b.asString++"];"++" "++"~slidetime = 1; ~slidedo = 432; ~synthslide.value; ~trace.value; (a).wait;"++"\n"++
1211                                 "#s,t,u = [ ~f1,~f2,~f3 ]; [~f1="++~fp1c.asString++",~f2="++~fp2c.asString++",~f3="++~fp3c.asString++"];"++" "++"~slidetime = 1; ~slidedo = 432; ~synthslide.value; ~trace.value; (a).wait;"++"\n"++
1212                                 "#s,t,u = [ ~f1,~f2,~f3 ]; [~f1="++~fp1d.asString++",~f2="++~fp2d.asString++",~f3="++~fp3d.asString++"];"++" "++"~slidetime = 1; ~slidedo = 432; ~synthslide.value; ~trace.value; (a).wait;"++"\n"++
1213                                 "#s,t,u = [ ~f1,~f2,~f3 ]; [~f1="++~fp1e.asString++",~f2="++~fp2e.asString++",~f3="++~fp3e.asString++"];"++" "++"~slidetime = 1; ~slidedo = 432; ~synthslide.value; ~trace.value; (a).wait;"++"\n"++
1214                                 "#s,t,u = [ ~f1,~f2,~f3 ]; [~f1="++~fp1f.asString++",~f2="++~fp2f.asString++",~f3="++~fp3f.asString++"];"++" "++"~slidetime = 1; ~slidedo = 432; ~synthslide.value; ~trace.value; (a).wait;"++"\n"++
1215                                 "#s,t,u = [ ~f1,~f2,~f3 ]; [~f1="++~fp1g.asString++",~f2="++~fp2g.asString++",~f3="++~fp3g.asString++"];"++" "++"~slidetime = 1; ~slidedo = 432; ~synthslide.value; ~trace.value; (a).wait;"++"\n"++
1216                                 "#s,t,u = [ ~f1,~f2,~f3 ]; [~f1="++~fp1h.asString++",~f2="++~fp2h.asString++",~f3="++~fp3h.asString++"];"++" "++"~slidetime = 1; ~slidedo = 432; ~synthslide.value; ~trace.value; (a).wait;"
1217                         );
1218                         ~tsc.stringColor = Color.white;
1219                         [ ~f1,~f2,~f3 ].postln;},
1220                 {~tsc.close;});
1221         });
1222
1223
1224         /*//stop timer button
1225
1226         sts = Button.new(w,Rect(Window.screenBounds.width-20-20-20-20,~bpt+69+5,20,20/1.6180339887499)).states_([["st",Color.white,Color.black],["st",Color.white,Color.black]]).action_({arg button; button.value.postln}).action_({arg button;
1227         if(~timer.isPlaying == true, {
1228         if(~tst.value == nil, {~timer.stop; ~systemclock.stop; ~systemclock.clear;},{~tst.close;
1229         ~timevals.value;
1230         ~timer.stop; ~systemclock.stop; ~systemclock.clear;});
1231         });
1232         });*/
1233
1234
1235         //timer button
1236
1237         ~ts = Button.new(w,Rect(Window.screenBounds.width*0+20,Window.screenBounds.height-52,60,60/1.6180339887499)).states_([["tsynth0",Color.white,Color.black],["tsynth1",Color.white,Color.black]]).action_({arg synthbutton; synthbutton.value.postln}).action_({arg synthbutton; if(synthbutton.value == 1, {
1238
1239                 ~sts = Button.new(w,Rect(~bp01l-90,~bp01t,80,20)).states_([["stop timer",Color.white,Color.black],["stop timer",Color.white,Color.black]]).action_({arg button; button.value.postln}).action_({arg button;
1240                         if(~timer.isPlaying == true, {
1241                                 if(~tst.value == nil, {~timer.stop; ~systemclock.stop; ~systemclock.clear;},{~tst.close;
1242                                         ~timevals.value;
1243                                         ~timer.stop; ~systemclock.stop; ~systemclock.clear;});
1244                         });
1245                 });
1246
1247                 if(~tst != nil, {~tst.close});
1248                 ~timevals.value;
1249                 ~timer.stop; ~systemclock.stop; ~systemclock.clear;},{if(~tst.value == nil, {~timer.stop; ~systemclock.stop; ~systemclock.clear;},{~timer.stop; ~systemclock.stop; ~systemclock.clear; ~tst.close; ~sts.close;})});
1250
1251         });
1252
1253
1254         //start/stop synth button
1255
1256         b3 = Button.new(w,Rect(Window.screenBounds.width*0+20,Window.screenBounds.height-88,60,60/1.6180339887499)).states_([["synth0",Color.white,Color.black],["synth1",Color.white,Color.black]]).action_({arg synthbutton; synthbutton.value.postln}).action_({
1257                 arg synthbutton; if(synthbutton.value == 1, {
1258                         ~l1a = Synth(\gsineicfld, [\dur, 432]).register;~l1a1 = Synth(\gsineicfld, [\dur, 432]).register;[~l1a, ~l1a1].do(_.free);~l1a = Synth(\gsineicfld, [\dur, 432]).register;~l1a1 = Synth(\gsineicfld, [\dur, 432]).register;[~l1a, ~l1a1].do(_.free);
1259                         ~synthopen.value;
1260                         ~numsynths.stop; ~numsynthsfunc.value;
1261                         ~midifunc.value;
1262                 },
1263                 {~synthfree.value; b4.value = 0;})
1264         });
1265
1266
1267         //pause/unpause button
1268
1269         b4 = Button.new(w,Rect(Window.screenBounds.width*0+80,Window.screenBounds.height-88,60,60/1.6180339887499)).states_([["pause0",Color.white,Color.black],["pause1",Color.white,Color.black]]).action_({arg synthbutton; synthbutton.value.postln}).action_({
1270                 arg synthbutton; if(synthbutton.value == 1, {~synthpause.value; if(~ts.value == 1, {~timer.stop;});},
1271                         {~synthflow.value; if(~ts.value != 1, {nil}, {SystemClock.play(~timer);})})
1272         });
1273
1274
1275         //generate values for number of KW(King Wen) sequences in a timewave half-cycle (or amplitude x2) pop-up menu
1276
1277         if(~low_pass_filter_set_value == nil, {~low_pass_filter_set_value = ~low_pass_filter_freq_limit});
1278         if(~low_pass_filter_set_value != ~low_pass_filter_freq_limit, {~low_pass_filter_set_value = ~low_pass_filter_freq_limit});
1279
1280
1281         //settings function
1282
1283         ~settingsbutton = Button.new(w,Rect(20+60*2+15+25,Window.screenBounds.height-88+(30/1.6180339887499*0),60,60/1.6180339887499)).states_([["settings",Color.white,Color.black],["settings",Color.white,Color.black]]).action_({arg button;
1284
1285                 if(button.value == 1, {
1286
1287                         ({
1288                                 arg  top = 0,width=150, revertwidth=75, height = 25,  heightbox = 25, lefttime = 0 , lefttimebox = width+5,  widthbox=165, leftdo = lefttimebox+widthbox+5, leftdobox = leftdo+57, inc=0, lw = 0,  uw = 0, numw = 40;
1289                                 var tall, stall, iall, siall, st1, st2, st3, st4, st5, st6, st7, st8, st9, st10, st11, st12, si1, si2, si3, si4, si5, si6, si7, si8, t1,t2,t3,t4,t5,t6,t7,t8,t9,t10,t11,t12,i1,i2,i3,i4,i5,i6,i7,i8,i9,i10,i11,i12;
1290                                 ~settingsview = View(w, Rect(20+60*2+15+25,Window.screenBounds.height-340,340,340/1.6180339887499)).front;
1291                                 /*w.view.decorator=FlowLayout(w.view.bounds);
1292                                 w.view.decorator.gap=2@2;*/
1293
1294                                 top = 0;
1295
1296                                 t1 = StaticText(~settingsview, Rect(lefttime , top=top, width, height)).background_(Color.black).string_("KWS number").stringColor_(Color.white);
1297                                 t2 = StaticText(~settingsview, Rect(lefttime , top=top+height+5, width, height)).background_(Color.black).string_("base(lowest) freq(hz)").stringColor_(Color.white);
1298                                 t3 = StaticText(~settingsview, Rect(lefttime , top=top+height+5, width, height)).background_(Color.black).string_("synthdef type").stringColor_(Color.white);
1299                                 t4 = StaticText(~settingsview, Rect(lefttime , top=top+height+5, width, height)).background_(Color.black).string_("lp filter limit(hz)").stringColor_(Color.white);
1300                                 t5 = StaticText(~settingsview, Rect(lefttime , top=top+height+5, width, height)).background_(Color.black).string_("automate").stringColor_(Color.white);
1301
1302
1303                                 top = 0;
1304
1305
1306                                 //number of KW(King Wen) sequences in a timewave half-cycle (or amplitude x2) pop-up menu
1307
1308                                 ~menu2 = PopUpMenu(~settingsview,Rect(lefttimebox , top=top, widthbox, heightbox)).items_(x = 0; Array.fill(24, {(x=x+1).asString++" kws"});).background_(Color.black).stringColor_(Color.white).action_({arg button;
1309
1310                                         if(~st != nil, {~st.close});
1311                                         ~st = StaticText(~settingsview, Rect(lefttime, top, 200, 20)).background_(Color.black);
1312                                         ~st.stringColor = Color.white;
1313                                         ~st.string = "# of kws in halfcycle selected";
1314                                         AppClock.sched(~gm,{~st.close;});
1315                                 });
1316
1317                                 ~menu2.value = ~gsinenum-1;
1318
1319
1320                                 //pop-menu for timewave base(lowest) frequency
1321
1322                                 ~bfreq = PopUpMenu(~settingsview, Rect(lefttimebox , top=top+heightbox+5, widthbox, heightbox)).items_(~bfreqv = (-1); Array.fill(~basefreqmap.size, {~basefreqmap.at(~bfreqv=~bfreqv+1).asString})).background_(Color.black).stringColor_(Color.white).action_({arg button;
1323
1324                                         if(~st != nil, {~st.close});
1325                                         ~st = StaticText(~settingsview, Rect(lefttime, top, 200, 20)).background_(Color.black);
1326                                         ~st.stringColor = Color.white;
1327                                         ~st.string = "basefreq selected";
1328                                         AppClock.sched(~gm,{~st.close;});
1329                                 });
1330
1331                                 if(~bfreqval != nil, {~bfreq.value = ~bfreqval}, {~bfreq.value = ~basefreqmap.indexOf(~base_frequency);});
1332
1333
1334                                 //synthdef pop-up menu
1335
1336                                 ~gsinemenu = PopUpMenu(~settingsview, Rect(lefttimebox , top=top+heightbox+5, widthbox, heightbox)).items_(["psine1","psine2","psine3","hsine1","hsine2","hsine3","psineuf1","psineuf2","psineuf3","hsineuf1","hsineuf2","hsineuf3"]).background_(Color.black).stringColor_(Color.white).action_({arg button;
1337
1338                                         if(~gsinemenu.value == 0,  {~kws_setting = 1; ~ratio_setting = "psine1"; ~low_pass_filter_on = 1; ~gs = 0;});
1339                                         if(~gsinemenu.value == 1,  {~kws_setting = 2; ~ratio_setting = "psine2"; ~low_pass_filter_on = 1; ~gs = 1;});
1340                                         if(~gsinemenu.value == 2,  {~kws_setting = 3; ~ratio_setting = "psine3"; ~low_pass_filter_on = 1; ~gs = 2;});
1341                                         if(~gsinemenu.value == 3,  {~kws_setting = 1; ~ratio_setting = "hsine1"; ~low_pass_filter_on = 1; ~gs = 3;});
1342                                         if(~gsinemenu.value == 4,  {~kws_setting = 2; ~ratio_setting = "hsine2"; ~low_pass_filter_on = 1; ~gs = 4;});
1343                                         if(~gsinemenu.value == 5,  {~kws_setting = 3; ~ratio_setting = "hsine3"; ~low_pass_filter_on = 1; ~gs = 5;});
1344                                         if(~gsinemenu.value == 6,  {~kws_setting = 1; ~ratio_setting = "psine1"; ~low_pass_filter_on = 0; ~gs = 6;});
1345                                         if(~gsinemenu.value == 7,  {~kws_setting = 2; ~ratio_setting = "psine2"; ~low_pass_filter_on = 0; ~gs = 7;});
1346                                         if(~gsinemenu.value == 8,  {~kws_setting = 3; ~ratio_setting = "psine3"; ~low_pass_filter_on = 0; ~gs = 8;});
1347                                         if(~gsinemenu.value == 9,  {~kws_setting = 1; ~ratio_setting = "hsine1"; ~low_pass_filter_on = 0; ~gs = 9;});
1348                                         if(~gsinemenu.value == 10, {~kws_setting = 2; ~ratio_setting = "hsine2"; ~low_pass_filter_on = 0; ~gs = 10;});
1349                                         if(~gsinemenu.value == 11, {~kws_setting = 3; ~ratio_setting = "hsine3"; ~low_pass_filter_on = 0; ~gs = 11;});
1350
1351                                         if(~st != nil, {~st.close});
1352                                         ~st = StaticText(~settingsview, Rect(lefttime, top, 200, 20)).background_(Color.black);
1353                                         ~st.stringColor = Color.white;
1354                                         ~st.string = "synthdef setting selected";
1355                                         AppClock.sched(~gm,{~st.close;});
1356                                 });
1357
1358                                 if(~gs == nil, {~gs = 0;});
1359
1360                                 case
1361                                 {~gs == 0}{~gsinemenu.value = 0;}
1362                                 {~gs == 1}{~gsinemenu.value = 1;}
1363                                 {~gs == 2}{~gsinemenu.value = 2;}
1364                                 {~gs == 3}{~gsinemenu.value = 3;}
1365                                 {~gs == 4}{~gsinemenu.value = 4;}
1366                                 {~gs == 5}{~gsinemenu.value = 5;}
1367                                 {~gs == 0}{~gsinemenu.value = 6;}
1368                                 {~gs == 1}{~gsinemenu.value = 7;}
1369                                 {~gs == 2}{~gsinemenu.value = 8;}
1370                                 {~gs == 3}{~gsinemenu.value = 9;}
1371                                 {~gs == 4}{~gsinemenu.value = 10;}
1372                                 {~gs == 5}{~gsinemenu.value = 11;};
1373
1374
1375                                 //set low-pass filter frequency limit
1376
1377                                 ~low_pass_filter_textfield = TextField(~settingsview, Rect(lefttimebox , top=top+heightbox+5, widthbox, heightbox));
1378                                 ~low_pass_filter_textfield.string = ~low_pass_filter_set_value.asString;
1379                                 ~low_pass_filter_textfield.background_(Color.black);
1380                                 ~low_pass_filter_textfield.stringColor_(Color.white);
1381                                 ~low_pass_filter_textfield.action = {arg value; ~freqsetvalue = value.value;
1382
1383                                         ~freqset_textfield_func.value; //this function is found after line 2900
1384
1385                                         ~low_pass_filter_set_value = ~freqsetvalue.value;
1386
1387                                         ~low_pass_filter_textfield.string = ~low_pass_filter_set_value.asString;
1388
1389                                         if(~low_pass_filter_set_value != 0, {
1390                                                 if(~st != nil, {~st.close});
1391                                                 ~st = StaticText(~settingsview, Rect(lefttime, top, 240, 20)).background_(Color.black);
1392                                                 ~st.stringColor = Color.white;
1393                                                 ~st.string = "low-pass filter freq limit selected";
1394                                                 AppClock.sched(~gm,{~st.close;});
1395                                         }, {~low_pass_filter_set_value = ~low_pass_filter_freq_limit; ~low_pass_filter_textfield.string = ~low_pass_filter_set_value.asString;});
1396                                 };
1397
1398
1399                                 //switch to sendreply functions
1400
1401                                 ~sendreplymenu = PopUpMenu(~settingsview,Rect(lefttimebox , top=top+heightbox+5, widthbox, heightbox)).items_(["off","phi/fth trans","phi trans","western scale","eastern scale"]).background_(Color.black).stringColor_(Color.white).action_({arg button;
1402
1403                                         case
1404                                         {button.value == 0;}{~sendreplymenu_value = 0;}
1405                                         {button.value == 1;}{~sendreplymenu_value = 1;}
1406                                         {button.value == 2;}{~sendreplymenu_value = 2;}
1407                                         {button.value == 3;}{~sendreplymenu_value = 3;}
1408                                         {button.value == 4;}{~sendreplymenu_value = 4;};
1409
1410                                         if(~st != nil, {~st.close});
1411                                         ~st = StaticText(~settingsview, Rect(lefttime, top, 200, 20)).background_(Color.black);
1412                                         ~st.stringColor = Color.white;
1413                                         ~st.string = "automate setting selected";
1414                                         AppClock.sched(~gm,{~st.close;});
1415                                 });
1416
1417                                 if(~sendreplymenu_value == nil, {~sendreplymenu_value = 0;});
1418
1419                                 case
1420                                 {~sendreplymenu_value == 0}{~sendreplymenu.value = 0;}
1421                                 {~sendreplymenu_value == 1}{~sendreplymenu.value = 1;}
1422                                 {~sendreplymenu_value == 2}{~sendreplymenu.value = 2;}
1423                                 {~sendreplymenu_value == 3}{~sendreplymenu.value = 3;}
1424                                 {~sendreplymenu_value == 4}{~sendreplymenu.value = 4;};
1425
1426
1427                                 //set button for all settings
1428
1429                                 ~set1=Button(~settingsview,Rect(lefttimebox+widthbox-60, top=top+height+20, 60, 60/~gm)).states_([["set",Color.white,Color.black]]).mouseDownAction_({
1430
1431                                         ~basefreq = ~basefreqmap.at(~bfreq.value;); ~bfreqval = ~bfreq.value;
1432
1433                                         (#a,b,c,d,e,f = [ ~basefreq,~basefreq,~basefreq,~basefreq,~basefreq,~basefreq  ]; ~a = a; ~b = b; ~c =c; ~d = d; ~e = e;~f=f;);
1434
1435                                         ~low_pass_filter_freq_limit = ~low_pass_filter_set_value;
1436
1437
1438                                         //set n1-n9 values
1439
1440                                         case
1441                                         {~ratio_setting == "psine1";}{~n_value1 = ~gm;    ~n_value2 = ~gm2;   ~n_value6 = ~gm6;}
1442                                         {~ratio_setting == "psine2";}{~n_value1 = ~ngm1;  ~n_value2 = ~ngm2;  ~n_value6 = ~ngm6;}
1443                                         {~ratio_setting == "psine3";}{~n_value1 = ~nngm1; ~n_value2 = ~nngm2; ~n_value6 = ~nngm6;}
1444                                         {~ratio_setting == "hsine1";}{~n_value1 = ~h1;    ~n_value2 = ~h2;    ~n_value6 = ~h6;}
1445                                         {~ratio_setting == "hsine2";}{~n_value1 = ~nh1;   ~n_value2 = ~nh2;   ~n_value6 = ~nh6;}
1446                                         {~ratio_setting == "hsine3";}{~n_value1 = ~nnh1;  ~n_value2 = ~nnh2;  ~n_value6 = ~nnh6;};
1447
1448
1449                                         //sendyreply values
1450
1451                                         case
1452                                         {~sendreplymenu.value ==  0}{~sendreplysynthdef_on = 0;}
1453                                         {~sendreplymenu.value ==  1}{~sendreplysynthdef_on = 1; ~sendreplyfunc_choose = 0; ~sendreply_gm_fth_func = ~sendreply_gm_fth_func_1}
1454                                         {~sendreplymenu.value ==  2}{~sendreplysynthdef_on = 1; ~sendreplyfunc_choose = 0; ~sendreply_gm_fth_func = ~sendreply_gm_fth_func_2}
1455                                         {~sendreplymenu.value ==  3}{~sendreplysynthdef_on = 1; ~sendreplyfunc_choose = 1; ~send_reply_random_func = ~send_reply_random_func_western; ~sendreplyfuncswitch = 1;}
1456                                         {~sendreplymenu.value ==  4}{~sendreplysynthdef_on = 1; ~sendreplyfunc_choose = 1; ~send_reply_random_func = ~send_reply_random_func_eastern; ~sendreplyfuncswitch = 2;};
1457
1458
1459                                         //evaluate synthdefs(gsine)
1460
1461                                         case
1462                                         {~menu2.value == 0}{~gsinenum = 1; ~gsine.value;}
1463                                         {~menu2.value == 1}{~gsinenum = 2; ~gsine.value;}
1464                                         {~menu2.value == 2}{~gsinenum = 3; ~gsine.value;}
1465                                         {~menu2.value == 3}{~gsinenum = 4; ~gsine.value;}
1466                                         {~menu2.value == 4}{~gsinenum = 5; ~gsine.value;}
1467                                         {~menu2.value == 5}{~gsinenum = 6; ~gsine.value;}
1468                                         {~menu2.value == 6}{~gsinenum = 7; ~gsine.value;}
1469                                         {~menu2.value == 7}{~gsinenum = 8; ~gsine.value;}
1470                                         {~menu2.value == 8}{~gsinenum = 9; ~gsine.value;}
1471                                         {~menu2.value == 9}{~gsinenum = 10; ~gsine.value;}
1472                                         {~menu2.value == 10}{~gsinenum = 11; ~gsine.value;}
1473                                         {~menu2.value == 11}{~gsinenum = 12; ~gsine.value;}
1474                                         {~menu2.value == 12}{~gsinenum = 13; ~gsine.value;}
1475                                         {~menu2.value == 13}{~gsinenum = 14; ~gsine.value;}
1476                                         {~menu2.value == 14}{~gsinenum = 15; ~gsine.value;}
1477                                         {~menu2.value == 15}{~gsinenum = 16; ~gsine.value;}
1478                                         {~menu2.value == 16}{~gsinenum = 17; ~gsine.value;}
1479                                         {~menu2.value == 17}{~gsinenum = 18; ~gsine.value;}
1480                                         {~menu2.value == 18}{~gsinenum = 19; ~gsine.value;}
1481                                         {~menu2.value == 19}{~gsinenum = 20; ~gsine.value;}
1482                                         {~menu2.value == 20}{~gsinenum = 21; ~gsine.value;}
1483                                         {~menu2.value == 21}{~gsinenum = 22; ~gsine.value;}
1484                                         {~menu2.value == 22}{~gsinenum = 23; ~gsine.value;}
1485                                         {~menu2.value == 23}{~gsinenum = 24; ~gsine.value;};
1486
1487                                         ~st_load = StaticText(~settingsview, Rect(lefttime, top, 200, 20)).background_(Color.black);
1488                                         ~st_load.stringColor = Color.white;
1489                                         ~st_load.string = "loaded.";
1490                                         AppClock.sched(~gm,{if(~st != nil, {~st.close}); ~st_load.close;});
1491
1492                                 });
1493
1494                                 ~settingsview.background_(Color.black);
1495
1496                                 /*~closessettingsbutton = Button.new(~settingsview,Rect(lefttimebox+widthbox-40, top, 40, 40/~gm)).states_([["close",Color.white,Color.black]]).action_({arg button;
1497
1498                                 ~settingsview.close; ~settingsbutton.value = 0;
1499                                 });*/
1500
1501
1502                         }.value);
1503
1504                         ~settingsview.front;
1505                 }, {~settingsview.close});
1506         });
1507
1508
1509         //open/flow/slide buttons coordinate values
1510
1511         ~bph = 26;
1512         ~bpw = 26/1.6180339887499;
1513         ~bpl = Window.screenBounds.width-(~bph*8)-20;
1514         ~bpt = Window.screenBounds.height-88;
1515
1516         ~bp01l = ~bpl;
1517         ~bp02l = ~bpl+(~bph*1);
1518         ~bp03l = ~bpl+(~bph*2);
1519         ~bp04l = ~bpl+(~bph*3);
1520         ~bp05l = ~bpl+(~bph*4);
1521         ~bp06l = ~bpl+(~bph*5);
1522         ~bp07l = ~bpl+(~bph*6);
1523         ~bp08l = ~bpl+(~bph*7);
1524         ~bpf1l = ~bpl;
1525         ~bpf2l = ~bpl+(~bph*1);
1526         ~bpf3l = ~bpl+(~bph*2);
1527         ~bpf4l = ~bpl+(~bph*3);
1528         ~bpf5l = ~bpl+(~bph*4);
1529         ~bpf6l = ~bpl+(~bph*5);
1530         ~bpf7l = ~bpl+(~bph*6);
1531         ~bpf8l = ~bpl+(~bph*7);
1532
1533         ~bp01t = ~bpt;
1534         ~bp02t = ~bpt;
1535         ~bp03t = ~bpt;
1536         ~bp04t = ~bpt;
1537         ~bp05t = ~bpt;
1538         ~bp06t = ~bpt;
1539         ~bp07t = ~bpt;
1540         ~bp08t = ~bpt;
1541         ~bpf1t = ~bpt+~bpw;
1542         ~bpf2t = ~bpt+~bpw;
1543         ~bpf3t = ~bpt+~bpw;
1544         ~bpf4t = ~bpt+~bpw;
1545         ~bpf5t = ~bpt+~bpw;
1546         ~bpf6t = ~bpt+~bpw;
1547         ~bpf7t = ~bpt+~bpw;
1548         ~bpf8t = ~bpt+~bpw;
1549
1550         ~bp01h = ~bph;
1551         ~bp02h = ~bph;
1552         ~bp03h = ~bph;
1553         ~bp04h = ~bph;
1554         ~bp05h = ~bph;
1555         ~bp06h = ~bph;
1556         ~bp07h = ~bph;
1557         ~bp08h = ~bph;
1558         ~bpf1h = ~bph;
1559         ~bpf2h = ~bph;
1560         ~bpf3h = ~bph;
1561         ~bpf4h = ~bph;
1562         ~bpf5h = ~bph;
1563         ~bpf6h = ~bph;
1564         ~bpf7h = ~bph;
1565         ~bpf8h = ~bph;
1566
1567         ~bp01w = ~bpw;
1568         ~bp02w = ~bpw;
1569         ~bp03w = ~bpw;
1570         ~bp04w = ~bpw;
1571         ~bp05w = ~bpw;
1572         ~bp06w = ~bpw;
1573         ~bp07w = ~bpw;
1574         ~bp08w = ~bpw;
1575         ~bpf1w = ~bpw;
1576         ~bpf2w = ~bpw;
1577         ~bpf3w = ~bpw;
1578         ~bpf4w = ~bpw;
1579         ~bpf5w = ~bpw;
1580         ~bpf6w = ~bpw;
1581         ~bpf7w = ~bpw;
1582         ~bpf8w = ~bpw;
1583
1584         ~tspw=280+210;
1585         ~tsph=280+210/~gm;
1586         ~tspl=Window.screenBounds.width-~tspw;
1587         ~tspt=~bpt-310;
1588
1589
1590         //synthopen 1-8 buttons
1591
1592         ~bplaceo1 = Button.new(w,Rect(~bp01l,~bp01t,~bp01h,~bp01w)).states_([["o1",Color.white,Color.black]]).action_({arg button; button.value.postln}).action_({arg button;
1593
1594                 [~f1=~fp1,~f2=~fp2,~f3=~fp3];
1595
1596                 ~synthopen.value;
1597                 ~currentsynth = "o1"; ~synthmonitorfunc.value;
1598
1599                 if(~ts.value == 1,
1600                         {if(~tst == nil, {nil}, {~tst.close;});
1601                                 ~timevals.value;
1602                                 ~timer.stop; ~systemclock.stop; ~systemclock.clear; ~time1o = 0;
1603                                 ~timer = Routine({inf.do({
1604                                         ~time1o =
1605                                         ~time1o+0.01; ~slot = "o1_"+~time1o.asString; 0.01.wait;});}); ~systemclock = SystemClock.play(~timer);},
1606                         {nil});
1607         });
1608
1609         ~bplaceo2 = Button.new(w,Rect(~bp02l,~bp02t,~bp02h,~bp02w)).states_([["o2",Color.white,Color.black]]).action_({arg button; button.value.postln}).action_({arg button;
1610
1611                 [~f1=~fp1b,~f2=~fp2b,~f3=~fp3b];
1612
1613                 ~synthopen.value;
1614                 ~currentsynth = "o2"; ~synthmonitorfunc.value;
1615
1616                 if(~ts.value == 1,
1617                         {if(~tst == nil, {nil}, {~tst.close;});
1618                                 ~timevals.value;
1619                                 ~timer.stop; ~systemclock.stop; ~systemclock.clear; ~time2o = 0;
1620                                 ~timer = Routine({inf.do({
1621                                         ~time2o =
1622                                         ~time2o+0.01; ~slot = "o2_"+~time2o.asString; 0.01.wait;});}); ~systemclock = SystemClock.play(~timer);},
1623                         {nil});
1624         });
1625         ~bplaceo3 = Button.new(w,Rect(~bp03l,~bp03t,~bp03h,~bp03w)).states_([["o3",Color.white,Color.black]]).action_({arg button; button.value.postln}).action_({arg button;
1626
1627                 [~f1=~fp1c,~f2=~fp2c,~f3=~fp3c];
1628
1629                 ~synthopen.value;
1630                 ~currentsynth = "o3"; ~synthmonitorfunc.value;
1631
1632                 if(~ts.value == 1,
1633                         {if(~tst == nil, {nil}, {~tst.close;});
1634                                 ~timevals.value;
1635                                 ~timer.stop; ~systemclock.stop; ~systemclock.clear; ~time3o = 0;
1636                                 ~timer = Routine({inf.do({
1637                                         ~time3o =
1638                                         ~time3o+0.01; ~slot = "o3_"+~time3o.asString; 0.01.wait;});}); ~systemclock = SystemClock.play(~timer);},
1639                         {nil});
1640         });
1641         ~bplaceo4 = Button.new(w,Rect(~bp04l,~bp04t,~bp04h,~bp04w)).states_([["o4",Color.white,Color.black]]).action_({arg button; button.value.postln}).action_({arg button;
1642
1643                 [~f1=~fp1d,~f2=~fp2d,~f3=~fp3d];
1644
1645                 ~synthopen.value;
1646                 ~currentsynth = "o4"; ~synthmonitorfunc.value;
1647
1648                 if(~ts.value == 1,
1649                         {if(~tst == nil, {nil}, {~tst.close;});
1650                                 ~timevals.value;
1651                                 ~timer.stop; ~systemclock.stop; ~systemclock.clear; ~time4o = 0;
1652                                 ~timer = Routine({inf.do({
1653                                         ~time4o =
1654                                         ~time4o+0.01; ~slot = "o4_"+~time4o.asString; 0.01.wait;});}); ~systemclock = SystemClock.play(~timer);},
1655                         {nil});
1656
1657         });
1658
1659         ~bplaceo5 = Button.new(w,Rect(~bp05l,~bp05t,~bp05h,~bp05w)).states_([["o5",Color.white,Color.black]]).action_({arg button; button.value.postln}).action_({arg button;
1660
1661                 [~f1=~fp1e,~f2=~fp2e,~f3=~fp3e];
1662
1663                 ~synthopen.value;
1664                 ~currentsynth = "o5"; ~synthmonitorfunc.value;
1665
1666                 if(~ts.value == 1,
1667                         {if(~tst == nil, {nil}, {~tst.close;});
1668                                 ~timevals.value;
1669                                 ~timer.stop; ~systemclock.stop; ~systemclock.clear; ~time5o = 0;
1670                                 ~timer = Routine({inf.do({
1671                                         ~time5o =
1672                                         ~time5o+0.01; ~slot = "o5_"+~time5o.asString; 0.01.wait;});}); ~systemclock = SystemClock.play(~timer);},
1673                         {nil});
1674
1675         });
1676         ~bplaceo6 = Button.new(w,Rect(~bp06l,~bp06t,~bp06h,~bp06w)).states_([["o6",Color.white,Color.black]]).action_({arg button; button.value.postln}).action_({arg button;
1677
1678                 [~f1=~fp1f,~f2=~fp2f,~f3=~fp3f];
1679
1680                 ~synthopen.value;
1681                 ~currentsynth = "o6"; ~synthmonitorfunc.value;
1682
1683                 if(~ts.value == 1,
1684                         {if(~tst == nil, {nil}, {~tst.close;});
1685                                 ~timevals.value;
1686                                 ~timer.stop; ~systemclock.stop; ~systemclock.clear; ~time6o = 0;
1687                                 ~timer = Routine({inf.do({
1688                                         ~time6o =
1689                                         ~time6o+0.01; ~slot = "o6_"+~time6o.asString; 0.01.wait;});}); ~systemclock = SystemClock.play(~timer);},
1690                         {nil});
1691         });
1692         ~bplaceo7 = Button.new(w,Rect(~bp07l,~bp07t,~bp07h,~bp07w)).states_([["o7",Color.white,Color.black]]).action_({arg button; button.value.postln}).action_({arg button;
1693
1694                 [~f1=~fp1g,~f2=~fp2g,~f3=~fp3g];
1695
1696                 ~synthopen.value;
1697                 ~currentsynth = "o7"; ~synthmonitorfunc.value;
1698
1699                 if(~ts.value == 1,
1700                         {if(~tst == nil, {nil}, {~tst.close;});
1701                                 ~timevals.value;
1702                                 ~timer.stop; ~systemclock.stop; ~systemclock.clear; ~time7o = 0;
1703                                 ~timer = Routine({inf.do({
1704                                         ~time7o =
1705                                         ~time7o+0.01; ~slot = "o7_"+~time7o.asString; 0.01.wait;});}); ~systemclock = SystemClock.play(~timer);},
1706                         {nil});
1707         });
1708         ~bplaceo8 = Button.new(w,Rect(~bp08l,~bp08t,~bp08h,~bp08w)).states_([["o8",Color.white,Color.black]]).action_({arg button; button.value.postln}).action_({arg button;
1709
1710                 [~f1=~fp1h,~f2=~fp2h,~f3=~fp3h];
1711
1712                 ~synthopen.value;
1713                 ~currentsynth = "o8"; ~synthmonitorfunc.value;
1714
1715                 if(~ts.value == 1,
1716                         {if(~tst == nil, {nil}, {~tst.close;});
1717                                 ~timevals.value;
1718                                 ~timer.stop; ~systemclock.stop; ~systemclock.clear; ~time8o = 0;
1719                                 ~timer = Routine({inf.do({
1720                                         ~time8o =
1721                                         ~time8o+0.01; ~slot = "o8_"+~time8o.asString; 0.01.wait;});}); ~systemclock = SystemClock.play(~timer);},
1722                         {nil});
1723         });
1724
1725
1726         //synthflow 1-8 buttons
1727
1728         ~bplacef1 = Button.new(w,Rect(~bpf1l,~bpf1t,~bpf1h,~bpf1w)).states_([["f1",Color.white,Color.black]]).action_({arg button; button.value.postln}).action_({arg button;
1729
1730                 [~f1=~fp1,~f2=~fp2,~f3=~fp3];
1731
1732                 ~synthflow.value;
1733                 ~currentsynth = "f1"; ~synthmonitorfunc.value;
1734
1735                 if(~ts.value == 1,
1736                         {if(~tst == nil, {nil}, {~tst.close;});
1737                                 ~timevals.value;
1738                                 ~timer.stop; ~systemclock.stop; ~systemclock.clear; ~time1f = 0;
1739                                 ~timer = Routine({inf.do({
1740                                         ~time1f =
1741                                         ~time1f+0.01; ~slot = "f1_"+~time1f.asString; 0.01.wait;});}); ~systemclock = SystemClock.play(~timer);},
1742                         {nil});
1743         });
1744         ~bplacef2 = Button.new(w,Rect(~bpf2l,~bpf2t,~bpf2h,~bpf2w)).states_([["f2",Color.white,Color.black]]).action_({arg button; button.value.postln}).action_({arg button;
1745
1746                 [~f1=~fp1b,~f2=~fp2b,~f3=~fp3b];
1747
1748                 ~synthflow.value;
1749                 ~currentsynth = "f2"; ~synthmonitorfunc.value;
1750
1751                 if(~ts.value == 1,
1752                         {if(~tst == nil, {nil}, {~tst.close;});
1753                                 ~timevals.value;
1754                                 ~timer.stop; ~systemclock.stop; ~systemclock.clear; ~time2f = 0;
1755                                 ~timer = Routine({inf.do({
1756                                         ~time2f =
1757                                         ~time2f+0.01; ~slot = "f2_"+~time2f.asString; 0.01.wait;});}); ~systemclock = SystemClock.play(~timer);},
1758                         {nil});
1759         });
1760
1761         ~bplacef3 = Button.new(w,Rect(~bpf3l,~bpf3t,~bpf3h,~bpf3w)).states_([["f3",Color.white,Color.black]]).action_({arg button; button.value.postln}).action_({arg button;
1762
1763                 [~f1=~fp1c,~f2=~fp2c,~f3=~fp3c];
1764
1765                 ~synthflow.value;
1766                 ~currentsynth = "f3"; ~synthmonitorfunc.value;
1767
1768                 if(~ts.value == 1,
1769                         {if(~tst == nil, {nil}, {~tst.close;});
1770                                 ~timevals.value;
1771                                 ~timer.stop; ~systemclock.stop; ~systemclock.clear; ~time3f = 0;
1772                                 ~timer = Routine({inf.do({
1773                                         ~time3f =
1774                                         ~time3f+0.01; ~slot = "f3_"+~time3f.asString; 0.01.wait;});}); ~systemclock = SystemClock.play(~timer);},
1775                         {nil});
1776         });
1777         ~bplacef4 = Button.new(w,Rect(~bpf4l,~bpf4t,~bpf4h,~bpf4w)).states_([["f4",Color.white,Color.black]]).action_({arg button; button.value.postln}).action_({arg button;
1778
1779                 [~f1=~fp1d,~f2=~fp2d,~f3=~fp3d];
1780
1781                 ~synthflow.value;
1782                 ~currentsynth = "f4"; ~synthmonitorfunc.value;
1783
1784                 if(~ts.value == 1,
1785                         {if(~tst == nil, {nil}, {~tst.close;});
1786                                 ~timevals.value;
1787                                 ~timer.stop; ~systemclock.stop; ~systemclock.clear; ~time4f = 0;
1788                                 ~timer = Routine({inf.do({
1789                                         ~time4f =
1790                                         ~time4f+0.01; ~slot = "f4_"+~time4f.asString; 0.01.wait;});}); ~systemclock = SystemClock.play(~timer);},
1791                         {nil});
1792         });
1793
1794         ~bplacef5 = Button.new(w,Rect(~bpf5l,~bpf5t,~bpf5h,~bpf5w)).states_([["f5",Color.white,Color.black]]).action_({arg button; button.value.postln}).action_({arg button;
1795
1796                 [~f1=~fp1e,~f2=~fp2e,~f3=~fp3e];
1797
1798                 ~synthflow.value;
1799                 ~currentsynth = "f5"; ~synthmonitorfunc.value;
1800
1801                 if(~ts.value == 1,
1802                         {if(~tst == nil, {nil}, {~tst.close;});
1803                                 ~timevals.value;
1804                                 ~timer.stop; ~systemclock.stop; ~systemclock.clear; ~time5f = 0;
1805                                 ~timer = Routine({inf.do({
1806                                         ~time5f =
1807                                         ~time5f+0.01; ~slot = "f5_"+~time5f.asString; 0.01.wait;});}); ~systemclock = SystemClock.play(~timer);},
1808                         {nil});
1809         });
1810
1811         ~bplacef6 = Button.new(w,Rect(~bpf6l,~bpf6t,~bpf6h,~bpf6w)).states_([["f6",Color.white,Color.black]]).action_({arg button; button.value.postln}).action_({arg button;
1812
1813                 [~f1=~fp1f,~f2=~fp2f,~f3=~fp3f];
1814
1815                 ~synthflow.value;
1816                 ~currentsynth = "f6"; ~synthmonitorfunc.value;
1817
1818                 if(~ts.value == 1,
1819                         {if(~tst == nil, {nil}, {~tst.close;});
1820                                 ~timevals.value;
1821                                 ~timer.stop; ~systemclock.stop; ~systemclock.clear; ~time6f = 0;
1822                                 ~timer = Routine({inf.do({
1823                                         ~time6f =
1824                                         ~time6f+0.01; ~slot = "f6_"+~time6f.asString; 0.01.wait;});}); ~systemclock = SystemClock.play(~timer);},
1825                         {nil});
1826         });
1827
1828
1829         ~bplacef7 = Button.new(w,Rect(~bpf7l,~bpf7t,~bpf7h,~bpf7w)).states_([["f7",Color.white,Color.black]]).action_({arg button; button.value.postln}).action_({arg button;
1830
1831                 [~f1=~fp1g,~f2=~fp2g,~f3=~fp3g];
1832
1833                 ~synthflow.value;
1834                 ~currentsynth = "f7"; ~synthmonitorfunc.value;
1835
1836                 if(~ts.value == 1,
1837                         {if(~tst == nil, {nil}, {~tst.close;});
1838                                 ~timevals.value;
1839                                 ~timer.stop; ~systemclock.stop; ~systemclock.clear; ~time7f = 0;
1840                                 ~timer = Routine({inf.do({
1841                                         ~time7f =
1842                                         ~time7f+0.01; ~slot = "f7_"+~time7f.asString; 0.01.wait;});}); ~systemclock = SystemClock.play(~timer);},
1843                         {nil});
1844         });
1845         ~bplacef8 = Button.new(w,Rect(~bpf8l,~bpf8t,~bpf8h,~bpf8w)).states_([["f8",Color.white,Color.black]]).action_({arg button; button.value.postln}).action_({arg button;
1846
1847                 [~f1=~fp1h,~f2=~fp2h,~f3=~fp3h];
1848
1849                 ~synthflow.value;
1850                 ~currentsynth = "f8"; ~synthmonitorfunc.value;
1851
1852                 if(~ts.value == 1,
1853                         {if(~tst == nil, {nil}, {~tst.close;});
1854                                 ~timevals.value;
1855                                 ~timer.stop; ~systemclock.stop; ~systemclock.clear; ~time8f = 0;
1856                                 ~timer = Routine({inf.do({
1857                                         ~time8f =
1858                                         ~time8f+0.01; ~slot = "f8_"+~time8f.asString; 0.01.wait;});}); ~systemclock = SystemClock.play(~timer);},
1859                         {nil});
1860         });
1861
1862
1863         //synthslide 1-8 buttons
1864
1865         ~bplaces1 = Button.new(w,Rect(~bpf1l,~bpf1t+~bpf1w,~bpf1h,~bpf1w)).states_([["s1",Color.white,Color.black]]).action_({arg button; button.value.postln}).action_({arg button;
1866
1867                 if(~slidetime1 == nil, {~slidetime1 = 4}); if(~slidedo1 == nil, {~slidedo1 = 2000;}); ~slidecount = ~slidedo1;
1868                 #g,h,i = (([ ~f1,~f2,~f3 ]-
1869                         [ ~fp1,~fp2,~fp3 ])*(-1)/~slidedo1);
1870
1871                 ~slidetime =~slidetime1; ~slidedo = ~slidedo1;
1872
1873                 ~slideroutine.stop;
1874
1875                 ~synthslide.value;
1876                 ~currentsynth = "s1"; ~synthmonitorfunc.value;
1877
1878                 if(~ts.value == 1,
1879                         {if(~tst == nil, {nil}, {~tst.close;});
1880                                 ~timevals.value;
1881                                 ~timer.stop; ~systemclock.stop; ~systemclock.clear; ~time1s = 0;
1882                                 ~timer = Routine({inf.do({
1883                                         ~time1s =
1884                                         ~time1s+0.01; ~slot = "s1_"+~time1s.asString; 0.01.wait;});}); ~systemclock = SystemClock.play(~timer);},
1885                         {nil});
1886
1887         });
1888         ~bplaces2 = Button.new(w,Rect(~bpf2l,~bpf2t+~bpf2w,~bpf2h,~bpf2w)).states_([["s2",Color.white,Color.black]]).action_({arg button; button.value.postln}).action_({arg button;
1889
1890                 if(~slidetime2 == nil, {~slidetime2 = 4}); if(~slidedo2 == nil, {~slidedo2 = 2000;}); ~slidecount = ~slidedo2;
1891                 #g,h,i = (([ ~f1,~f2,~f3 ]-
1892                         [ ~fp1b,~fp2b,~fp3b ])*(-1)/~slidedo2);
1893
1894                 ~slidetime = ~slidetime2; ~slidedo = ~slidedo2;
1895
1896                 ~slideroutine.stop;
1897
1898                 ~synthslide.value;
1899                 ~currentsynth = "s2"; ~synthmonitorfunc.value;
1900
1901                 if(~ts.value == 1,
1902                         {if(~tst == nil, {nil}, {~tst.close;});
1903                                 ~timevals.value;
1904                                 ~timer.stop; ~systemclock.stop; ~systemclock.clear; ~time2s = 0;
1905                                 ~timer = Routine({inf.do({
1906                                         ~time2s =
1907                                         ~time2s+0.01; ~slot = "s2_"+~time2s.asString; 0.01.wait;});}); ~systemclock = SystemClock.play(~timer);},
1908                         {nil});
1909
1910         });
1911         ~bplaces3 = Button.new(w,Rect(~bpf3l,~bpf3t+~bpf3w,~bpf3h,~bpf3w)).states_([["s3",Color.white,Color.black]]).action_({arg button; button.value.postln}).action_({arg button;
1912
1913                 if(~slidetime3 == nil, {~slidetime3 = 4}); if(~slidedo3 == nil, {~slidedo3 = 2000;}); ~slidecount = ~slidedo3;
1914                 #g,h,i = (([ ~f1,~f2,~f3 ]-
1915                         [ ~fp1c,~fp2c,~fp3c ])*(-1)/~slidedo3);
1916
1917                 ~slidetime = ~slidetime3; ~slidedo = ~slidedo3;
1918
1919                 ~slideroutine.stop;
1920
1921                 ~synthslide.value;
1922                 ~currentsynth = "s3"; ~synthmonitorfunc.value;
1923
1924                 if(~ts.value == 1,
1925                         {if(~tst == nil, {nil}, {~tst.close;});
1926                                 ~timevals.value;
1927                                 ~timer.stop; ~systemclock.stop; ~systemclock.clear; ~time3s = 0;
1928                                 ~timer = Routine({inf.do({
1929                                         ~time3s =
1930                                         ~time3s+0.01; ~slot = "s3_"+~time3s.asString; 0.01.wait;});}); ~systemclock = SystemClock.play(~timer);},
1931                         {nil});
1932
1933         });
1934         ~bplaces4 = Button.new(w,Rect(~bpf4l,~bpf4t+~bpf4w,~bpf4h,~bpf4w)).states_([["s4",Color.white,Color.black]]).action_({arg button; button.value.postln}).action_({arg button;
1935
1936                 if(~slidetime4 == nil, {~slidetime4 = 4}); if(~slidedo4 == nil, {~slidedo4 = 2000;}); ~slidecount = ~slidedo4;
1937                 #g,h,i = (([ ~f1,~f2,~f3 ]-
1938                         [ ~fp1d,~fp2d,~fp3d ])*(-1)/~slidedo4);
1939
1940                 ~slidetime = ~slidetime4; ~slidedo = ~slidedo4;
1941
1942                 ~slideroutine.stop;
1943
1944                 ~synthslide.value;
1945                 ~currentsynth = "s4"; ~synthmonitorfunc.value;
1946
1947                 if(~ts.value == 1,
1948                         {if(~tst == nil, {nil}, {~tst.close;});
1949                                 ~timevals.value;
1950                                 ~timer.stop; ~systemclock.stop; ~systemclock.clear; ~time4s = 0;
1951                                 ~timer = Routine({inf.do({
1952                                         ~time4s =
1953                                         ~time4s+0.01; ~slot = "s4_"+~time4s.asString; 0.01.wait;});}); ~systemclock = SystemClock.play(~timer);},
1954                         {nil});
1955         });
1956         ~bplaces5 = Button.new(w,Rect(~bpf5l,~bpf5t+~bpf5w,~bpf5h,~bpf5w)).states_([["s5",Color.white,Color.black]]).action_({arg button; button.value.postln}).action_({arg button;
1957
1958                 if(~slidetime5 == nil, {~slidetime5 = 4}); if(~slidedo5 == nil, {~slidedo5 = 2000;}); ~slidecount = ~slidedo5;
1959                 #g,h,i = (([ ~f1,~f2,~f3 ]-
1960                         [ ~fp1e,~fp2e,~fp3e ])*(-1)/~slidedo5);
1961
1962                 ~slidetime = ~slidetime5; ~slidedo = ~slidedo5;
1963
1964                 ~slideroutine.stop;
1965
1966                 ~synthslide.value;
1967                 ~currentsynth = "s5"; ~synthmonitorfunc.value;
1968
1969                 if(~ts.value == 1,
1970                         {if(~tst == nil, {nil}, {~tst.close;});
1971                                 ~timevals.value;
1972                                 ~timer.stop; ~systemclock.stop; ~systemclock.clear; ~time5s = 0;
1973                                 ~timer = Routine({inf.do({
1974                                         ~time5s =
1975                                         ~time5s+0.01; ~slot = "s5_"+~time5s.asString; 0.01.wait;});}); ~systemclock = SystemClock.play(~timer);},
1976                         {nil});
1977
1978         });
1979         ~bplaces6 = Button.new(w,Rect(~bpf6l,~bpf6t+~bpf6w,~bpf6h,~bpf6w)).states_([["s6",Color.white,Color.black]]).action_({arg button; button.value.postln}).action_({arg button;
1980
1981                 if(~slidetime6 == nil, {~slidetime6 = 4}); if(~slidedo6 == nil, {~slidedo6 = 2000;}); ~slidecount = ~slidedo6;
1982                 #g,h,i = (([ ~f1,~f2,~f3 ]-
1983                         [ ~fp1f,~fp2f,~fp3f ])*(-1)/~slidedo6);
1984
1985                 ~slidetime = ~slidetime6; ~slidedo = ~slidedo6;
1986                 ~slideroutine.stop;
1987
1988                 ~synthslide.value;
1989                 ~currentsynth = "s6"; ~synthmonitorfunc.value;
1990
1991                 if(~ts.value == 1,
1992                         {if(~tst == nil, {nil}, {~tst.close;});
1993                                 ~timevals.value;
1994                                 ~timer.stop; ~systemclock.stop; ~systemclock.clear; ~time6s = 0;
1995                                 ~timer = Routine({inf.do({
1996                                         ~time6s =
1997                                         ~time6s+0.01; ~slot = "s6_"+~time6s.asString; 0.01.wait;});}); ~systemclock = SystemClock.play(~timer);},
1998                         {nil});
1999
2000         });
2001         ~bplaces7 = Button.new(w,Rect(~bpf7l,~bpf7t+~bpf7w,~bpf7h,~bpf7w)).states_([["s7",Color.white,Color.black]]).action_({arg button; button.value.postln}).action_({arg button;
2002
2003                 if(~slidetime7 == nil, {~slidetime7 = 4}); if(~slidedo7 == nil, {~slidedo7 = 2000;}); ~slidecount = ~slidedo7;
2004                 #g,h,i = (([ ~f1,~f2,~f3 ]-
2005                         [ ~fp1g,~fp2g,~fp3g ])*(-1)/~slidedo7);
2006
2007                 ~slidetime = ~slidetime7; ~slidedo = ~slidedo7;
2008                 ~slideroutine.stop;
2009
2010                 ~synthslide.value;
2011                 ~currentsynth = "s7"; ~synthmonitorfunc.value;
2012
2013                 if(~ts.value == 1,
2014                         {if(~tst == nil, {nil}, {~tst.close;});
2015                                 ~timevals.value;
2016                                 ~timer.stop; ~systemclock.stop; ~systemclock.clear; ~time7s = 0;
2017                                 ~timer = Routine({inf.do({
2018                                         ~time7s =
2019                                         ~time7s+0.01; ~slot = "s7_"+~time7s.asString; 0.01.wait;});}); ~systemclock = SystemClock.play(~timer);},
2020                         {nil});
2021
2022         });
2023         ~bplaces8 = Button.new(w,Rect(~bpf8l,~bpf8t+~bpf8w,~bpf8h,~bpf8w)).states_([["s8",Color.white,Color.black]]).action_({arg button; button.value.postln}).action_({arg button;
2024
2025                 if(~slidetime8 == nil, {~slidetime8 = 4}); if(~slidedo8 == nil, {~slidedo8 = 2000;}); ~slidecount = ~slidedo8;
2026                 #g,h,i = (([ ~f1,~f2,~f3 ]-
2027                         [ ~fp1h,~fp2h,~fp3h])*(-1)/~slidedo8);
2028
2029                 ~slidetime = ~slidetime8; ~slidedo = ~slidedo8;
2030
2031                 ~slideroutine.stop;
2032
2033                 ~synthslide.value;
2034                 ~currentsynth = "s8"; ~synthmonitorfunc.value;
2035
2036                 if(~ts.value == 1,
2037                         {if(~tst == nil, {nil}, {~tst.close;});
2038                                 ~timevals.value;
2039                                 ~timer.stop; ~systemclock.stop; ~systemclock.clear; ~time8s = 0;
2040                                 ~timer = Routine({inf.do({
2041                                         ~time8s =
2042                                         ~time8s+0.01; ~slot = "s8_"+~time8s.asString; 0.01.wait;});}); ~systemclock = SystemClock.play(~timer);},
2043                         {nil});
2044         });
2045
2046
2047         //if slidetime/slidedo is nil
2048
2049         if(~slidetimeall == nil, {~slidetimeall = 1});
2050         if(~slidetime1 == nil, {~slidetime1 = 1});
2051         if(~slidetime2 == nil, {~slidetime2 = 1});
2052         if(~slidetime3 == nil, {~slidetime3 = 1});
2053         if(~slidetime4 == nil, {~slidetime4 = 1});
2054         if(~slidetime5 == nil, {~slidetime5 = 1});
2055         if(~slidetime6 == nil, {~slidetime6 = 1});
2056         if(~slidetime7 == nil, {~slidetime7 = 1});
2057         if(~slidetime8 == nil, {~slidetime8 = 1});
2058
2059         if(~slidedoall == nil, {~slidedoall = 432});
2060         if(~slidedo1 == nil, {~slidedo1 = 432});
2061         if(~slidedo2 == nil, {~slidedo2 = 432});
2062         if(~slidedo3 == nil, {~slidedo3 = 432});
2063         if(~slidedo4 == nil, {~slidedo4 = 432});
2064         if(~slidedo5 == nil, {~slidedo5 = 432});
2065         if(~slidedo6 == nil, {~slidedo6 = 432});
2066         if(~slidedo7 == nil, {~slidedo7 = 432});
2067         if(~slidedo8 == nil, {~slidedo8 = 432});
2068
2069
2070         //frequency set function
2071
2072         ~freqset_textfield_func = {
2073                 ~freqsetvalue = ~freqsetvalue.asString;
2074                 ~freqsetvalue = ~freqsetvalue.separate;
2075                 ~freqsetvalue = ~freqsetvalue.reject{arg item;
2076                         (item != "1") and:
2077                         (item != "2") and:
2078                         (item != "3") and:
2079                         (item != "4") and:
2080                         (item != "5") and:
2081                         (item != "6") and:
2082                         (item != "7") and:
2083                         (item != "8") and:
2084                         (item != "9") and:
2085                         (item != "0") and:
2086                         (item != ".") and:
2087                         (item != "+") and:
2088                         (item != "-") and:
2089                         (item != "*") and:
2090                         (item != "/") and:
2091                         (item != "**") and:
2092                         (item != "%")
2093                 };
2094                 ~freqsetvalue = ~freqsetvalue.join.asString.interpret;
2095         };
2096
2097
2098         //extra options button
2099
2100         ~extraoptions = Button.new(w,Rect(Window.screenBounds.width-20-20-20,~bpt+69+5,20,20/1.6180339887499)).states_([["eo",Color.white,Color.black],["eo",Color.white,Color.black]]).action_({arg button;
2101
2102                 if(button.value == 1, {
2103
2104                         ~extraoptionsview = View(w, Rect(Window.screenBounds.width-(540),Window.screenBounds.height-(340+46/1.6180339887499)-150,340+46,380+46/1.6180339887499)).front;
2105                         ~extraoptionsview.background_(Color.black);
2106
2107                         //set slide values button
2108
2109                         ~slidevals = Button.new(~extraoptionsview,Rect(0,25,120,20)).states_([["slide values",Color.white,Color.black],["slide values",Color.white,Color.black]]).action_({arg button; button.value.postln}).action_({arg button;
2110
2111                                 if(button.value == 1, {
2112                                         ({
2113                                                 arg lefttime = 0 , lefttimebox = 52, leftdo = lefttimebox+widthbox+6, leftdobox = leftdo+57, top = 0,width=52, height = 16,  widthbox=52, heightbox = 16, inc=0, lw = 0,  uw = 0, numw = 40;
2114                                                 var tall, stall, iall, siall, st1, st2, st3, st4, st5, st6, st7, st8, si1, si2, si3, si4, si5, si6, si7, si8, t1,t2,t3,t4,t5,t6,t7,t8,i1,i2,i3,i4,i5,i6,i7,i8;
2115                                                 ~slideview = View(w, Rect(Window.screenBounds.width-(340+46),Window.screenBounds.height-(340+46/1.6180339887499)-150,340+46,380+46/1.6180339887499)).front;
2116                                                 /*w.view.decorator=FlowLayout(w.view.bounds);
2117                                                 w.view.decorator.gap=2@2;*/
2118
2119                                                 tall = StaticText(~slideview, Rect(lefttime , top=top, width, height)).background_(Color.black).string_("all time").stringColor_(Color.white);
2120                                                 t1 = StaticText(~slideview, Rect(lefttime , top=top+height, width, height)).background_(Color.black).string_("s1 time").stringColor_(Color.white);
2121                                                 t2 = StaticText(~slideview, Rect(lefttime , top=top+height, width, height)).background_(Color.black).string_("s2 time").stringColor_(Color.white);
2122                                                 t3 = StaticText(~slideview, Rect(lefttime , top=top+height, width, height)).background_(Color.black).string_("s3 time").stringColor_(Color.white);
2123
2124                                                 top = 0;
2125
2126                                                 stall=NumberBox(~slideview, Rect(lefttimebox , top=top, widthbox, heightbox)).background_(Color.black).normalColor_(Color.white;).value_(~slidetimeall).maxDecimals_(9);
2127                                                 st1=NumberBox(~slideview, Rect(lefttimebox , top=top+heightbox, widthbox, heightbox)).background_(Color.black).normalColor_(Color.white;).value_(~slidetime1).maxDecimals_(9);
2128                                                 st2=NumberBox(~slideview, Rect(lefttimebox , top=top+heightbox, widthbox, heightbox)).background_(Color.black).normalColor_(Color.white;).value_(~slidetime2).maxDecimals_(9);
2129                                                 st3=NumberBox(~slideview, Rect(lefttimebox , top=top+heightbox, widthbox, heightbox)).background_(Color.black).normalColor_(Color.white;).value_(~slidetime3).maxDecimals_(9);
2130
2131                                                 top = 0;
2132
2133                                                 iall = StaticText(~slideview, Rect(leftdo , top=top, width, height)).background_(Color.black).string_("all incr").stringColor_(Color.white);