OSDN Git Service

6f0c80dfb21541e9dcd45e02611a5c38c8534d1e
[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/4;
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 = 63.027950580135; z = 63.027950580135; ~basefreqmap = Array.fill(8, {z=z/1.0835058821738}).reverse++[63.027950580135]++Array.fill(23, {y=y*1.0835058821738})++[432]++Array.fill(25, {x=x*1.0835058821738}); //create basefreqmap array
47
48         ~base_frequency = ~basefreqmap.at(8); //default 8 (63.027950580135). 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(~sendreplyfuncswitch == nil, {~sendreplyfuncswitch = 1; //1 is random western scale note change per timewave half-cycle, 2 is eastern scale. default is 1
74         });
75
76
77         //volume
78
79         ~vol = 0.005; //default 0.005
80         12.do(x = 0; {("vol"++(x=x+1)).asSymbol.envirPut(~vol)});
81
82
83         //Key codes for keyboard functions - either unicode or keycode. To find key codes, see below:
84
85         ~rightarrow_keycode = 65363; //next note change increase
86         ~leftarrow_keycode = 65361; //next note change decrease
87         ~uparrow_keycode = 65362; //change synth up
88         ~downarrow_keycode = 65364; //change synth down
89
90         ~rightarrow_keycode1 = 114; //next note change increase (old version - may not work)
91         ~leftarrow_keycode1 = 113; //next note change decrease (old version - may not work)
92         ~uparrow_keycode1 = 111; //change synth up (old version - may not work)
93         ~downarrow_keycode1 = 116; //change synth down (old version - may not work)
94
95         ~enter_unicode = 13; //
96         ~s_unicode = 115; //start synth
97         ~m_unicode = 109; //mute/unmute all synths
98         ~r_unicode = 114; //routine/loop function
99         ~u_unicode = 117; //
100         ~t_unicode = 116; //timer function
101         ~c_unicode = 99; //copy function
102         ~i_unicode = 105; //change synth up
103         ~k_unicode = 107; //change synth down
104         ~j_unicode = 106; //next note change decrease
105         ~l_unicode = 108; //next note change increase
106         ~spacebar_unicode = 32; //pause all synths
107         ~one_unicode = 49; //choose synth 1
108         ~two_unicode = 50; //choose synth 2
109         ~three_unicode = 51; //choose synth 3
110         ~four_unicode = 52; //choose synth 4
111         ~five_unicode = 53; //choose synth 5
112         ~six_unicode = 54; //choose synth 6
113         ~seven_unicode = 55; //choose synth 7
114         ~eight_unicode = 56; //choose synth 8
115         ~nine_unicode = 57; //choose synth 9
116         ~ten_unicode = 48; //choose synth 10
117         ~eleven_unicode = 45; //choose synth 11
118         ~twelve_unicode = 61; //choose synth 12
119         ~escape_unicode = 27; //escape function
120
121
122         //To find key codes in post window... Hightlight the function and its parenthesis in red below,
123         //and press "ctrl - enter" or "cmd - return" - then a small window called "test" will pop up...
124         //Press the "type" button inside of the window, then press anywhere on the keyboard to find
125         //the key codes in the right-hand side post window. Layout: [unicode, keycode, modifiers]. It is either a unicode
126         //or a keycode. Do not delete the /* and */ characters, or else the
127         //program will not run.
128
129         /*
130
131         (
132         var win = Window(\test, Rect(10, 100, 100, 50)),
133         btn = Button(win, Rect(5, 5, 90, 40)).states_([["type"]]);
134         btn.keyDownAction =
135         { arg view, char, modifiers, unicode, keycode;
136         ["unicode:"+unicode, "keycode:"+keycode, "modifiers:"+modifiers].postln;
137         };
138         win.front;
139         )
140
141         */
142
143
144         //gui set frequency ranges - currently set at the lowest and highest notes on a 128 key range using 432 hz A tuning
145         //you can change the tuning near top
146         //to insert custom ranges, replace "~freqmap.at()" with a hz frequency
147
148         ~outmin1 = ~freqmap.at(0);       // 8.0271480262684 hz                       //base frequency of upper set
149         ~outmax1 = ~freqmap.at(127);     // 12315.783879572 hz                       //high frequency of upper set
150         ~outmin2 = ~freqmap.at(0)*8;     // (8.0271480262684)*8 hz                   //base frequency of lower set
151         ~outmax2 = ~freqmap.at(127)/8;   // (12315.783879572)/8 hz;                  //high frequency of lower set
152
153         ~outmina = ~outmin2;
154         ~outmaxa = ~outmax2;
155         ~outminb = ~outmin1;
156         ~outmaxb = ~outmax1;
157
158
159         //increase or decrease magnitude of second and third harmonics for synthdefs and synth functions (not recommend changing if uncertain of effects)
160
161         //synthdefs
162
163         ~first_harmonic = 1;  //1
164         ~second_harmonic = 2; //2
165         ~third_harmonic = 6;  //6
166
167         //synth functions
168
169         ~icd3 = 3; //3
170         ~icd6 = 6; //6
171
172
173         //ratio values
174
175         ~fth = 1.4142135623729; //default kws binary interval
176         ~bi = ~fth; //~bi = "binary interval" - intverval of key change to a hexagram line's opposite in King Wen sequence
177         ~stepratio = 1.0594630943593;
178         ~nval = 1.0355417528;
179         ~n9s = 1.86;
180         ~n9 = 1.080059789899;
181         ~n18 = 1.0392592260319;
182         ~n27 = 1.0260044847071;
183         ~n36 = 1.0194406437022;
184         ~n45 = 1.0155225125043;
185         ~n54 = 1.012918794725;
186         ~n63 = 1.0110630844869;
187         ~n72 = 1.0096735332285;
188         ~gm = 1.6180339887499; //phi (golden mean), scaled on 1 key change per King Wen sequence
189         ~gm2 = 1.2720196495141;
190         ~gm6 = 1.0835058821738;
191         ~ngm1 = 1.0549232131786; //phi (golden mean), scaled on 9 key changes per King Wen sequence
192         ~ngm2 = 1.0270945492887;
193         ~ngm6 = 1.0089511542031;
194         ~nngm1 = 1.0075472729363; //phi (golden mean), scaled on 64 key changes per King Wen sequence
195         ~nngm2 = 1.0037665430449;
196         ~nngm6 = 1.0012539413222;
197         ~h1 = 11.10101010101; //based on 19.47:360, scaled on 1 key change per King Wen sequence
198         ~h2 = 4.2999982083345;
199         ~h6 = 1.6261331058274;
200         ~nh1 = 1.3828361607663; //based on 19.47:360, scaled on 9 key changes per King Wen sequence
201         ~nh2 = 1.1759405430404;
202         ~nh6 = 1.0555086286213;
203         ~nnh1 = 1.0466365180627; //based on 19.47:360, scaled on 64 key changes per King Wen sequence
204         ~nnh2 = 1.0230525490231;
205         ~nnh6 = 1.0076258811195;
206
207
208         //edit SAVED s1-s8 frequencies/chords. Replace any "[ ~f1,~f2,~f3 ]" with desired frequencies.
209         //Example: [~f1=31.385685128991,~f2=86.222407114322,~f3=229.95963599755]
210         //You can find frequencies in the "copy" section of GUI under "saved open/flow 1-8 frequencies:" or "saved slide 1-8 frequencies:".
211         //Remove both the "/*" and "*/" around the code to make evaluable. Put them back to make it unevaluable.
212
213         /*
214
215         3.do(x = 0; {("fp"++(x=x+1)).asSymbol.envirPut([ ~f1,~f2,~f3 ].at(x-1))});
216         3.do(x = 0; {("fp"++(x=x+1)++"b").asSymbol.envirPut([ ~f1,~f2,~f3 ].at(x-1))});
217         3.do(x = 0; {("fp"++(x=x+1)++"c").asSymbol.envirPut([ ~f1,~f2,~f3 ].at(x-1))});
218         3.do(x = 0; {("fp"++(x=x+1)++"d").asSymbol.envirPut([ ~f1,~f2,~f3 ].at(x-1))});
219         3.do(x = 0; {("fp"++(x=x+1)++"e").asSymbol.envirPut([ ~f1,~f2,~f3 ].at(x-1))});
220         3.do(x = 0; {("fp"++(x=x+1)++"f").asSymbol.envirPut([ ~f1,~f2,~f3 ].at(x-1))});
221         3.do(x = 0; {("fp"++(x=x+1)++"g").asSymbol.envirPut([ ~f1,~f2,~f3 ].at(x-1))});
222         3.do(x = 0; {("fp"++(x=x+1)++"h").asSymbol.envirPut([ ~f1,~f2,~f3 ].at(x-1))});
223
224         */
225
226
227         //edit STARTING frequencies/chord (not saved s1-s8 frequencies/chords). Replace "[ ~f1,~f2,~f3 ]" with starting frequencies.
228         //Example: [~f1=31.385685128991,~f2=86.222407114322,~f3=229.95963599755]
229         //You can find frequencies in the "copy" section of GUI under "current chord/frequencies".
230         //Remove both the "/*" and "*/" around the code to make evaluable. Put them back to make it unevaluable again.
231
232         /*
233
234         3.do(x = 0; {("f"++(x=x+1)).asSymbol.envirPut(
235
236         [ ~f1,~f2,~f3 ]
237
238         .at(x-1))});
239
240         */
241
242         //^Imoprtant note: "edit STARTING frequencies/chord" must be placed after "edit SAVED frequencies/chords" in code in order for it to work correctly
243
244
245         ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
246
247
248         //default starting notes
249
250         if(([f1,f2,f3] == [nil,nil,nil]), {
251                 #f1,f2,f3 = [
252                         (~freqmap.at(127)/8).rand,
253                         (~freqmap.at(127)/8).rand,
254                         (~freqmap.at(127)/8).rand
255                 ];
256         });
257
258         if(([ ~f1,~f2,~f3 ] == [nil,nil,nil]), {3.do(x = 0; {("f"++(x=x+1)).asSymbol.envirPut([f1,f2,f3].at(x-1))});});
259
260         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))});});
261         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))});});
262         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))});});
263         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))});});
264         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))});});
265         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))});});
266         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))});});
267         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))});});
268
269         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))});
270         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))});
271         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))});
272         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))});
273         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))});
274         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))});
275         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))});
276         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))});
277
278         if([~sg1a1,~sg1a2,~sg1a3,~sg1a4,~sg1a5,~sg1a6,~sg1a7,~sg1a8,~sg1a9,~sg1a10,~sg1a11,~sg1a12] == [nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil], {[~sg1a1=~f1,~sg1a2=~f2,~sg1a3=~f3,~sg1a4=~f4,~sg1a5=~f5,~sg1a6=~f6,~sg1a7=~f7,~sg1a8=~f8];});
279         if([~sg1b1,~sg1b2,~sg1b3,~sg1b4,~sg1b5,~sg1b6,~sg1b7,~sg1b8,~sg1b9,~sg1b10,~sg1b11,~sg1b12] == [nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil], {[~sg1b1=~f1,~sg1b2=~f2,~sg1b3=~f3,~sg1b4=~f4,~sg1b5=~f5,~sg1b6=~f6,~sg1b7=~f7,~sg1b8=~f8];});
280         if([~sg1c1,~sg1c2,~sg1c3,~sg1c4,~sg1c5,~sg1c6,~sg1c7,~sg1c8,~sg1c9,~sg1c10,~sg1c11,~sg1c12] == [nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil], {[~sg1c1=~f1,~sg1c2=~f2,~sg1c3=~f3,~sg1c4=~f4,~sg1c5=~f5,~sg1c6=~f6,~sg1c7=~f7,~sg1c8=~f8];});
281         if([~sg1d1,~sg1d2,~sg1d3,~sg1d4,~sg1d5,~sg1d6,~sg1d7,~sg1d8,~sg1d9,~sg1d10,~sg1d11,~sg1d12] == [nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil], {[~sg1d1=~f1,~sg1d2=~f2,~sg1d3=~f3,~sg1d4=~f4,~sg1d5=~f5,~sg1d6=~f6,~sg1d7=~f7,~sg1d8=~f8];});
282         if([~sg1e1,~sg1e2,~sg1e3,~sg1e4,~sg1e5,~sg1e6,~sg1e7,~sg1e8,~sg1e9,~sg1e10,~sg1e11,~sg1e12] == [nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil], {[~sg1e1=~f1,~sg1e2=~f2,~sg1e3=~f3,~sg1e4=~f4,~sg1e5=~f5,~sg1e6=~f6,~sg1e7=~f7,~sg1e8=~f8];});
283         if([~sg1f1,~sg1f2,~sg1f3,~sg1f4,~sg1f5,~sg1f6,~sg1f7,~sg1f8,~sg1f9,~sg1f10,~sg1f11,~sg1f12] == [nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil], {[~sg1f1=~f1,~sg1f2=~f2,~sg1f3=~f3,~sg1f4=~f4,~sg1f5=~f5,~sg1f6=~f6,~sg1f7=~f7,~sg1f8=~f8];});
284         if([~sg1g1,~sg1g2,~sg1g3,~sg1g4,~sg1g5,~sg1g6,~sg1g7,~sg1g8,~sg1g9,~sg1g10,~sg1g11,~sg1g12] == [nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil], {[~sg1g1=~f1,~sg1g2=~f2,~sg1g3=~f3,~sg1g4=~f4,~sg1g5=~f5,~sg1g6=~f6,~sg1g7=~f7,~sg1g8=~f8];});
285         if([~sg1h1,~sg1h2,~sg1h3,~sg1h4,~sg1h5,~sg1h6,~sg1h7,~sg1h8,~sg1h9,~sg1h10,~sg1h11,~sg1h12] == [nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil], {[~sg1h1=~f1,~sg1h2=~f2,~sg1h3=~f3,~sg1h4=~f4,~sg1h5=~f5,~sg1h6=~f6,~sg1h7=~f7,~sg1h8=~f8];});
286         if([~sg2a1,~sg2a2,~sg2a3,~sg2a4,~sg2a5,~sg2a6,~sg2a7,~sg2a8,~sg2a9,~sg2a10,~sg2a11,~sg2a12] == [nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil], {[~sg2a1=~f1,~sg2a2=~f2,~sg2a3=~f3,~sg2a4=~f4,~sg2a5=~f5,~sg2a6=~f6,~sg2a7=~f7,~sg2a8=~f8];});
287         if([~sg2b1,~sg2b2,~sg2b3,~sg2b4,~sg2b5,~sg2b6,~sg2b7,~sg2b8,~sg2b9,~sg2b10,~sg2b11,~sg2b12] == [nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil], {[~sg2b1=~f1,~sg2b2=~f2,~sg2b3=~f3,~sg2b4=~f4,~sg2b5=~f5,~sg2b6=~f6,~sg2b7=~f7,~sg2b8=~f8];});
288         if([~sg2c1,~sg2c2,~sg2c3,~sg2c4,~sg2c5,~sg2c6,~sg2c7,~sg2c8,~sg2c9,~sg2c10,~sg2c11,~sg2c12] == [nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil], {[~sg2c1=~f1,~sg2c2=~f2,~sg2c3=~f3,~sg2c4=~f4,~sg2c5=~f5,~sg2c6=~f6,~sg2c7=~f7,~sg2c8=~f8];});
289         if([~sg2d1,~sg2d2,~sg2d3,~sg2d4,~sg2d5,~sg2d6,~sg2d7,~sg2d8,~sg2d9,~sg2d10,~sg2d11,~sg2d12] == [nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil], {[~sg2d1=~f1,~sg2d2=~f2,~sg2d3=~f3,~sg2d4=~f4,~sg2d5=~f5,~sg2d6=~f6,~sg2d7=~f7,~sg2d8=~f8];});
290         if([~sg2e1,~sg2e2,~sg2e3,~sg2e4,~sg2e5,~sg2e6,~sg2e7,~sg2e8,~sg2e9,~sg2e10,~sg2e11,~sg2e12] == [nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil], {[~sg2e1=~f1,~sg2e2=~f2,~sg2e3=~f3,~sg2e4=~f4,~sg2e5=~f5,~sg2e6=~f6,~sg2e7=~f7,~sg2e8=~f8];});
291         if([~sg2f1,~sg2f2,~sg2f3,~sg2f4,~sg2f5,~sg2f6,~sg2f7,~sg2f8,~sg2f9,~sg2f10,~sg2f11,~sg2f12] == [nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil], {[~sg2f1=~f1,~sg2f2=~f2,~sg2f3=~f3,~sg2f4=~f4,~sg2f5=~f5,~sg2f6=~f6,~sg2f7=~f7,~sg2f8=~f8];});
292         if([~sg2g1,~sg2g2,~sg2g3,~sg2g4,~sg2g5,~sg2g6,~sg2g7,~sg2g8,~sg2g9,~sg2g10,~sg2g11,~sg2g12] == [nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil], {[~sg2g1=~f1,~sg2g2=~f2,~sg2g3=~f3,~sg2g4=~f4,~sg2g5=~f5,~sg2g6=~f6,~sg2g7=~f7,~sg2g8=~f8];});
293         if([~sg2h1,~sg2h2,~sg2h3,~sg2h4,~sg2h5,~sg2h6,~sg2h7,~sg2h8,~sg2h9,~sg2h10,~sg2h11,~sg2h12] == [nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil], {[~sg2h1=~f1,~sg2h2=~f2,~sg2h3=~f3,~sg2h4=~f4,~sg2h5=~f5,~sg2h6=~f6,~sg2h7=~f7,~sg2h8=~f8];});
294         if([~sg3a1,~sg3a2,~sg3a3,~sg3a4,~sg3a5,~sg3a6,~sg3a7,~sg3a8,~sg3a9,~sg3a10,~sg3a11,~sg3a12] == [nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil], {[~sg3a1=~f1,~sg3a2=~f2,~sg3a3=~f3,~sg3a4=~f4,~sg3a5=~f5,~sg3a6=~f6,~sg3a7=~f7,~sg3a8=~f8];});
295         if([~sg3b1,~sg3b2,~sg3b3,~sg3b4,~sg3b5,~sg3b6,~sg3b7,~sg3b8,~sg3b9,~sg3b10,~sg3b11,~sg3b12] == [nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil], {[~sg3b1=~f1,~sg3b2=~f2,~sg3b3=~f3,~sg3b4=~f4,~sg3b5=~f5,~sg3b6=~f6,~sg3b7=~f7,~sg3b8=~f8];});
296         if([~sg3c1,~sg3c2,~sg3c3,~sg3c4,~sg3c5,~sg3c6,~sg3c7,~sg3c8,~sg3c9,~sg3c10,~sg3c11,~sg3c12] == [nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil], {[~sg3c1=~f1,~sg3c2=~f2,~sg3c3=~f3,~sg3c4=~f4,~sg3c5=~f5,~sg3c6=~f6,~sg3c7=~f7,~sg3c8=~f8];});
297         if([~sg3d1,~sg3d2,~sg3d3,~sg3d4,~sg3d5,~sg3d6,~sg3d7,~sg3d8,~sg3d9,~sg3d10,~sg3d11,~sg3d12] == [nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil], {[~sg3d1=~f1,~sg3d2=~f2,~sg3d3=~f3,~sg3d4=~f4,~sg3d5=~f5,~sg3d6=~f6,~sg3d7=~f7,~sg3d8=~f8];});
298         if([~sg3e1,~sg3e2,~sg3e3,~sg3e4,~sg3e5,~sg3e6,~sg3e7,~sg3e8,~sg3e9,~sg3e10,~sg3e11,~sg3e12] == [nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil], {[~sg3e1=~f1,~sg3e2=~f2,~sg3e3=~f3,~sg3e4=~f4,~sg3e5=~f5,~sg3e6=~f6,~sg3e7=~f7,~sg3e8=~f8];});
299         if([~sg3f1,~sg3f2,~sg3f3,~sg3f4,~sg3f5,~sg3f6,~sg3f7,~sg3f8,~sg3f9,~sg3f10,~sg3f11,~sg3f12] == [nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil], {[~sg3f1=~f1,~sg3f2=~f2,~sg3f3=~f3,~sg3f4=~f4,~sg3f5=~f5,~sg3f6=~f6,~sg3f7=~f7,~sg3f8=~f8];});
300         if([~sg3g1,~sg3g2,~sg3g3,~sg3g4,~sg3g5,~sg3g6,~sg3g7,~sg3g8,~sg3g9,~sg3g10,~sg3g11,~sg3g12] == [nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil], {[~sg3g1=~f1,~sg3g2=~f2,~sg3g3=~f3,~sg3g4=~f4,~sg3g5=~f5,~sg3g6=~f6,~sg3g7=~f7,~sg3g8=~f8];});
301         if([~sg3h1,~sg3h2,~sg3h3,~sg3h4,~sg3h5,~sg3h6,~sg3h7,~sg3h8,~sg3h9,~sg3h10,~sg3h11,~sg3h12] == [nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil], {[~sg3h1=~f1,~sg3h2=~f2,~sg3h3=~f3,~sg3h4=~f4,~sg3h5=~f5,~sg3h6=~f6,~sg3h7=~f7,~sg3h8=~f8];});
302         if([~sg4a1,~sg4a2,~sg4a3,~sg4a4,~sg4a5,~sg4a6,~sg4a7,~sg4a8,~sg4a9,~sg4a10,~sg4a11,~sg4a12] == [nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil], {[~sg4a1=~f1,~sg4a2=~f2,~sg4a3=~f3,~sg4a4=~f4,~sg4a5=~f5,~sg4a6=~f6,~sg4a7=~f7,~sg4a8=~f8];});
303         if([~sg4b1,~sg4b2,~sg4b3,~sg4b4,~sg4b5,~sg4b6,~sg4b7,~sg4b8,~sg4b9,~sg4b10,~sg4b11,~sg4b12] == [nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil], {[~sg4b1=~f1,~sg4b2=~f2,~sg4b3=~f3,~sg4b4=~f4,~sg4b5=~f5,~sg4b6=~f6,~sg4b7=~f7,~sg4b8=~f8];});
304         if([~sg4c1,~sg4c2,~sg4c3,~sg4c4,~sg4c5,~sg4c6,~sg4c7,~sg4c8,~sg4c9,~sg4c10,~sg4c11,~sg4c12] == [nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil], {[~sg4c1=~f1,~sg4c2=~f2,~sg4c3=~f3,~sg4c4=~f4,~sg4c5=~f5,~sg4c6=~f6,~sg4c7=~f7,~sg4c8=~f8];});
305         if([~sg4d1,~sg4d2,~sg4d3,~sg4d4,~sg4d5,~sg4d6,~sg4d7,~sg4d8,~sg4d9,~sg4d10,~sg4d11,~sg4d12] == [nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil], {[~sg4d1=~f1,~sg4d2=~f2,~sg4d3=~f3,~sg4d4=~f4,~sg4d5=~f5,~sg4d6=~f6,~sg4d7=~f7,~sg4d8=~f8];});
306         if([~sg4e1,~sg4e2,~sg4e3,~sg4e4,~sg4e5,~sg4e6,~sg4e7,~sg4e8,~sg4e9,~sg4e10,~sg4e11,~sg4e12] == [nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil], {[~sg4e1=~f1,~sg4e2=~f2,~sg4e3=~f3,~sg4e4=~f4,~sg4e5=~f5,~sg4e6=~f6,~sg4e7=~f7,~sg4e8=~f8];});
307         if([~sg4f1,~sg4f2,~sg4f3,~sg4f4,~sg4f5,~sg4f6,~sg4f7,~sg4f8,~sg4f9,~sg4f10,~sg4f11,~sg4f12] == [nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil], {[~sg4f1=~f1,~sg4f2=~f2,~sg4f3=~f3,~sg4f4=~f4,~sg4f5=~f5,~sg4f6=~f6,~sg4f7=~f7,~sg4f8=~f8];});
308         if([~sg4g1,~sg4g2,~sg4g3,~sg4g4,~sg4g5,~sg4g6,~sg4g7,~sg4g8,~sg4g9,~sg4g10,~sg4g11,~sg4g12] == [nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil], {[~sg4g1=~f1,~sg4g2=~f2,~sg4g3=~f3,~sg4g4=~f4,~sg4g5=~f5,~sg4g6=~f6,~sg4g7=~f7,~sg4g8=~f8];});
309         if([~sg4h1,~sg4h2,~sg4h3,~sg4h4,~sg4h5,~sg4h6,~sg4h7,~sg4h8,~sg4h9,~sg4h10,~sg4h11,~sg4h12] == [nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil], {[~sg4h1=~f1,~sg4h2=~f2,~sg4h3=~f3,~sg4h4=~f4,~sg4h5=~f5,~sg4h6=~f6,~sg4h7=~f7,~sg4h8=~f8];});
310         if([~sg5a1,~sg5a2,~sg5a3,~sg5a4,~sg5a5,~sg5a6,~sg5a7,~sg5a8,~sg5a9,~sg5a10,~sg5a11,~sg5a12] == [nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil], {[~sg5a1=~f1,~sg5a2=~f2,~sg5a3=~f3,~sg5a4=~f4,~sg5a5=~f5,~sg5a6=~f6,~sg5a7=~f7,~sg5a8=~f8];});
311         if([~sg5b1,~sg5b2,~sg5b3,~sg5b4,~sg5b5,~sg5b6,~sg5b7,~sg5b8,~sg5b9,~sg5b10,~sg5b11,~sg5b12] == [nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil], {[~sg5b1=~f1,~sg5b2=~f2,~sg5b3=~f3,~sg5b4=~f4,~sg5b5=~f5,~sg5b6=~f6,~sg5b7=~f7,~sg5b8=~f8];});
312         if([~sg5c1,~sg5c2,~sg5c3,~sg5c4,~sg5c5,~sg5c6,~sg5c7,~sg5c8,~sg5c9,~sg5c10,~sg5c11,~sg5c12] == [nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil], {[~sg5c1=~f1,~sg5c2=~f2,~sg5c3=~f3,~sg5c4=~f4,~sg5c5=~f5,~sg5c6=~f6,~sg5c7=~f7,~sg5c8=~f8];});
313         if([~sg5d1,~sg5d2,~sg5d3,~sg5d4,~sg5d5,~sg5d6,~sg5d7,~sg5d8,~sg5d9,~sg5d10,~sg5d11,~sg5d12] == [nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil], {[~sg5d1=~f1,~sg5d2=~f2,~sg5d3=~f3,~sg5d4=~f4,~sg5d5=~f5,~sg5d6=~f6,~sg5d7=~f7,~sg5d8=~f8];});
314         if([~sg5e1,~sg5e2,~sg5e3,~sg5e4,~sg5e5,~sg5e6,~sg5e7,~sg5e8,~sg5e9,~sg5e10,~sg5e11,~sg5e12] == [nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil], {[~sg5e1=~f1,~sg5e2=~f2,~sg5e3=~f3,~sg5e4=~f4,~sg5e5=~f5,~sg5e6=~f6,~sg5e7=~f7,~sg5e8=~f8];});
315         if([~sg5f1,~sg5f2,~sg5f3,~sg5f4,~sg5f5,~sg5f6,~sg5f7,~sg5f8,~sg5f9,~sg5f10,~sg5f11,~sg5f12] == [nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil], {[~sg5f1=~f1,~sg5f2=~f2,~sg5f3=~f3,~sg5f4=~f4,~sg5f5=~f5,~sg5f6=~f6,~sg5f7=~f7,~sg5f8=~f8];});
316         if([~sg5g1,~sg5g2,~sg5g3,~sg5g4,~sg5g5,~sg5g6,~sg5g7,~sg5g8,~sg5g9,~sg5g10,~sg5g11,~sg5g12] == [nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil], {[~sg5g1=~f1,~sg5g2=~f2,~sg5g3=~f3,~sg5g4=~f4,~sg5g5=~f5,~sg5g6=~f6,~sg5g7=~f7,~sg5g8=~f8];});
317         if([~sg5h1,~sg5h2,~sg5h3,~sg5h4,~sg5h5,~sg5h6,~sg5h7,~sg5h8,~sg5h9,~sg5h10,~sg5h11,~sg5h12] == [nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil], {[~sg5h1=~f1,~sg5h2=~f2,~sg5h3=~f3,~sg5h4=~f4,~sg5h5=~f5,~sg5h6=~f6,~sg5h7=~f7,~sg5h8=~f8];});
318         if([~sg6a1,~sg6a2,~sg6a3,~sg6a4,~sg6a5,~sg6a6,~sg6a7,~sg6a8,~sg6a9,~sg6a10,~sg6a11,~sg6a12] == [nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil], {[~sg6a1=~f1,~sg6a2=~f2,~sg6a3=~f3,~sg6a4=~f4,~sg6a5=~f5,~sg6a6=~f6,~sg6a7=~f7,~sg6a8=~f8];});
319         if([~sg6b1,~sg6b2,~sg6b3,~sg6b4,~sg6b5,~sg6b6,~sg6b7,~sg6b8,~sg6b9,~sg6b10,~sg6b11,~sg6b12] == [nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil], {[~sg6b1=~f1,~sg6b2=~f2,~sg6b3=~f3,~sg6b4=~f4,~sg6b5=~f5,~sg6b6=~f6,~sg6b7=~f7,~sg6b8=~f8];});
320         if([~sg6c1,~sg6c2,~sg6c3,~sg6c4,~sg6c5,~sg6c6,~sg6c7,~sg6c8,~sg6c9,~sg6c10,~sg6c11,~sg6c12] == [nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil], {[~sg6c1=~f1,~sg6c2=~f2,~sg6c3=~f3,~sg6c4=~f4,~sg6c5=~f5,~sg6c6=~f6,~sg6c7=~f7,~sg6c8=~f8];});
321         if([~sg6d1,~sg6d2,~sg6d3,~sg6d4,~sg6d5,~sg6d6,~sg6d7,~sg6d8,~sg6d9,~sg6d10,~sg6d11,~sg6d12] == [nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil], {[~sg6d1=~f1,~sg6d2=~f2,~sg6d3=~f3,~sg6d4=~f4,~sg6d5=~f5,~sg6d6=~f6,~sg6d7=~f7,~sg6d8=~f8];});
322         if([~sg6e1,~sg6e2,~sg6e3,~sg6e4,~sg6e5,~sg6e6,~sg6e7,~sg6e8,~sg6e9,~sg6e10,~sg6e11,~sg6e12] == [nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil], {[~sg6e1=~f1,~sg6e2=~f2,~sg6e3=~f3,~sg6e4=~f4,~sg6e5=~f5,~sg6e6=~f6,~sg6e7=~f7,~sg6e8=~f8];});
323         if([~sg6f1,~sg6f2,~sg6f3,~sg6f4,~sg6f5,~sg6f6,~sg6f7,~sg6f8,~sg6f9,~sg6f10,~sg6f11,~sg6f12] == [nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil], {[~sg6f1=~f1,~sg6f2=~f2,~sg6f3=~f3,~sg6f4=~f4,~sg6f5=~f5,~sg6f6=~f6,~sg6f7=~f7,~sg6f8=~f8];});
324         if([~sg6g1,~sg6g2,~sg6g3,~sg6g4,~sg6g5,~sg6g6,~sg6g7,~sg6g8,~sg6g9,~sg6g10,~sg6g11,~sg6g12] == [nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil], {[~sg6g1=~f1,~sg6g2=~f2,~sg6g3=~f3,~sg6g4=~f4,~sg6g5=~f5,~sg6g6=~f6,~sg6g7=~f7,~sg6g8=~f8];});
325         if([~sg6h1,~sg6h2,~sg6h3,~sg6h4,~sg6h5,~sg6h6,~sg6h7,~sg6h8,~sg6h9,~sg6h10,~sg6h11,~sg6h12] == [nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil], {[~sg6h1=~f1,~sg6h2=~f2,~sg6h3=~f3,~sg6h4=~f4,~sg6h5=~f5,~sg6h6=~f6,~sg6h7=~f7,~sg6h8=~f8];});
326         if([~sg7a1,~sg7a2,~sg7a3,~sg7a4,~sg7a5,~sg7a6,~sg7a7,~sg7a8,~sg7a9,~sg7a10,~sg7a11,~sg7a12] == [nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil], {[~sg7a1=~f1,~sg7a2=~f2,~sg7a3=~f3,~sg7a4=~f4,~sg7a5=~f5,~sg7a6=~f6,~sg7a7=~f7,~sg7a8=~f8];});
327         if([~sg7b1,~sg7b2,~sg7b3,~sg7b4,~sg7b5,~sg7b6,~sg7b7,~sg7b8,~sg7b9,~sg7b10,~sg7b11,~sg7b12] == [nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil], {[~sg7b1=~f1,~sg7b2=~f2,~sg7b3=~f3,~sg7b4=~f4,~sg7b5=~f5,~sg7b6=~f6,~sg7b7=~f7,~sg7b8=~f8];});
328         if([~sg7c1,~sg7c2,~sg7c3,~sg7c4,~sg7c5,~sg7c6,~sg7c7,~sg7c8,~sg7c9,~sg7c10,~sg7c11,~sg7c12] == [nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil], {[~sg7c1=~f1,~sg7c2=~f2,~sg7c3=~f3,~sg7c4=~f4,~sg7c5=~f5,~sg7c6=~f6,~sg7c7=~f7,~sg7c8=~f8];});
329         if([~sg7d1,~sg7d2,~sg7d3,~sg7d4,~sg7d5,~sg7d6,~sg7d7,~sg7d8,~sg7d9,~sg7d10,~sg7d11,~sg7d12] == [nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil], {[~sg7d1=~f1,~sg7d2=~f2,~sg7d3=~f3,~sg7d4=~f4,~sg7d5=~f5,~sg7d6=~f6,~sg7d7=~f7,~sg7d8=~f8];});
330         if([~sg7e1,~sg7e2,~sg7e3,~sg7e4,~sg7e5,~sg7e6,~sg7e7,~sg7e8,~sg7e9,~sg7e10,~sg7e11,~sg7e12] == [nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil], {[~sg7e1=~f1,~sg7e2=~f2,~sg7e3=~f3,~sg7e4=~f4,~sg7e5=~f5,~sg7e6=~f6,~sg7e7=~f7,~sg7e8=~f8];});
331         if([~sg7f1,~sg7f2,~sg7f3,~sg7f4,~sg7f5,~sg7f6,~sg7f7,~sg7f8,~sg7f9,~sg7f10,~sg7f11,~sg7f12] == [nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil], {[~sg7f1=~f1,~sg7f2=~f2,~sg7f3=~f3,~sg7f4=~f4,~sg7f5=~f5,~sg7f6=~f6,~sg7f7=~f7,~sg7f8=~f8];});
332         if([~sg7g1,~sg7g2,~sg7g3,~sg7g4,~sg7g5,~sg7g6,~sg7g7,~sg7g8,~sg7g9,~sg7g10,~sg7g11,~sg7g12] == [nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil], {[~sg7g1=~f1,~sg7g2=~f2,~sg7g3=~f3,~sg7g4=~f4,~sg7g5=~f5,~sg7g6=~f6,~sg7g7=~f7,~sg7g8=~f8];});
333         if([~sg7h1,~sg7h2,~sg7h3,~sg7h4,~sg7h5,~sg7h6,~sg7h7,~sg7h8,~sg7h9,~sg7h10,~sg7h11,~sg7h12] == [nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil], {[~sg7h1=~f1,~sg7h2=~f2,~sg7h3=~f3,~sg7h4=~f4,~sg7h5=~f5,~sg7h6=~f6,~sg7h7=~f7,~sg7h8=~f8];});
334         if([~sg8a1,~sg8a2,~sg8a3,~sg8a4,~sg8a5,~sg8a6,~sg8a7,~sg8a8,~sg8a9,~sg8a10,~sg8a11,~sg8a12] == [nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil], {[~sg8a1=~f1,~sg8a2=~f2,~sg8a3=~f3,~sg8a4=~f4,~sg8a5=~f5,~sg8a6=~f6,~sg8a7=~f7,~sg8a8=~f8];});
335         if([~sg8b1,~sg8b2,~sg8b3,~sg8b4,~sg8b5,~sg8b6,~sg8b7,~sg8b8,~sg8b9,~sg8b10,~sg8b11,~sg8b12] == [nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil], {[~sg8b1=~f1,~sg8b2=~f2,~sg8b3=~f3,~sg8b4=~f4,~sg8b5=~f5,~sg8b6=~f6,~sg8b7=~f7,~sg8b8=~f8];});
336         if([~sg8c1,~sg8c2,~sg8c3,~sg8c4,~sg8c5,~sg8c6,~sg8c7,~sg8c8,~sg8c9,~sg8c10,~sg8c11,~sg8c12] == [nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil], {[~sg8c1=~f1,~sg8c2=~f2,~sg8c3=~f3,~sg8c4=~f4,~sg8c5=~f5,~sg8c6=~f6,~sg8c7=~f7,~sg8c8=~f8];});
337         if([~sg8d1,~sg8d2,~sg8d3,~sg8d4,~sg8d5,~sg8d6,~sg8d7,~sg8d8,~sg8d9,~sg8d10,~sg8d11,~sg8d12] == [nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil], {[~sg8d1=~f1,~sg8d2=~f2,~sg8d3=~f3,~sg8d4=~f4,~sg8d5=~f5,~sg8d6=~f6,~sg8d7=~f7,~sg8d8=~f8];});
338         if([~sg8e1,~sg8e2,~sg8e3,~sg8e4,~sg8e5,~sg8e6,~sg8e7,~sg8e8,~sg8e9,~sg8e10,~sg8e11,~sg8e12] == [nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil], {[~sg8e1=~f1,~sg8e2=~f2,~sg8e3=~f3,~sg8e4=~f4,~sg8e5=~f5,~sg8e6=~f6,~sg8e7=~f7,~sg8e8=~f8];});
339         if([~sg8f1,~sg8f2,~sg8f3,~sg8f4,~sg8f5,~sg8f6,~sg8f7,~sg8f8,~sg8f9,~sg8f10,~sg8f11,~sg8f12] == [nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil], {[~sg8f1=~f1,~sg8f2=~f2,~sg8f3=~f3,~sg8f4=~f4,~sg8f5=~f5,~sg8f6=~f6,~sg8f7=~f7,~sg8f8=~f8];});
340         if([~sg8g1,~sg8g2,~sg8g3,~sg8g4,~sg8g5,~sg8g6,~sg8g7,~sg8g8,~sg8g9,~sg8g10,~sg8g11,~sg8g12] == [nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil], {[~sg8g1=~f1,~sg8g2=~f2,~sg8g3=~f3,~sg8g4=~f4,~sg8g5=~f5,~sg8g6=~f6,~sg8g7=~f7,~sg8g8=~f8];});
341         if([~sg8h1,~sg8h2,~sg8h3,~sg8h4,~sg8h5,~sg8h6,~sg8h7,~sg8h8,~sg8h9,~sg8h10,~sg8h11,~sg8h12] == [nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil], {[~sg8h1=~f1,~sg8h2=~f2,~sg8h3=~f3,~sg8h4=~f4,~sg8h5=~f5,~sg8h6=~f6,~sg8h7=~f7,~sg8h8=~f8];});
342
343
344         //set n1-n9 ratio values
345
346         case
347         {~ratio_setting == "psine1";}{~n_value1 = ~gm;    ~n_value2 = ~gm2;   ~n_value6 = ~gm6;}
348         {~ratio_setting == "psine2";}{~n_value1 = ~ngm1;  ~n_value2 = ~ngm2;  ~n_value6 = ~ngm6;}
349         {~ratio_setting == "psine3";}{~n_value1 = ~nngm1; ~n_value2 = ~nngm2; ~n_value6 = ~nngm6;}
350         {~ratio_setting == "hsine1";}{~n_value1 = ~h1;    ~n_value2 = ~h2;    ~n_value6 = ~h6;}
351         {~ratio_setting == "hsine2";}{~n_value1 = ~nh1;   ~n_value2 = ~nh2;   ~n_value6 = ~nh6;}
352         {~ratio_setting == "hsine3";}{~n_value1 = ~nnh1;  ~n_value2 = ~nnh2;  ~n_value6 = ~nnh6;};
353
354
355         //King Wen sequence interpretation settings 1-3 for synthdefs
356
357         ~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 ]]};
358         ~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 ]]};
359
360         ~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 ]]};
361         ~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 ]]};
362
363         ~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    ]]};
364         ~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    ]]};
365
366
367         //synthdefs
368
369         ~gsine = {
370
371                 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,
372                         a, b, c, d, e, f, pan=0, fc = 1;
373                         var s1, out, env1, s2, dseq;
374                         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
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*~first_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, 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(\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,
390                         a, b, c, d, e, f, pan=0, fc = 1, id = -1;
391                         var s1, out, env1, s2, dseq;
392                         9.do(x = 0; {("n"++(x=x+1)).asSymbol.envirPut(~n_value1)});
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*~first_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].flatten.reverse, 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(\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,
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_value2)});
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*~second_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, 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                 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,
426                         a, b, c, d, e, f, pan=0, fc = 1, id = -1;
427                         var s1, out, env1, s2, dseq;
428                         9.do(x = 0; {("n"++(x=x+1)).asSymbol.envirPut(~n_value2)});
429                         dseq = Dseq([
430                                 case
431                                 {~kws_setting == 1}{~kws_setting_1_a.value;}
432                                 {~kws_setting == 2}{~kws_setting_2_a.value;}
433                                 {~kws_setting == 3}{~kws_setting_3_a.value;} ++ Array.fill((~gsinenum*~second_harmonic -1), {
434                                         case
435                                         {~kws_setting == 1}{~kws_setting_1_b.value;}
436                                         {~kws_setting == 2}{~kws_setting_2_b.value;}
437                                         {~kws_setting == 3}{~kws_setting_3_b.value;}}).flatten].flatten.reverse, inf);
438                         s1 = GrainSin.ar(1, Impulse.ar(dur), 1/(dur), Demand.ar(Impulse.ar(dur), 0, dseq));
439                         if(~low_pass_filter_on == 1, {s1 = BLowPass.ar(s1, ~low_pass_filter_freq_limit);}, {s1 = s1});
440                         OffsetOut.ar(0, s1.dup*vol);
441                 }, [\ir]).add;
442
443                 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,
444                         a, b, c, d, e, f, pan=0, fc = 1;
445                         var s1, out, env1, s2, dseq;
446                         9.do(x = 0; {("n"++(x=x+1)).asSymbol.envirPut(~n_value6)});
447                         dseq = Dseq(
448                                 case
449                                 {~kws_setting == 1}{~kws_setting_1_a.value;}
450                                 {~kws_setting == 2}{~kws_setting_2_a.value;}
451                                 {~kws_setting == 3}{~kws_setting_3_a.value;} ++ Array.fill((~gsinenum*~third_harmonic -1), {
452                                         case
453                                         {~kws_setting == 1}{~kws_setting_1_b.value;}
454                                         {~kws_setting == 2}{~kws_setting_2_b.value;}
455                                         {~kws_setting == 3}{~kws_setting_3_b.value;}}).flatten, inf);
456                         s1 = GrainSin.ar(1, Impulse.ar(dur), 1/(dur),Demand.ar(Impulse.ar(dur), 0, dseq));
457                         if(~low_pass_filter_on == 1, {s1 = BLowPass.ar(s1, ~low_pass_filter_freq_limit);}, {s1 = s1});
458                         OffsetOut.ar(0, s1.dup*vol);
459                 }, [\ir]).add;
460
461                 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,
462                         a, b, c, d, e, f, pan=0, fc = 1;
463                         var s1, out, env1, s2, dseq;
464                         9.do(x = 0; {("n"++(x=x+1)).asSymbol.envirPut(~n_value6)});
465                         dseq = Dseq([
466                                 case
467                                 {~kws_setting == 1}{~kws_setting_1_a.value;}
468                                 {~kws_setting == 2}{~kws_setting_2_a.value;}
469                                 {~kws_setting == 3}{~kws_setting_3_a.value;} ++ Array.fill((~gsinenum*~third_harmonic -1), {
470                                         case
471                                         {~kws_setting == 1}{~kws_setting_1_b.value;}
472                                         {~kws_setting == 2}{~kws_setting_2_b.value;}
473                                         {~kws_setting == 3}{~kws_setting_3_b.value;}}).flatten].flatten.reverse, inf);
474                         s1 = GrainSin.ar(1, Impulse.ar(dur), 1/(dur), Demand.ar(Impulse.ar(dur), 0, dseq));
475                         if(~low_pass_filter_on == 1, {s1 = BLowPass.ar(s1, ~low_pass_filter_freq_limit);}, {s1 = s1});
476                         OffsetOut.ar(0, s1.dup*vol);
477                 }, [\ir]).add;
478
479                 if(~sendreplysynthdef_on == 1, {
480
481                         ~synthflow_random_sendreply_answer_f1 = '/synthflow_random_sendreply_answer_f1';
482                         ~synthflow_random_sendreply_answer_f2 = '/synthflow_random_sendreply_answer_f2';
483                         ~synthflow_random_sendreply_answer_f3 = '/synthflow_random_sendreply_answer_f3';
484
485                         3.do(~sendreply_x = 0; {
486
487                                 ~sendreply_x=~sendreply_x+1;
488
489                                 SynthDef(\gsineicfld6_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,
490                                         a, b, c, d, e, f, pan=0, fc = 1;
491                                         var s1, out, env1, s2, dseq;
492                                         9.do(x = 0; {("n"++(x=x+1)).asSymbol.envirPut(~n_value6)});
493                                         dseq = Dseq(
494                                                 case
495                                                 {~kws_setting == 1}{~kws_setting_1_a.value;}
496                                                 {~kws_setting == 2}{~kws_setting_2_a.value;}
497                                                 {~kws_setting == 3}{~kws_setting_3_a.value;} ++ Array.fill((~gsinenum*~third_harmonic -1), {
498                                                         case
499                                                         {~kws_setting == 1}{~kws_setting_1_b.value;}
500                                                         {~kws_setting == 2}{~kws_setting_2_b.value;}
501                                                         {~kws_setting == 3}{~kws_setting_3_b.value;}}).flatten, inf);
502                                         s1 = GrainSin.ar(1, Impulse.ar(dur), 1/(dur),Demand.ar(Impulse.ar(dur), 0, dseq));
503                                         if(~low_pass_filter_on == 1, {s1 = BLowPass.ar(s1, ~low_pass_filter_freq_limit);}, {s1 = s1});
504                                         OffsetOut.ar(0, s1.dup*vol);
505                                         SendReply.ar(PulseDivider.ar(Impulse.ar(dur), (~kws_setting_1_a.value.size*(~gsinenum*~third_harmonic))), ("synthflow_random_sendreply_answer_f"++(~sendreply_x)).asSymbol.envirGet, [ dseq]);
506                                 }, [\ir]).add;
507
508                         });
509                 });
510         };
511
512
513         //sendyreply functions
514
515         ~send_reply_func_western = {~freqmap.at(rrand(60, 91));};
516         ~send_reply_func_eastern = {(rrand(~freqmap.at(60), ~freqmap.at(91);))};
517
518         case
519         {~sendreplyfuncswitch == 1;}{~send_reply_func = ~send_reply_func_western;}
520         {~sendreplyfuncswitch == 2;}{~send_reply_func = ~send_reply_func_eastern;};
521
522         OSCFunc({~f1 = ~send_reply_func.value; AppClock.sched(0,{~synthflow.value;});}, '/synthflow_random_sendreply_answer_f1');
523         OSCFunc({~f2 = ~send_reply_func.value; AppClock.sched(0,{~synthflow.value;});}, '/synthflow_random_sendreply_answer_f2');
524         OSCFunc({~f3 = ~send_reply_func.value; AppClock.sched(0,{~synthflow.value;});}, '/synthflow_random_sendreply_answer_f3');
525
526
527         //set base (lowest) frequencies, set starting values for synthdef, and load synthdef on server boot
528
529         if((~gsinenum == nil) or: (~synthdef != "gsineicld"), {
530                 (
531                         if(~basefreq == nil, {~basefreq = ~base_frequency});
532                         ~fmult = 16;
533                         (#a,b,c,d,e,f = [ ~basefreq,~basefreq,~basefreq,~basefreq,~basefreq,~basefreq  ];
534                                 ~a = a; ~b = b; ~c =c; ~d = d; ~e = e;~f=f;);
535
536                         ~synthdef = "gsineicld"; ~gsinenum = ~synthdefnum;
537
538                         ~gsine.value;
539                 );
540         });
541
542
543         //generate GUI window
544
545         w = Window("Timewave Synth", Rect(0,0,Window.screenBounds.width,Window.screenBounds.height), border:true);
546
547         view = UserView(w, Window.screenBounds);
548         view.clearOnRefresh = false;
549         view.background = Color.black;
550
551         //vertical grid (inactive)
552
553         /*~b1 = Window.screenBounds.width/(12*4) /*25.462962962963*/; ~btu = 31; ~btd = 375; ~bw = 0.5; ~bh = 80; ~bcolor = Color.grey;
554         View(w, Rect(~b1, ~btu, ~bw, ~bh)).background = ~bcolor;
555         View(w, Rect(~b1, ~btd, ~bw, ~bh)).background = ~bcolor;
556         54.do({View(w, Rect(~b1 = ~b1+(Window.screenBounds.width/(12*4)), ~btu, ~bw, ~bh)).background = ~bcolor;});
557         ~b1 = Window.screenBounds.width/(12*4);
558         54.do({View(w, Rect(~b1 = ~b1+(Window.screenBounds.width/(12*4)), ~btd, ~bw, ~bh)).background = ~bcolor;});*/
559
560
561         //horizontal grid
562
563         ~nh = 2;
564         ~nw = ~nh*1.6180339887499;
565
566         ~tgrid = 30;
567         ~bgrid = Window.screenBounds.height-(Window.screenBounds.height/1.6180339887499)+30;
568
569         ~dc1 = ~tgrid-5; ~dc2 = ~bgrid-5; ~dca = 10;
570
571         4.do(x=~tgrid-10; {View(w, Rect(1, x=x+10, Window.screenBounds.width, 0.5)).background = Color.new255(51, 51, 51)});
572         4.do(x=~bgrid-10; {View(w, Rect(1, x=x+10, Window.screenBounds.width, 0.5)).background = Color.new255(51, 51, 51)});
573
574         ~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;);
575         ~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;);
576         ~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;);
577         ~zmid = (View(w, Rect(x, 280, ~nw, 2)).background = Color.clear;);
578         ~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;);
579         ~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;);
580         ~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;);
581
582         ~dc1 = ~tgrid-5; ~dc2 = ~bgrid-5; ~dca = 10;
583
584
585         //synth functions (open, flow, slide, pause, free)
586
587         ~synthopen = {
588                 case
589                 {((~l1a.isRunning == false) and: (~l1a1.isRunning == false)) or: ~l1a1.isRunning == true}{
590                         if(~l1a1.isRunning == true, {
591                                 (1.do({var vol1,vol2,vol3,s1,s2,s3,s4,s5,s6,f1,f2,f3;
592                                         #vol1,vol2,vol3 = [~vol1,~vol2,~vol3];
593                                         #f1,f2,f3 = [ 0,0,0 ];
594                                         s.makeBundle(0, {
595                                                 ~l1a1.set(\dur, f1,     \vol, vol1);  ~l1b1.set(\dur, f1,  \vol, vol1);
596                                                 ~l1c1.set(\dur, f1/~icd3,       \vol, vol1);  ~l1d1.set(\dur, f1/~icd3,  \vol, vol1);
597                                                 ~l1e1.set(\dur, f1/~icd6,       \vol, vol1);  ~l1f1.set(\dur, f1/~icd6,  \vol, vol1);
598                                                 ~l2a1.set(\dur, f2,     \vol, vol2);          ~l2b1.set(\dur, f2,  \vol, vol2);
599                                                 ~l2c1.set(\dur, f2/~icd3,       \vol, vol2);  ~l2d1.set(\dur, f2/~icd3,  \vol, vol2);
600                                                 ~l2e1.set(\dur, f2/~icd6,       \vol, vol2);  ~l2f1.set(\dur, f2/~icd6,  \vol, vol2);
601                                                 ~l3a1.set(\dur, f3,     \vol, vol3);          ~l3b1.set(\dur, f3,  \vol, vol3);
602                                                 ~l3c1.set(\dur, f3/~icd3,       \vol, vol3);  ~l3d1.set(\dur, f3/~icd3,  \vol, vol3);
603                                                 ~l3e1.set(\dur, f3/~icd6,       \vol, vol3);  ~l3f1.set(\dur, f3/~icd6,  \vol, vol3);
604                                         });
605                                 }););
606                         });
607
608                         (
609                                 1.do({var vol1,vol2,vol3,s1,s2,s3,s4,s5,s6,s1_1,s1_2,s1_3;
610                                         #vol1,vol2,vol3 = [~vol1,~vol2,~vol3];
611                                         #s1,s2,s3,s4,s5,s6 = [\gsineicfld6, \gsineicrld6, \gsineicfld2, \gsineicrld2, \gsineicfld1, \gsineicrld1];
612                                         case
613                                         {~sendreplysynthdef_on == 0}{#s1_1,s1_2,s1_3 = \gsineicfld6!3;}
614                                         {~sendreplysynthdef_on == 1}{#s1_1,s1_2,s1_3 =
615                                                 [\gsineicfld6_f1, \gsineicfld6_f2, \gsineicfld6_f3];};
616                                         s.makeBundle(0, {
617                                                 ~l1a = Synth(s1_1, [\dur, ~f1,    \vol, vol1]).register;    ~l1b = Synth(s2, [\dur, ~f1,    \vol, vol1]);
618                                                 ~l1c = Synth(s3, [\dur, ~f1/~icd3,  \vol, vol1]);   ~l1d = Synth(s4, [\dur, ~f1/~icd3,  \vol, vol1]);
619                                                 ~l1e = Synth(s5, [\dur, ~f1/~icd6,  \vol, vol1]);   ~l1f = Synth(s6, [\dur, ~f1/~icd6,  \vol, vol1]);
620                                                 ~l2a = Synth(s1_2, [\dur, ~f2,    \vol, vol2]);        ~l2b = Synth(s2, [\dur, ~f2,    \vol, vol2]);
621                                                 ~l2c = Synth(s3, [\dur, ~f2/~icd3,  \vol, vol2]);   ~l2d = Synth(s4, [\dur, ~f2/~icd3,  \vol, vol2]);
622                                                 ~l2e = Synth(s5, [\dur, ~f2/~icd6,  \vol, vol2]);   ~l2f = Synth(s6, [\dur, ~f2/~icd6,  \vol, vol2]);
623                                                 ~l3a = Synth(s1_3, [\dur, ~f3,    \vol, vol3]);        ~l3b = Synth(s2, [\dur, ~f3,   \vol, vol3]);
624                                                 ~l3c = Synth(s3, [\dur, ~f3/~icd3,  \vol, vol3]);   ~l3d = Synth(s4, [\dur, ~f3/~icd3, \vol, vol3]);
625                                                 ~l3e = Synth(s5, [\dur, ~f3/~icd6,  \vol, vol3]);   ~l3f = Synth(s6, [\dur, ~f3/~icd6, \vol, vol3]);
626                                         });
627                                 });
628                         );
629                         if(~l1a1.isRunning == true, {
630                                 AppClock.sched(0.161803398875,{
631                                         ([~l1a1,~l1b1,~l1c1,~l1d1,~l1e1,~l1f1,~l2a1,~l2b1,~l2c1,~l2d1,~l2e1,~l2f1,~l3a1,~l3b1,~l3c1,~l3d1,~l3e1,~l3f1 ].do(_.free)); ~slideroutine.stop;
632                                 });
633                         });
634                 }
635                 {~l1a.isRunning == true}{
636                         (1.do({var vol1,vol2,vol3,s1,s2,s3,s4,s5,s6,f1,f2,f3;
637                                 #vol1,vol2,vol3 = [~vol1,~vol2,~vol3];
638                                 #f1,f2,f3 = [ 0,0,0 ];
639                                 s.makeBundle(0, {
640                                         ~l1a.set(\dur, f1,     \vol, vol1);  ~l1b.set(\dur, f1,  \vol, vol1);
641                                         ~l1c.set(\dur, f1/~icd3,       \vol, vol1);  ~l1d.set(\dur, f1/~icd3,  \vol, vol1);
642                                         ~l1e.set(\dur, f1/~icd6,       \vol, vol1);  ~l1f.set(\dur, f1/~icd6,  \vol, vol1);
643                                         ~l2a.set(\dur, f2,     \vol, vol2);          ~l2b.set(\dur, f2,  \vol, vol2);
644                                         ~l2c.set(\dur, f2/~icd3,       \vol, vol2);  ~l2d.set(\dur, f2/~icd3,  \vol, vol2);
645                                         ~l2e.set(\dur, f2/~icd6,       \vol, vol2);  ~l2f.set(\dur, f2/~icd6,  \vol, vol2);
646                                         ~l3a.set(\dur, f3,     \vol, vol3);          ~l3b.set(\dur, f3,  \vol, vol3);
647                                         ~l3c.set(\dur, f3/~icd3,       \vol, vol3);  ~l3d.set(\dur, f3/~icd3,  \vol, vol3);
648                                         ~l3e.set(\dur, f3/~icd6,       \vol, vol3);  ~l3f.set(\dur, f3/~icd6,  \vol, vol3);
649                                 });
650                         }););
651
652                         (
653                                 1.do({var vol1,vol2,vol3,s1,s2,s3,s4,s5,s6,s1_1,s1_2,s1_3;
654                                         #vol1,vol2,vol3 = [~vol1,~vol2,~vol3];
655                                         #s1,s2,s3,s4,s5,s6 = [\gsineicfld6, \gsineicrld6, \gsineicfld2, \gsineicrld2, \gsineicfld1, \gsineicrld1];
656                                         case
657                                         {~sendreplysynthdef_on == 0}{#s1_1,s1_2,s1_3 = \gsineicfld6!3;}
658                                         {~sendreplysynthdef_on == 1}{#s1_1,s1_2,s1_3 =
659                                                 [\gsineicfld6_f1, \gsineicfld6_f2, \gsineicfld6_f3];};
660                                         s.makeBundle(0, {
661                                                 ~l1a1 = Synth(s1_1, [\dur, ~f1,    \vol, vol1]).register;    ~l1b1 = Synth(s2, [\dur, ~f1,    \vol, vol1]);
662                                                 ~l1c1 = Synth(s3, [\dur, ~f1/~icd3,  \vol, vol1]);   ~l1d1 = Synth(s4, [\dur, ~f1/~icd3,  \vol, vol1]);
663                                                 ~l1e1 = Synth(s5, [\dur, ~f1/~icd6,  \vol, vol1]);   ~l1f1 = Synth(s6, [\dur, ~f1/~icd6,  \vol, vol1]);
664                                                 ~l2a1 = Synth(s1_2, [\dur, ~f2,    \vol, vol2]);        ~l2b1 = Synth(s2, [\dur, ~f2,    \vol, vol2]);
665                                                 ~l2c1 = Synth(s3, [\dur, ~f2/~icd3,  \vol, vol2]);   ~l2d1 = Synth(s4, [\dur, ~f2/~icd3,  \vol, vol2]);
666                                                 ~l2e1 = Synth(s5, [\dur, ~f2/~icd6,  \vol, vol2]);   ~l2f1 = Synth(s6, [\dur, ~f2/~icd6,  \vol, vol2]);
667                                                 ~l3a1 = Synth(s1_3, [\dur, ~f3,    \vol, vol3]);        ~l3b1 = Synth(s2, [\dur, ~f3,   \vol, vol3]);
668                                                 ~l3c1 = Synth(s3, [\dur, ~f3/~icd3,  \vol, vol3]);   ~l3d1 = Synth(s4, [\dur, ~f3/~icd3, \vol, vol3]);
669                                                 ~l3e1 = Synth(s5, [\dur, ~f3/~icd6,  \vol, vol3]);   ~l3f1 = Synth(s6, [\dur, ~f3/~icd6, \vol, vol3]);
670                                         });
671                                 });
672                         );
673                         AppClock.sched(0.161803398875,{
674                                 ([~l1a,~l1b,~l1c,~l1d,~l1e,~l1f,~l2a,~l2b,~l2c,~l2d,~l2e,~l2f,~l3a,~l3b,~l3c,~l3d,~l3e,~l3f].do(_.free)); ~slideroutine.stop;
675                         });
676                 };
677
678                 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;);});
679                 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;);});
680                 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;);});
681
682                 b3.value = 1;
683         };
684
685         ~synthflow = {
686                 case
687                 {~l1a1.isRunning == true}{
688                         (1.do({var vol1,vol2,vol3,s1,s2,s3,s4,s5,s6;
689                                 #vol1,vol2,vol3 = [~vol1,~vol2,~vol3];
690                                 s.makeBundle(0, {
691                                         ~l1a1.set(\dur, ~f1,     \vol, vol1);  ~l1b1.set(\dur, ~f1,  \vol, vol1);
692                                         ~l1c1.set(\dur, ~f1/~icd3,       \vol, vol1);  ~l1d1.set(\dur, ~f1/~icd3,  \vol, vol1);
693                                         ~l1e1.set(\dur, ~f1/~icd6,       \vol, vol1);  ~l1f1.set(\dur, ~f1/~icd6,  \vol, vol1);
694                                         ~l2a1.set(\dur, ~f2,     \vol, vol2);          ~l2b1.set(\dur, ~f2,  \vol, vol2);
695                                         ~l2c1.set(\dur, ~f2/~icd3,       \vol, vol2);  ~l2d1.set(\dur, ~f2/~icd3,  \vol, vol2);
696                                         ~l2e1.set(\dur, ~f2/~icd6,       \vol, vol2);  ~l2f1.set(\dur, ~f2/~icd6,  \vol, vol2);
697                                         ~l3a1.set(\dur, ~f3,     \vol, vol3);          ~l3b1.set(\dur, ~f3,  \vol, vol3);
698                                         ~l3c1.set(\dur, ~f3/~icd3,       \vol, vol3);  ~l3d1.set(\dur, ~f3/~icd3,  \vol, vol3);
699                                         ~l3e1.set(\dur, ~f3/~icd6,       \vol, vol3);  ~l3f1.set(\dur, ~f3/~icd6,  \vol, vol3);
700                                 });
701                         }););
702                 }
703                 {~l1a.isRunning == true} {
704                         (1.do({var vol1,vol2,vol3,s1,s2,s3,s4,s5,s6;
705                                 #vol1,vol2,vol3 = [~vol1,~vol2,~vol3];
706                                 s.makeBundle(0, {
707                                         ~l1a.set(\dur, ~f1,     \vol, vol1);  ~l1b.set(\dur, ~f1,  \vol, vol1);
708                                         ~l1c.set(\dur, ~f1/~icd3,       \vol, vol1);  ~l1d.set(\dur, ~f1/~icd3,  \vol, vol1);
709                                         ~l1e.set(\dur, ~f1/~icd6,       \vol, vol1);  ~l1f.set(\dur, ~f1/~icd6,  \vol, vol1);
710                                         ~l2a.set(\dur, ~f2,     \vol, vol2);          ~l2b.set(\dur, ~f2,  \vol, vol2);
711                                         ~l2c.set(\dur, ~f2/~icd3,       \vol, vol2);  ~l2d.set(\dur, ~f2/~icd3,  \vol, vol2);
712                                         ~l2e.set(\dur, ~f2/~icd6,       \vol, vol2);  ~l2f.set(\dur, ~f2/~icd6,  \vol, vol2);
713                                         ~l3a.set(\dur, ~f3,     \vol, vol3);          ~l3b.set(\dur, ~f3,  \vol, vol3);
714                                         ~l3c.set(\dur, ~f3/~icd3,       \vol, vol3);  ~l3d.set(\dur, ~f3/~icd3,  \vol, vol3);
715                                         ~l3e.set(\dur, ~f3/~icd6,       \vol, vol3);  ~l3f.set(\dur, ~f3/~icd6,  \vol, vol3);
716                                 });
717                         }););
718                 };
719
720                 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;);});
721                 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;);});
722                 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;);});
723         };
724
725         ~synthslide = {
726                 case
727                 {~l1a1.isRunning == true}{(//fprog
728                         ~slideroutine = Routine({1.do({var vol1,vol2,vol3,s1,s2,s3,s4,s5,s6;
729                                 #vol1,vol2,vol3 = [~vol1,~vol2,~vol3];
730                                 ~slidedo.do({~slidecount=~slidecount-1;
731                                         (
732                                                 [ ~f1=~f1+g,~f2=~f2+h,~f3=~f3+i ];
733                                                 s.makeBundle(0, {
734                                                         ~l1a1.set(\dur, ~f1,     \vol, vol1);  ~l1b1.set(\dur, ~f1,  \vol, vol1);
735                                                         ~l1c1.set(\dur, ~f1/~icd3,       \vol, vol1);  ~l1d1.set(\dur, ~f1/~icd3,  \vol, vol1);
736                                                         ~l1e1.set(\dur, ~f1/~icd6,       \vol, vol1);  ~l1f1.set(\dur, ~f1/~icd6,  \vol, vol1);
737                                                         ~l2a1.set(\dur, ~f2,     \vol, vol2);          ~l2b1.set(\dur, ~f2,  \vol, vol2);
738                                                         ~l2c1.set(\dur, ~f2/~icd3,       \vol, vol2);  ~l2d1.set(\dur, ~f2/~icd3,  \vol, vol2);
739                                                         ~l2e1.set(\dur, ~f2/~icd6,       \vol, vol2);  ~l2f1.set(\dur, ~f2/~icd6,  \vol, vol2);
740                                                         ~l3a1.set(\dur, ~f3,     \vol, vol3);          ~l3b1.set(\dur, ~f3,  \vol, vol3);
741                                                         ~l3c1.set(\dur, ~f3/~icd3,       \vol, vol3);  ~l3d1.set(\dur, ~f3/~icd3,  \vol, vol3);
742                                                         ~l3e1.set(\dur, ~f3/~icd6,       \vol, vol3);  ~l3f1.set(\dur, ~f3/~icd6,  \vol, vol3);
743                                                 });
744                                         );
745
746                                         {if(~slidecount==0,{
747                                                 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;);});
748                                                 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;);});
749                                                 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;);});
750                                         });}.defer;
751
752                                         (~slidetime/~slidedo).wait;});});}).play;);}
753                 {~l1a.isRunning == true} {(//fprog
754                         ~slideroutine = Routine({1.do({var vol1,vol2,vol3,s1,s2,s3,s4,s5,s6;
755                                 #vol1,vol2,vol3= [~vol1,~vol2,~vol3];
756                                 ~slidedo.do({~slidecount=~slidecount-1;
757                                         (
758                                                 [ ~f1=~f1+g,~f2=~f2+h,~f3=~f3+i ];
759                                                 s.makeBundle(0, {
760                                                         ~l1a.set(\dur, ~f1,     \vol, vol1);  ~l1b.set(\dur, ~f1,  \vol, vol1);
761                                                         ~l1c.set(\dur, ~f1/~icd3,       \vol, vol1);  ~l1d.set(\dur, ~f1/~icd3,  \vol, vol1);
762                                                         ~l1e.set(\dur, ~f1/~icd6,       \vol, vol1);  ~l1f.set(\dur, ~f1/~icd6,  \vol, vol1);
763                                                         ~l2a.set(\dur, ~f2,     \vol, vol2);          ~l2b.set(\dur, ~f2,  \vol, vol2);
764                                                         ~l2c.set(\dur, ~f2/~icd3,       \vol, vol2);  ~l2d.set(\dur, ~f2/~icd3,  \vol, vol2);
765                                                         ~l2e.set(\dur, ~f2/~icd6,       \vol, vol2);  ~l2f.set(\dur, ~f2/~icd6,  \vol, vol2);
766                                                         ~l3a.set(\dur, ~f3,     \vol, vol3);          ~l3b.set(\dur, ~f3,  \vol, vol3);
767                                                         ~l3c.set(\dur, ~f3/~icd3,       \vol, vol3);  ~l3d.set(\dur, ~f3/~icd3,  \vol, vol3);
768                                                         ~l3e.set(\dur, ~f3/~icd6,       \vol, vol3);  ~l3f.set(\dur, ~f3/~icd6,  \vol, vol3);
769                                                 });
770                                         );
771
772                                         {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;);});
773                                                 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;);});
774                                                 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;);});
775                                         });}.defer;
776
777                                         (~slidetime/~slidedo).wait;});});}).play;);};
778         };
779
780         ~synthpause = {(
781                 case
782                 {~l1a1.isRunning == true}{
783                         (1.do({var vol1,vol2,vol3,s1,s2,s3,s4,s5,s6,f1,f2,f3;
784                                 #vol1,vol2,vol3 = [~vol1,~vol2,~vol3];
785                                 #f1,f2,f3 = [ 0,0,0 ];
786                                 s.makeBundle(0, {
787                                         ~l1a1.set(\dur, f1,     \vol, vol1);          ~l1b1.set(\dur, f1,  \vol, vol1);
788                                         ~l1c1.set(\dur, f1/~icd3,       \vol, vol1);  ~l1d1.set(\dur, f1/~icd3,  \vol, vol1);
789                                         ~l1e1.set(\dur, f1/~icd6,       \vol, vol1);  ~l1f1.set(\dur, f1/~icd6,  \vol, vol1);
790                                         ~l2a1.set(\dur, f2,     \vol, vol2);          ~l2b1.set(\dur, f2,  \vol, vol2);
791                                         ~l2c1.set(\dur, f2/~icd3,       \vol, vol2);  ~l2d1.set(\dur, f2/~icd3,  \vol, vol2);
792                                         ~l2e1.set(\dur, f2/~icd6,       \vol, vol2);  ~l2f1.set(\dur, f2/~icd6,  \vol, vol2);
793                                         ~l3a1.set(\dur, f3,     \vol, vol3);          ~l3b1.set(\dur, f3,  \vol, vol3);
794                                         ~l3c1.set(\dur, f3/~icd3,       \vol, vol3);  ~l3d1.set(\dur, f3/~icd3,  \vol, vol3);
795                                         ~l3e1.set(\dur, f3/~icd6,       \vol, vol3);  ~l3f1.set(\dur, f3/~icd6,  \vol, vol3);
796                                 });
797                         }););
798                 }
799                 {~l1a.isRunning == true} {
800                         (1.do({var vol1,vol2,vol3,s1,s2,s3,s4,s5,s6,f1,f2,f3;
801                                 #vol1,vol2,vol3 = [~vol1,~vol2,~vol3];
802                                 #f1,f2,f3 = [ 0,0,0 ];
803                                 s.makeBundle(0, {
804                                         ~l1a.set(\dur, f1,     \vol, vol1);  ~l1b.set(\dur, f1,  \vol, vol1);
805                                         ~l1c.set(\dur, f1/~icd3,       \vol, vol1);  ~l1d.set(\dur, f1/~icd3,  \vol, vol1);
806                                         ~l1e.set(\dur, f1/~icd6,       \vol, vol1);  ~l1f.set(\dur, f1/~icd6,  \vol, vol1);
807                                         ~l2a.set(\dur, f2,     \vol, vol2);          ~l2b.set(\dur, f2,  \vol, vol2);
808                                         ~l2c.set(\dur, f2/~icd3,       \vol, vol2);  ~l2d.set(\dur, f2/~icd3,  \vol, vol2);
809                                         ~l2e.set(\dur, f2/~icd6,       \vol, vol2);  ~l2f.set(\dur, f2/~icd6,  \vol, vol2);
810                                         ~l3a.set(\dur, f3,     \vol, vol3);          ~l3b.set(\dur, f3,  \vol, vol3);
811                                         ~l3c.set(\dur, f3/~icd3,       \vol, vol3);  ~l3d.set(\dur, f3/~icd3,  \vol, vol3);
812                                         ~l3e.set(\dur, f3/~icd6,       \vol, vol3);  ~l3f.set(\dur, f3/~icd6,  \vol, vol3);
813                                 });
814                         }););
815                 };
816         );
817         };
818
819         ~synthfree = {
820                 (
821                         case
822                         {~l1a1.isRunning == true}{
823                                 (1.do({var vol1,vol2,vol3,s1,s2,s3,s4,s5,s6,f1,f2,f3;
824                                         #vol1,vol2,vol3 = [~vol1,~vol2,~vol3];
825                                         #f1,f2,f3 = [ 0,0,0 ];
826                                         s.makeBundle(0, {
827                                                 ~l1a1.set(\dur, f1,     \vol, vol1);  ~l1b1.set(\dur, f1,  \vol, vol1);
828                                                 ~l1c1.set(\dur, f1/~icd3,       \vol, vol1);  ~l1d1.set(\dur, f1/~icd3,  \vol, vol1);
829                                                 ~l1e1.set(\dur, f1/~icd6,       \vol, vol1);  ~l1f1.set(\dur, f1/~icd6,  \vol, vol1);
830                                                 ~l2a1.set(\dur, f2,     \vol, vol2);          ~l2b1.set(\dur, f2,  \vol, vol2);
831                                                 ~l2c1.set(\dur, f2/~icd3,       \vol, vol2);  ~l2d1.set(\dur, f2/~icd3,  \vol, vol2);
832                                                 ~l2e1.set(\dur, f2/~icd6,       \vol, vol2);  ~l2f1.set(\dur, f2/~icd6,  \vol, vol2);
833                                                 ~l3a1.set(\dur, f3,     \vol, vol3);          ~l3b1.set(\dur, f3,  \vol, vol3);
834                                                 ~l3c1.set(\dur, f3/~icd3,       \vol, vol3);  ~l3d1.set(\dur, f3/~icd3,  \vol, vol3);
835                                                 ~l3e1.set(\dur, f3/~icd6,       \vol, vol3);  ~l3f1.set(\dur, f3/~icd6,  \vol, vol3);
836                                         });
837                                 }););
838                                 AppClock.sched(0.161803398875,{
839                                         ([~l1a1,~l1b1,~l1c1,~l1d1,~l1e1,~l1f1,~l2a1,~l2b1,~l2c1,~l2d1,~l2e1,~l2f1,~l3a1,~l3b1,~l3c1,~l3d1,~l3e1,~l3f1 ].do(_.free)); ~slideroutine.stop;
840                                 });
841                         }
842                         {~l1a.isRunning == true}{
843                                 (1.do({var vol1,vol2,vol3,s1,s2,s3,s4,s5,s6,f1,f2,f3;
844                                         #vol1,vol2,vol3 = [~vol1,~vol2,~vol3];
845                                         #f1,f2,f3 = [ 0,0,0 ];
846                                         s.makeBundle(0, {
847                                                 ~l1a.set(\dur, f1,     \vol, vol1);  ~l1b.set(\dur, f1,  \vol, vol1);
848                                                 ~l1c.set(\dur, f1/~icd3,       \vol, vol1);  ~l1d.set(\dur, f1/~icd3,  \vol, vol1);
849                                                 ~l1e.set(\dur, f1/~icd6,       \vol, vol1);  ~l1f.set(\dur, f1/~icd6,  \vol, vol1);
850                                                 ~l2a.set(\dur, f2,     \vol, vol2);          ~l2b.set(\dur, f2,  \vol, vol2);
851                                                 ~l2c.set(\dur, f2/~icd3,       \vol, vol2);  ~l2d.set(\dur, f2/~icd3,  \vol, vol2);
852                                                 ~l2e.set(\dur, f2/~icd6,       \vol, vol2);  ~l2f.set(\dur, f2/~icd6,  \vol, vol2);
853                                                 ~l3a.set(\dur, f3,     \vol, vol3);          ~l3b.set(\dur, f3,  \vol, vol3);
854                                                 ~l3c.set(\dur, f3/~icd3,       \vol, vol3);  ~l3d.set(\dur, f3/~icd3,  \vol, vol3);
855                                                 ~l3e.set(\dur, f3/~icd6,       \vol, vol3);  ~l3f.set(\dur, f3/~icd6,  \vol, vol3);
856                                         });
857                                 }););
858                                 AppClock.sched(0.161803398875,{
859                                         ([~l1a,~l1b,~l1c,~l1d,~l1e,~l1f,~l2a,~l2b,~l2c,~l2d,~l2e,~l2f,~l3a,~l3b,~l3c,~l3d,~l3e,~l3f].do(_.free)); ~slideroutine.stop;
860                                 });
861                         };
862                 );
863         };
864
865
866         //timer values
867
868         case
869         {~slot1 == nil}{""}
870         {~slot2 == nil}{""}
871         {~slot3 == nil}{""}
872         {~slot4 == nil}{""}
873         {~slot5 == nil}{""}
874         {~slot6 == nil}{""}
875         {~slot7 == nil}{""}
876         {~slot8 == nil}{""};
877
878         ~timevals = {(~tst = TextView(w, Rect(~tspl,~tspt, ~tspw, ~tsph)).background_(Color.black);
879                 (~tst.string =
880                         "o1:_"++~time1o.value.asString++"_f1:_"++~time1f.value.asString++"_s1:_"++~time1s.value.asString++"\n" ++
881                         "o2:_"++~time2o.value.asString++"_f2:_"++~time2f.value.asString++"_s2:_"++~time2s.value.asString++"\n" ++
882                         "o3:_"++~time3o.value.asString++"_f3:_"++~time3f.value.asString++"_s3:_"++~time3s.value.asString++"\n" ++
883                         "o4:_"++~time4o.value.asString++"_f4:_"++~time4f.value.asString++"_s4:_"++~time4s.value.asString++"\n" ++
884                         "o5:_"++~time5o.value.asString++"_f5:_"++~time5f.value.asString++"_s5:_"++~time5s.value.asString++"\n" ++
885                         "o6:_"++~time6o.value.asString++"_f6:_"++~time6f.value.asString++"_s6:_"++~time6s.value.asString++"\n" ++
886                         "o7:_"++~time7o.value.asString++"_f7:_"++~time7f.value.asString++"_s7:_"++~time7s.value.asString++"\n" ++
887                         "o8:_"++~time8o.value.asString++"_f8:_"++~time8f.value.asString++"_s8:_"++~time8s.value.asString++"\n" ++"\n" ++
888                         if(~slot8 != ~slot, {
889                                 (~slot1 = ~slot2).asString++"\n" ++
890                                 (~slot2 = ~slot3).asString++"\n" ++
891                                 (~slot3 = ~slot4).asString++"\n" ++
892                                 (~slot4 = ~slot5).asString++"\n" ++
893                                 (~slot5 = ~slot6).asString++"\n" ++
894                                 (~slot6 = ~slot7).asString++"\n" ++
895                                 (~slot7 = ~slot8).asString++"\n" ++
896                                 (~slot8 = ~slot).asString;
897                         },{
898                                 (~slot1).asString++"\n" ++
899                                 (~slot2).asString++"\n" ++
900                                 (~slot3).asString++"\n" ++
901                                 (~slot4).asString++"\n" ++
902                                 (~slot5).asString++"\n" ++
903                                 (~slot6).asString++"\n" ++
904                                 (~slot7).asString++"\n" ++
905                                 (~slot8).asString;
906                         });
907
908                 );
909                 ~tst.stringColor = Color.white;
910         )};
911
912
913         //monitoring number of synths function
914
915         ~numsynthsfunc = {
916                 if((~numsynths != nil) or: (~numsynths.isPlaying == true), {~numsynths.stop;});
917                 ~numsynths = Routine({inf.do({if((s.numSynths > 19) and: (3.wait; s.numSynths > 19) and: (6.wait; s.numSynths > 19), {
918
919                         AppClock.sched(0, {
920                                 if(~numsynthmessage != nil, {~numsynthmessage.close;});
921                                 ~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;
922                                 ~numsynthmessagestring = StaticText(~numsynthmessage, Rect(0,0,340+46,340+46/1.6180339887499)).background_(Color.black);
923                                 ~numsynthmessagestring.align = \topLeft;
924                                 ~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.";
925                                 ~numsynthmessagestring.stringColor = Color.white;
926                                 ~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;});});
927                                 ~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;});});
928                                 ~numsynthmessage.front;
929                         });
930                 }); 1.wait;});}).play;
931         };
932
933         ~numsynthsfunc.value;
934
935
936         //mouse down action
937
938         view.mouseDownAction = {
939                 |v, x, y, mod, butNum|
940                 point = [x,y];
941                 if(butNum == 0, { v.refresh;
942
943                         //generate dots on mouse down action
944
945                         ~tgrid = 30;
946                         ~bgrid = Window.screenBounds.height-(Window.screenBounds.height/1.6180339887499)+30;
947
948                         case
949                         {y<~tgrid} {nil}
950                         {y>=(~tgrid) and: y<=(~tgrid=~tgrid+10)}  {~z1.close;~z1 = (View(w, Rect(x, y, ~nw, 2)).background = Color.white;)}
951                         {y>=(~tgrid) and: y<=(~tgrid=~tgrid+10)}  {~z2.close;~z2 = (View(w, Rect(x, y, ~nw, 2)).background = Color.white;)}
952                         {y>=(~tgrid) and: y<=(~tgrid=~tgrid+10)}  {~z3.close;~z3 = (View(w, Rect(x, y, ~nw, 2)).background = Color.white;)}
953                         {y>~tgrid and: y<~bgrid} {nil}
954                         {y>=(~bgrid) and: y<=(~bgrid=~bgrid+10)} {~z1.close;~z1 = (View(w, Rect(x, y, ~nw, 2)).background = Color.white;)}
955                         {y>=(~bgrid) and: y<=(~bgrid=~bgrid+10)} {~z2.close;~z2 = (View(w, Rect(x, y, ~nw, 2)).background = Color.white;)}
956                         {y>=(~bgrid) and: y<=(~bgrid=~bgrid+10)} {~z3.close;~z3 = (View(w, Rect(x, y, ~nw, 2)).background = Color.white;)};
957                 }, {});
958
959                 ~tgrid = 30;
960                 ~bgrid = Window.screenBounds.height-(Window.screenBounds.height/1.6180339887499)+30;
961
962                 //set synth values on mouse down action
963
964                 case
965                 {~l1a.isRunning == true}{
966                         case
967                         {y<~tgrid} {nil}
968                         {y>=(~tgrid) and: y<=(~tgrid=~tgrid+10)} {
969                                 ~l1a.set(\dur, ((x/(Window.screenBounds.width)).linexp(0,1,~outmin1,~outmax1)));
970                                 ~l1b.set(\dur, q=((x/(Window.screenBounds.width)).linexp(0,1,~outmin1,~outmax1)).value); ~f1=q.value; ~undof1=~f1;
971                                 ~l1c.set(\dur, ((x/(Window.screenBounds.width)).linexp(0,1,~outmin1,~outmax1))/~icd3);
972                                 ~l1d.set(\dur, q=((x/(Window.screenBounds.width)).linexp(0,1,~outmin1,~outmax1)).value/~icd3);
973                                 ~l1e.set(\dur, ((x/(Window.screenBounds.width)).linexp(0,1,~outmin1,~outmax1))/~icd6);
974                                 ~l1f.set(\dur, q=((x/(Window.screenBounds.width)).linexp(0,1,~outmin1,~outmax1)).value/~icd6);}
975                         {y>=(~tgrid) and: y<=(~tgrid=~tgrid+10)} {
976                                 ~l2a.set(\dur, ((x/(Window.screenBounds.width)).linexp(0,1,~outmin1,~outmax1)));
977                                 ~l2b.set(\dur, q=((x/(Window.screenBounds.width)).linexp(0,1,~outmin1,~outmax1)).value); ~f2=q.value; ~undof2=~f2;
978                                 ~l2c.set(\dur, ((x/(Window.screenBounds.width)).linexp(0,1,~outmin1,~outmax1))/~icd3);
979                                 ~l2d.set(\dur, q=((x/(Window.screenBounds.width)).linexp(0,1,~outmin1,~outmax1)).value/~icd3);
980                                 ~l2e.set(\dur, ((x/(Window.screenBounds.width)).linexp(0,1,~outmin1,~outmax1))/~icd6);
981                                 ~l2f.set(\dur, q=((x/(Window.screenBounds.width)).linexp(0,1,~outmin1,~outmax1)).value/~icd6);}
982                         {y>=(~tgrid) and: y<=(~tgrid=~tgrid+10)} {
983                                 ~l3a.set(\dur, ((x/(Window.screenBounds.width)).linexp(0,1,~outmin1,~outmax1)));
984                                 ~l3b.set(\dur, q=((x/(Window.screenBounds.width)).linexp(0,1,~outmin1,~outmax1)).value); ~f3=q.value; ~undof3=~f3;
985                                 ~l3c.set(\dur, ((x/(Window.screenBounds.width)).linexp(0,1,~outmin1,~outmax1))/~icd3);
986                                 ~l3d.set(\dur, q=((x/(Window.screenBounds.width)).linexp(0,1,~outmin1,~outmax1)).value/~icd3);
987                                 ~l3e.set(\dur, ((x/(Window.screenBounds.width)).linexp(0,1,~outmin1,~outmax1))/~icd6);
988                                 ~l3f.set(\dur, q=((x/(Window.screenBounds.width)).linexp(0,1,~outmin1,~outmax1)).value/~icd6);}
989                         {y>~tgrid and: y<~bgrid} {nil}
990                         {y>=(~bgrid) and: y<=(~bgrid=~bgrid+10)} {
991                                 ~l1a.set(\dur, ((x/(Window.screenBounds.width)).linexp(0,1,~outmin2,~outmax2)));
992                                 ~l1b.set(\dur, q=((x/(Window.screenBounds.width)).linexp(0,1,~outmin2,~outmax2)).value); ~f1=q.value; ~undof1=~f1;
993                                 ~l1c.set(\dur, ((x/(Window.screenBounds.width)).linexp(0,1,~outmin2,~outmax2))/~icd3);
994                                 ~l1d.set(\dur, q=((x/(Window.screenBounds.width)).linexp(0,1,~outmin2,~outmax2)).value/~icd3);
995                                 ~l1e.set(\dur, ((x/(Window.screenBounds.width)).linexp(0,1,~outmin2,~outmax2))/~icd6);
996                                 ~l1f.set(\dur, q=((x/(Window.screenBounds.width)).linexp(0,1,~outmin2,~outmax2)).value/~icd6);}
997                         {y>=(~bgrid) and: y<=(~bgrid=~bgrid+10)} {
998                                 ~l2a.set(\dur, ((x/(Window.screenBounds.width)).linexp(0,1,~outmin2,~outmax2)));
999                                 ~l2b.set(\dur, q=((x/(Window.screenBounds.width)).linexp(0,1,~outmin2,~outmax2)).value); ~f2=q.value; ~undof2=~f2;
1000                                 ~l2c.set(\dur, ((x/(Window.screenBounds.width)).linexp(0,1,~outmin2,~outmax2))/~icd3);
1001                                 ~l2d.set(\dur, q=((x/(Window.screenBounds.width)).linexp(0,1,~outmin2,~outmax2)).value/~icd3);
1002                                 ~l2e.set(\dur, ((x/(Window.screenBounds.width)).linexp(0,1,~outmin2,~outmax2))/~icd6);
1003                                 ~l2f.set(\dur, q=((x/(Window.screenBounds.width)).linexp(0,1,~outmin2,~outmax2)).value/~icd6);}
1004                         {y>=(~bgrid) and: y<=(~bgrid=~bgrid+10)} {
1005                                 ~l3a.set(\dur, ((x/(Window.screenBounds.width)).linexp(0,1,~outmin2,~outmax2)));
1006                                 ~l3b.set(\dur, q=((x/(Window.screenBounds.width)).linexp(0,1,~outmin2,~outmax2)).value); ~f3=q.value; ~undof3=~f3;
1007                                 ~l3c.set(\dur, ((x/(Window.screenBounds.width)).linexp(0,1,~outmin2,~outmax2))/~icd3);
1008                                 ~l3d.set(\dur, q=((x/(Window.screenBounds.width)).linexp(0,1,~outmin2,~outmax2)).value/~icd3);
1009                                 ~l3e.set(\dur, ((x/(Window.screenBounds.width)).linexp(0,1,~outmin2,~outmax2))/~icd6);
1010                                 ~l3f.set(\dur, q=((x/(Window.screenBounds.width)).linexp(0,1,~outmin2,~outmax2)).value/~icd6);};
1011                 }
1012                 {~l1a1.isRunning == true}{
1013                         case
1014                         {y<~tgrid} {nil}
1015                         {y>=(~tgrid) and: y<=(~tgrid=~tgrid+10)} {
1016                                 ~l1a1.set(\dur, ((x/(Window.screenBounds.width)).linexp(0,1,~outmin1,~outmax1)));
1017                                 ~l1b1.set(\dur, q=((x/(Window.screenBounds.width)).linexp(0,1,~outmin1,~outmax1)).value); ~f1=q.value; ~undof1=~f1;
1018                                 ~l1c1.set(\dur, ((x/(Window.screenBounds.width)).linexp(0,1,~outmin1,~outmax1))/~icd3);
1019                                 ~l1d1.set(\dur, q=((x/(Window.screenBounds.width)).linexp(0,1,~outmin1,~outmax1)).value/~icd3);
1020                                 ~l1e1.set(\dur, ((x/(Window.screenBounds.width)).linexp(0,1,~outmin1,~outmax1))/~icd6);
1021                                 ~l1f1.set(\dur, q=((x/(Window.screenBounds.width)).linexp(0,1,~outmin1,~outmax1)).value/~icd6);}
1022                         {y>=(~tgrid) and: y<=(~tgrid=~tgrid+10)} {
1023                                 ~l2a1.set(\dur, ((x/(Window.screenBounds.width)).linexp(0,1,~outmin1,~outmax1)));
1024                                 ~l2b1.set(\dur, q=((x/(Window.screenBounds.width)).linexp(0,1,~outmin1,~outmax1)).value); ~f2=q.value; ~undof2=~f2;
1025                                 ~l2c1.set(\dur, ((x/(Window.screenBounds.width)).linexp(0,1,~outmin1,~outmax1))/~icd3);
1026                                 ~l2d1.set(\dur, q=((x/(Window.screenBounds.width)).linexp(0,1,~outmin1,~outmax1)).value/~icd3);
1027                                 ~l2e1.set(\dur, ((x/(Window.screenBounds.width)).linexp(0,1,~outmin1,~outmax1))/~icd6);
1028                                 ~l2f1.set(\dur, q=((x/(Window.screenBounds.width)).linexp(0,1,~outmin1,~outmax1)).value/~icd6);}
1029                         {y>=(~tgrid) and: y<=(~tgrid=~tgrid+10)} {
1030                                 ~l3a1.set(\dur, ((x/(Window.screenBounds.width)).linexp(0,1,~outmin1,~outmax1)));
1031                                 ~l3b1.set(\dur, q=((x/(Window.screenBounds.width)).linexp(0,1,~outmin1,~outmax1)).value); ~f3=q.value; ~undof3=~f3;
1032                                 ~l3c1.set(\dur, ((x/(Window.screenBounds.width)).linexp(0,1,~outmin1,~outmax1))/~icd3);
1033                                 ~l3d1.set(\dur, q=((x/(Window.screenBounds.width)).linexp(0,1,~outmin1,~outmax1)).value/~icd3);
1034                                 ~l3e1.set(\dur, ((x/(Window.screenBounds.width)).linexp(0,1,~outmin1,~outmax1))/~icd6);
1035                                 ~l3f1.set(\dur, q=((x/(Window.screenBounds.width)).linexp(0,1,~outmin1,~outmax1)).value/~icd6);}
1036                         {y>~tgrid and: y<~bgrid} {nil}
1037                         {y>=(~bgrid) and: y<=(~bgrid=~bgrid+10)} {
1038                                 ~l1a1.set(\dur, ((x/(Window.screenBounds.width)).linexp(0,1,~outmin2,~outmax2)));
1039                                 ~l1b1.set(\dur, q=((x/(Window.screenBounds.width)).linexp(0,1,~outmin2,~outmax2)).value); ~f1=q.value; ~undof1=~f1;
1040                                 ~l1c1.set(\dur, ((x/(Window.screenBounds.width)).linexp(0,1,~outmin2,~outmax2))/~icd3);
1041                                 ~l1d1.set(\dur, q=((x/(Window.screenBounds.width)).linexp(0,1,~outmin2,~outmax2)).value/~icd3);
1042                                 ~l1e1.set(\dur, ((x/(Window.screenBounds.width)).linexp(0,1,~outmin2,~outmax2))/~icd6);
1043                                 ~l1f1.set(\dur, q=((x/(Window.screenBounds.width)).linexp(0,1,~outmin2,~outmax2)).value/~icd6);}
1044                         {y>=(~bgrid) and: y<=(~bgrid=~bgrid+10)} {
1045                                 ~l2a1.set(\dur, ((x/(Window.screenBounds.width)).linexp(0,1,~outmin2,~outmax2)));
1046                                 ~l2b1.set(\dur, q=((x/(Window.screenBounds.width)).linexp(0,1,~outmin2,~outmax2)).value); ~f2=q.value; ~undof2=~f2;
1047                                 ~l2c1.set(\dur, ((x/(Window.screenBounds.width)).linexp(0,1,~outmin2,~outmax2))/~icd3);
1048                                 ~l2d1.set(\dur, q=((x/(Window.screenBounds.width)).linexp(0,1,~outmin2,~outmax2)).value/~icd3);
1049                                 ~l2e1.set(\dur, ((x/(Window.screenBounds.width)).linexp(0,1,~outmin2,~outmax2))/~icd6);
1050                                 ~l2f1.set(\dur, q=((x/(Window.screenBounds.width)).linexp(0,1,~outmin2,~outmax2)).value/~icd6);}
1051                         {y>=(~bgrid) and: y<=(~bgrid=~bgrid+10)} {
1052                                 ~l3a1.set(\dur, ((x/(Window.screenBounds.width)).linexp(0,1,~outmin2,~outmax2)));
1053                                 ~l3b1.set(\dur, q=((x/(Window.screenBounds.width)).linexp(0,1,~outmin2,~outmax2)).value); ~f3=q.value; ~undof3=~f3;
1054                                 ~l3c1.set(\dur, ((x/(Window.screenBounds.width)).linexp(0,1,~outmin2,~outmax2))/~icd3);
1055                                 ~l3d1.set(\dur, q=((x/(Window.screenBounds.width)).linexp(0,1,~outmin2,~outmax2)).value/~icd3);
1056                                 ~l3e1.set(\dur, ((x/(Window.screenBounds.width)).linexp(0,1,~outmin2,~outmax2))/~icd6);
1057                                 ~l3f1.set(\dur, q=((x/(Window.screenBounds.width)).linexp(0,1,~outmin2,~outmax2)).value/~icd6);};
1058                 };
1059         };
1060
1061
1062         //mouse move action
1063
1064         view.mouseMoveAction = {
1065                 |v, x, y|
1066
1067                 ~nh = 2;
1068                 ~nw = ~nh*1.6180339887499;
1069
1070                 //generate dots on mouse move action
1071
1072                 ~tgrid = 30;
1073                 ~bgrid = Window.screenBounds.height-(Window.screenBounds.height/1.6180339887499)+30;
1074
1075                 case
1076                 {y<~tgrid} {nil}
1077                 {y>=(~tgrid) and: y<=(~tgrid=~tgrid+10)}  {~z1.close;~z25.close;~z1 = (View(w, Rect(x, y, ~nw, 2)).background = Color.white;)}
1078                 {y>=(~tgrid) and: y<=(~tgrid=~tgrid+10)}  {~z2.close;~z26.close;~z2 = (View(w, Rect(x, y, ~nw, 2)).background = Color.white;)}
1079                 {y>=(~tgrid) and: y<=(~tgrid=~tgrid+10)}  {~z3.close;~z27.close;~z3 = (View(w, Rect(x, y, ~nw, 2)).background = Color.white;)}
1080                 {y>~tgrid and: y<~bgrid} {nil}
1081                 {y>=(~bgrid) and: y<=(~bgrid=~bgrid+10)} {~z1.close;~z25.close;~z1 = (View(w, Rect(x, y, ~nw, 2)).background = Color.white;)}
1082                 {y>=(~bgrid) and: y<=(~bgrid=~bgrid+10)} {~z2.close;~z26.close;~z2 = (View(w, Rect(x, y, ~nw, 2)).background = Color.white;)}
1083                 {y>=(~bgrid) and: y<=(~bgrid=~bgrid+10)} {~z3.close;~z27.close;~z3 = (View(w, Rect(x, y, ~nw, 2)).background = Color.white;)};
1084                 w.refresh;
1085
1086                 ~tgrid = 30;
1087                 ~bgrid = Window.screenBounds.height-(Window.screenBounds.height/1.6180339887499)+30;
1088
1089                 //set synth values on mouse move action
1090
1091                 case
1092                 {~l1a.isRunning == true}{
1093                         case
1094                         {y<~tgrid} {nil}
1095                         {y>=(~tgrid) and: y<=(~tgrid=~tgrid+10)} {
1096                                 ~l1a.set(\dur, ((x/(Window.screenBounds.width)).linexp(0,1,~outmin1,~outmax1)));
1097                                 ~l1b.set(\dur, q=((x/(Window.screenBounds.width)).linexp(0,1,~outmin1,~outmax1)).value); ~f1=q.value; ~undof1=~f1;
1098                                 ~l1c.set(\dur, ((x/(Window.screenBounds.width)).linexp(0,1,~outmin1,~outmax1))/~icd3);
1099                                 ~l1d.set(\dur, q=((x/(Window.screenBounds.width)).linexp(0,1,~outmin1,~outmax1)).value/~icd3);
1100                                 ~l1e.set(\dur, ((x/(Window.screenBounds.width)).linexp(0,1,~outmin1,~outmax1))/~icd6);
1101                                 ~l1f.set(\dur, q=((x/(Window.screenBounds.width)).linexp(0,1,~outmin1,~outmax1)).value/~icd6);}
1102                         {y>=(~tgrid) and: y<=(~tgrid=~tgrid+10)} {
1103                                 ~l2a.set(\dur, ((x/(Window.screenBounds.width)).linexp(0,1,~outmin1,~outmax1)));
1104                                 ~l2b.set(\dur, q=((x/(Window.screenBounds.width)).linexp(0,1,~outmin1,~outmax1)).value); ~f2=q.value; ~undof2=~f2;
1105                                 ~l2c.set(\dur, ((x/(Window.screenBounds.width)).linexp(0,1,~outmin1,~outmax1))/~icd3);
1106                                 ~l2d.set(\dur, q=((x/(Window.screenBounds.width)).linexp(0,1,~outmin1,~outmax1)).value/~icd3);
1107                                 ~l2e.set(\dur, ((x/(Window.screenBounds.width)).linexp(0,1,~outmin1,~outmax1))/~icd6);
1108                                 ~l2f.set(\dur, q=((x/(Window.screenBounds.width)).linexp(0,1,~outmin1,~outmax1)).value/~icd6);}
1109                         {y>=(~tgrid) and: y<=(~tgrid=~tgrid+10)} {
1110                                 ~l3a.set(\dur, ((x/(Window.screenBounds.width)).linexp(0,1,~outmin1,~outmax1)));
1111                                 ~l3b.set(\dur, q=((x/(Window.screenBounds.width)).linexp(0,1,~outmin1,~outmax1)).value); ~f3=q.value; ~undof3=~f3;
1112                                 ~l3c.set(\dur, ((x/(Window.screenBounds.width)).linexp(0,1,~outmin1,~outmax1))/~icd3);
1113                                 ~l3d.set(\dur, q=((x/(Window.screenBounds.width)).linexp(0,1,~outmin1,~outmax1)).value/~icd3);
1114                                 ~l3e.set(\dur, ((x/(Window.screenBounds.width)).linexp(0,1,~outmin1,~outmax1))/~icd6);
1115                                 ~l3f.set(\dur, q=((x/(Window.screenBounds.width)).linexp(0,1,~outmin1,~outmax1)).value/~icd6);}
1116                         {y>~tgrid and: y<~bgrid} {nil}
1117                         {y>=(~bgrid) and: y<=(~bgrid=~bgrid+10)} {
1118                                 ~l1a.set(\dur, ((x/(Window.screenBounds.width)).linexp(0,1,~outmin2,~outmax2)));
1119                                 ~l1b.set(\dur, q=((x/(Window.screenBounds.width)).linexp(0,1,~outmin2,~outmax2)).value); ~f1=q.value; ~undof1=~f1;
1120                                 ~l1c.set(\dur, ((x/(Window.screenBounds.width)).linexp(0,1,~outmin2,~outmax2))/~icd3);
1121                                 ~l1d.set(\dur, q=((x/(Window.screenBounds.width)).linexp(0,1,~outmin2,~outmax2)).value/~icd3);
1122                                 ~l1e.set(\dur, ((x/(Window.screenBounds.width)).linexp(0,1,~outmin2,~outmax2))/~icd6);
1123                                 ~l1f.set(\dur, q=((x/(Window.screenBounds.width)).linexp(0,1,~outmin2,~outmax2)).value/~icd6);}
1124                         {y>=(~bgrid) and: y<=(~bgrid=~bgrid+10)} {
1125                                 ~l2a.set(\dur, ((x/(Window.screenBounds.width)).linexp(0,1,~outmin2,~outmax2)));
1126                                 ~l2b.set(\dur, q=((x/(Window.screenBounds.width)).linexp(0,1,~outmin2,~outmax2)).value); ~f2=q.value; ~undof2=~f2;
1127                                 ~l2c.set(\dur, ((x/(Window.screenBounds.width)).linexp(0,1,~outmin2,~outmax2))/~icd3);
1128                                 ~l2d.set(\dur, q=((x/(Window.screenBounds.width)).linexp(0,1,~outmin2,~outmax2)).value/~icd3);
1129                                 ~l2e.set(\dur, ((x/(Window.screenBounds.width)).linexp(0,1,~outmin2,~outmax2))/~icd6);
1130                                 ~l2f.set(\dur, q=((x/(Window.screenBounds.width)).linexp(0,1,~outmin2,~outmax2)).value/~icd6);}
1131                         {y>=(~bgrid) and: y<=(~bgrid=~bgrid+10)} {
1132                                 ~l3a.set(\dur, ((x/(Window.screenBounds.width)).linexp(0,1,~outmin2,~outmax2)));
1133                                 ~l3b.set(\dur, q=((x/(Window.screenBounds.width)).linexp(0,1,~outmin2,~outmax2)).value); ~f3=q.value; ~undof3=~f3;
1134                                 ~l3c.set(\dur, ((x/(Window.screenBounds.width)).linexp(0,1,~outmin2,~outmax2))/~icd3);
1135                                 ~l3d.set(\dur, q=((x/(Window.screenBounds.width)).linexp(0,1,~outmin2,~outmax2)).value/~icd3);
1136                                 ~l3e.set(\dur, ((x/(Window.screenBounds.width)).linexp(0,1,~outmin2,~outmax2))/~icd6);
1137                                 ~l3f.set(\dur, q=((x/(Window.screenBounds.width)).linexp(0,1,~outmin2,~outmax2)).value/~icd6);};
1138                 }
1139                 {~l1a1.isRunning == true}{
1140                         case
1141                         {y<~tgrid} {nil}
1142                         {y>=(~tgrid) and: y<=(~tgrid=~tgrid+10)} {
1143                                 ~l1a1.set(\dur, ((x/(Window.screenBounds.width)).linexp(0,1,~outmin1,~outmax1)));
1144                                 ~l1b1.set(\dur, q=((x/(Window.screenBounds.width)).linexp(0,1,~outmin1,~outmax1)).value); ~f1=q.value; ~undof1=~f1;
1145                                 ~l1c1.set(\dur, ((x/(Window.screenBounds.width)).linexp(0,1,~outmin1,~outmax1))/~icd3);
1146                                 ~l1d1.set(\dur, q=((x/(Window.screenBounds.width)).linexp(0,1,~outmin1,~outmax1)).value/~icd3);
1147                                 ~l1e1.set(\dur, ((x/(Window.screenBounds.width)).linexp(0,1,~outmin1,~outmax1))/~icd6);
1148                                 ~l1f1.set(\dur, q=((x/(Window.screenBounds.width)).linexp(0,1,~outmin1,~outmax1)).value/~icd6);}
1149                         {y>=(~tgrid) and: y<=(~tgrid=~tgrid+10)} {
1150                                 ~l2a1.set(\dur, ((x/(Window.screenBounds.width)).linexp(0,1,~outmin1,~outmax1)));
1151                                 ~l2b1.set(\dur, q=((x/(Window.screenBounds.width)).linexp(0,1,~outmin1,~outmax1)).value); ~f2=q.value; ~undof2=~f2;
1152                                 ~l2c1.set(\dur, ((x/(Window.screenBounds.width)).linexp(0,1,~outmin1,~outmax1))/~icd3);
1153                                 ~l2d1.set(\dur, q=((x/(Window.screenBounds.width)).linexp(0,1,~outmin1,~outmax1)).value/~icd3);
1154                                 ~l2e1.set(\dur, ((x/(Window.screenBounds.width)).linexp(0,1,~outmin1,~outmax1))/~icd6);
1155                                 ~l2f1.set(\dur, q=((x/(Window.screenBounds.width)).linexp(0,1,~outmin1,~outmax1)).value/~icd6);}
1156                         {y>=(~tgrid) and: y<=(~tgrid=~tgrid+10)} {
1157                                 ~l3a1.set(\dur, ((x/(Window.screenBounds.width)).linexp(0,1,~outmin1,~outmax1)));
1158                                 ~l3b1.set(\dur, q=((x/(Window.screenBounds.width)).linexp(0,1,~outmin1,~outmax1)).value); ~f3=q.value; ~undof3=~f3;
1159                                 ~l3c1.set(\dur, ((x/(Window.screenBounds.width)).linexp(0,1,~outmin1,~outmax1))/~icd3);
1160                                 ~l3d1.set(\dur, q=((x/(Window.screenBounds.width)).linexp(0,1,~outmin1,~outmax1)).value/~icd3);
1161                                 ~l3e1.set(\dur, ((x/(Window.screenBounds.width)).linexp(0,1,~outmin1,~outmax1))/~icd6);
1162                                 ~l3f1.set(\dur, q=((x/(Window.screenBounds.width)).linexp(0,1,~outmin1,~outmax1)).value/~icd6);}
1163                         {y>~tgrid and: y<~bgrid} {nil}
1164                         {y>=(~bgrid) and: y<=(~bgrid=~bgrid+10)} {
1165                                 ~l1a1.set(\dur, ((x/(Window.screenBounds.width)).linexp(0,1,~outmin2,~outmax2)));
1166                                 ~l1b1.set(\dur, q=((x/(Window.screenBounds.width)).linexp(0,1,~outmin2,~outmax2)).value); ~f1=q.value; ~undof1=~f1;
1167                                 ~l1c1.set(\dur, ((x/(Window.screenBounds.width)).linexp(0,1,~outmin2,~outmax2))/~icd3);
1168                                 ~l1d1.set(\dur, q=((x/(Window.screenBounds.width)).linexp(0,1,~outmin2,~outmax2)).value/~icd3);
1169                                 ~l1e1.set(\dur, ((x/(Window.screenBounds.width)).linexp(0,1,~outmin2,~outmax2))/~icd6);
1170                                 ~l1f1.set(\dur, q=((x/(Window.screenBounds.width)).linexp(0,1,~outmin2,~outmax2)).value/~icd6);}
1171                         {y>=(~bgrid) and: y<=(~bgrid=~bgrid+10)} {
1172                                 ~l2a1.set(\dur, ((x/(Window.screenBounds.width)).linexp(0,1,~outmin2,~outmax2)));
1173                                 ~l2b1.set(\dur, q=((x/(Window.screenBounds.width)).linexp(0,1,~outmin2,~outmax2)).value); ~f2=q.value; ~undof2=~f2;
1174                                 ~l2c1.set(\dur, ((x/(Window.screenBounds.width)).linexp(0,1,~outmin2,~outmax2))/~icd3);
1175                                 ~l2d1.set(\dur, q=((x/(Window.screenBounds.width)).linexp(0,1,~outmin2,~outmax2)).value/~icd3);
1176                                 ~l2e1.set(\dur, ((x/(Window.screenBounds.width)).linexp(0,1,~outmin2,~outmax2))/~icd6);
1177                                 ~l2f1.set(\dur, q=((x/(Window.screenBounds.width)).linexp(0,1,~outmin2,~outmax2)).value/~icd6);}
1178                         {y>=(~bgrid) and: y<=(~bgrid=~bgrid+10)} {
1179                                 ~l3a1.set(\dur, ((x/(Window.screenBounds.width)).linexp(0,1,~outmin2,~outmax2)));
1180                                 ~l3b1.set(\dur, q=((x/(Window.screenBounds.width)).linexp(0,1,~outmin2,~outmax2)).value); ~f3=q.value; ~undof3=~f3;
1181                                 ~l3c1.set(\dur, ((x/(Window.screenBounds.width)).linexp(0,1,~outmin2,~outmax2))/~icd3);
1182                                 ~l3d1.set(\dur, q=((x/(Window.screenBounds.width)).linexp(0,1,~outmin2,~outmax2)).value/~icd3);
1183                                 ~l3e1.set(\dur, ((x/(Window.screenBounds.width)).linexp(0,1,~outmin2,~outmax2))/~icd6);
1184                                 ~l3f1.set(\dur, q=((x/(Window.screenBounds.width)).linexp(0,1,~outmin2,~outmax2)).value/~icd6);};
1185                 };
1186         };
1187
1188         ~tgrid = 30;
1189         ~bgrid = Window.screenBounds.height-(Window.screenBounds.height/1.6180339887499)+30;
1190         ~dc1 = ~tgrid-5; ~dc2 = ~bgrid-5; ~dca = 10;
1191
1192         ~bpl = Window.screenBounds.width-340;
1193         ~bpt = Window.screenBounds.height-88;
1194         ~bph = 40;
1195         ~bpw = 40/1.6180339887499;
1196
1197
1198         //copy button
1199
1200         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;
1201                 if(button.value == 1, {
1202
1203                         ~tsc = TextView(w, Rect(0,5, Window.screenBounds.width, 354)).background_(Color.black);
1204                         (~tsc.string =
1205                                 "current chord/frequencies: "++"\n"++"\n"++
1206
1207                                 "[~f1="++~f1.asString++",~f2="++~f2.asString++",~f3="++~f3.asString++"]"++"\n"++"\n"++
1208
1209                                 "saved open/flow 1-8 frequencies (in script format): "++"\n"++"\n"++
1210
1211                                 "[~f1="++~fp1.asString++",~f2="++~fp2.asString++",~f3="++~fp3.asString++"];"++" "++"~synthopen.value; ~trace.value; (a).wait;"++"\n"++
1212                                 "[~f1="++~fp1b.asString++",~f2="++~fp2b.asString++",~f3="++~fp3b.asString++"];"++" "++"~synthflow.value; ~trace.value; (a).wait;"++"\n"++
1213                                 "[~f1="++~fp1c.asString++",~f2="++~fp2c.asString++",~f3="++~fp3c.asString++"];"++" "++"~synthflow.value; ~trace.value; (a).wait;"++"\n"++
1214                                 "[~f1="++~fp1d.asString++",~f2="++~fp2d.asString++",~f3="++~fp3d.asString++"];"++" "++"~synthflow.value; ~trace.value; (a).wait;"++"\n"++
1215                                 "[~f1="++~fp1e.asString++",~f2="++~fp2e.asString++",~f3="++~fp3e.asString++"];"++" "++"~synthflow.value; ~trace.value; (a).wait;"++"\n"++
1216                                 "[~f1="++~fp1f.asString++",~f2="++~fp2f.asString++",~f3="++~fp3f.asString++"];"++" "++"~synthflow.value; ~trace.value; (a).wait;"++"\n"++
1217                                 "[~f1="++~fp1g.asString++",~f2="++~fp2g.asString++",~f3="++~fp3g.asString++"];"++" "++"~synthflow.value; ~trace.value; (a).wait;"++"\n"++
1218                                 "[~f1="++~fp1h.asString++",~f2="++~fp2h.asString++",~f3="++~fp3h.asString++"];"++" "++"~synthflow.value; ~trace.value; (a).wait;"++"\n"++"\n"++
1219
1220                                 "saved slide 1-8 frequencies (in script format): "++"\n"++"\n"++
1221
1222                                 "#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"++
1223                                 "#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"++
1224                                 "#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"++
1225                                 "#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"++
1226                                 "#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"++
1227                                 "#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"++
1228                                 "#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"++
1229                                 "#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;"
1230                         );
1231                         ~tsc.stringColor = Color.white;
1232                         [ ~f1,~f2,~f3 ].postln;},
1233                 {~tsc.close;});
1234         });
1235
1236
1237         /*//stop timer button
1238
1239         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;
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
1248         //timer button
1249
1250         ~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, {
1251
1252                 ~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;
1253                         if(~timer.isPlaying == true, {
1254                                 if(~tst.value == nil, {~timer.stop; ~systemclock.stop; ~systemclock.clear;},{~tst.close;
1255                                         ~timevals.value;
1256                                         ~timer.stop; ~systemclock.stop; ~systemclock.clear;});
1257                         });
1258                 });
1259
1260                 if(~tst != nil, {~tst.close});
1261                 ~timevals.value;
1262                 ~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;})});
1263
1264         });
1265
1266
1267         //start/stop synth button
1268
1269         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_({
1270                 arg synthbutton; if(synthbutton.value == 1, {
1271                         ~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);
1272                         ~synthopen.value;
1273                         ~numsynths.stop; ~numsynthsfunc.value;
1274                         ~midifunc.value;
1275                 },
1276                 {~synthfree.value; b4.value = 0;})
1277         });
1278
1279
1280         //pause/unpause button
1281
1282         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_({
1283                 arg synthbutton; if(synthbutton.value == 1, {~synthpause.value; if(~ts.value == 1, {~timer.stop;});},
1284                         {~synthflow.value; if(~ts.value != 1, {nil}, {SystemClock.play(~timer);})})
1285         });
1286
1287
1288         //generate values for number of KW(King Wen) sequences in a timewave half-cycle (or amplitude x2) pop-up menu
1289
1290         x=0;
1291         ~menu2values = Array.fill(24, {(x=x+1).asString++" kws"});
1292
1293
1294         //number of KW(King Wen) sequences in a timewave half-cycle (or amplitude x2) upon starting value
1295
1296         case
1297         {~gsinenum == nil}{~menu2start = ~menu2values.at(~synthdefnum-1)}
1298         {~gsinenum == 1}{~menu2start = ~menu2values.at(0)}
1299         {~gsinenum == 2}{~menu2start = ~menu2values.at(1)}
1300         {~gsinenum == 3}{~menu2start = ~menu2values.at(2)}
1301         {~gsinenum == 4}{~menu2start = ~menu2values.at(3)}
1302         {~gsinenum == 5}{~menu2start = ~menu2values.at(4)}
1303         {~gsinenum == 6}{~menu2start = ~menu2values.at(5)}
1304         {~gsinenum == 7}{~menu2start = ~menu2values.at(6)}
1305         {~gsinenum == 8}{~menu2start = ~menu2values.at(7)}
1306         {~gsinenum == 9}{~menu2start = ~menu2values.at(8)}
1307         {~gsinenum == 10}{~menu2start = ~menu2values.at(9)}
1308         {~gsinenum == 11}{~menu2start = ~menu2values.at(10)}
1309         {~gsinenum == 12}{~menu2start = ~menu2values.at(11)}
1310         {~gsinenum == 13}{~menu2start = ~menu2values.at(12)}
1311         {~gsinenum == 14}{~menu2start = ~menu2values.at(13)}
1312         {~gsinenum == 15}{~menu2start = ~menu2values.at(14)}
1313         {~gsinenum == 16}{~menu2start = ~menu2values.at(15)}
1314         {~gsinenum == 17}{~menu2start = ~menu2values.at(16)}
1315         {~gsinenum == 18}{~menu2start = ~menu2values.at(17)}
1316         {~gsinenum == 19}{~menu2start = ~menu2values.at(18)}
1317         {~gsinenum == 20}{~menu2start = ~menu2values.at(19)}
1318         {~gsinenum == 21}{~menu2start = ~menu2values.at(20)}
1319         {~gsinenum == 22}{~menu2start = ~menu2values.at(21)}
1320         {~gsinenum == 23}{~menu2start = ~menu2values.at(22)}
1321         {~gsinenum == 24}{~menu2start = ~menu2values.at(23)};
1322         if(~menu2synthdefstart.value == nil, {~menu2synthdefstart = ~synthdefnum}, {~menu2synthdefstart = ~gsinenum});
1323
1324         if(~low_pass_filter_set_value == nil, {~low_pass_filter_set_value = ~low_pass_filter_freq_limit});
1325         if(~low_pass_filter_set_value != ~low_pass_filter_freq_limit, {~low_pass_filter_set_value = ~low_pass_filter_freq_limit});
1326
1327
1328         //settings function
1329
1330         ~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;
1331
1332                 if(button.value == 1, {
1333
1334                         ({
1335                                 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;
1336                                 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;
1337                                 ~settingsview = View(w, Rect(20+60*2+15+25,Window.screenBounds.height-340,340,340/1.6180339887499)).front;
1338                                 /*w.view.decorator=FlowLayout(w.view.bounds);
1339                                 w.view.decorator.gap=2@2;*/
1340
1341                                 top = 0;
1342
1343                                 t1 = StaticText(~settingsview, Rect(lefttime , top=top, width, height)).background_(Color.black).string_("KWS number").stringColor_(Color.white);
1344                                 t2 = StaticText(~settingsview, Rect(lefttime , top=top+height+5, width, height)).background_(Color.black).string_("base(lowest) freq(hz)").stringColor_(Color.white);
1345                                 t3 = StaticText(~settingsview, Rect(lefttime , top=top+height+5, width, height)).background_(Color.black).string_("synthdef type").stringColor_(Color.white);
1346                                 t4 = StaticText(~settingsview, Rect(lefttime , top=top+height+5, width, height)).background_(Color.black).string_("lp filter limit(hz)").stringColor_(Color.white);
1347                                 t5 = StaticText(~settingsview, Rect(lefttime , top=top+height+5, width, height)).background_(Color.black).string_("automate").stringColor_(Color.white);
1348
1349
1350                                 top = 0;
1351
1352
1353                                 //number of KW(King Wen) sequences in a timewave half-cycle (or amplitude x2) pop-up menu
1354
1355                                 ~menu2 = PopUpMenu(~settingsview,Rect(lefttimebox , top=top, widthbox, heightbox)).items_(~mvalue = (-1); [~menu2start.asString]++Array.fill(24, {~menu2values.at(~mvalue = ~mvalue+1);});).background_(Color.black).stringColor_(Color.white).action_({arg button;
1356
1357                                         if(~st != nil, {~st.close});
1358                                         ~st = StaticText(~settingsview, Rect(lefttime, top, 200, 20)).background_(Color.black);
1359                                         ~st.stringColor = Color.white;
1360                                         ~st.string = "# of kws in halfcycle selected";
1361                                         AppClock.sched(~gm,{~st.close;});
1362                                 });
1363
1364
1365                                 //pop-menu for timewave base (lowest) frequency
1366
1367                                 ~bfreqstart = ~basefreq;
1368                                 ~bfreq = PopUpMenu(~settingsview, Rect(lefttimebox , top=top+heightbox+5, widthbox, heightbox)).items_(~bfreqv = (-1); [~basefreq.asString]++Array.fill(140, {~basefreqmap.at(~bfreqv=~bfreqv+1).asString})).background_(Color.black).stringColor_(Color.white).action_({arg button;
1369
1370                                         if(~st != nil, {~st.close});
1371                                         ~st = StaticText(~settingsview, Rect(lefttime, top, 200, 20)).background_(Color.black);
1372                                         ~st.stringColor = Color.white;
1373                                         ~st.string = "basefreq selected";
1374                                         AppClock.sched(~gm,{~st.close;});
1375                                 });
1376
1377
1378                                 //synthdef pop-up menu
1379
1380                                 ~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;
1381
1382                                         if(~gsinemenu.value == 0,  {~kws_setting = 1; ~ratio_setting = "psine1"; ~low_pass_filter_on = 1; ~gs = 0;});
1383                                         if(~gsinemenu.value == 1,  {~kws_setting = 2; ~ratio_setting = "psine2"; ~low_pass_filter_on = 1; ~gs = 1;});
1384                                         if(~gsinemenu.value == 2,  {~kws_setting = 3; ~ratio_setting = "psine3"; ~low_pass_filter_on = 1; ~gs = 2;});
1385                                         if(~gsinemenu.value == 3,  {~kws_setting = 1; ~ratio_setting = "hsine1"; ~low_pass_filter_on = 1; ~gs = 3;});
1386                                         if(~gsinemenu.value == 4,  {~kws_setting = 2; ~ratio_setting = "hsine2"; ~low_pass_filter_on = 1; ~gs = 4;});
1387                                         if(~gsinemenu.value == 5,  {~kws_setting = 3; ~ratio_setting = "hsine3"; ~low_pass_filter_on = 1; ~gs = 5;});
1388                                         if(~gsinemenu.value == 6,  {~kws_setting = 1; ~ratio_setting = "psine1"; ~low_pass_filter_on = 0; ~gs = 6;});
1389                                         if(~gsinemenu.value == 7,  {~kws_setting = 2; ~ratio_setting = "psine2"; ~low_pass_filter_on = 0; ~gs = 7;});
1390                                         if(~gsinemenu.value == 8,  {~kws_setting = 3; ~ratio_setting = "psine3"; ~low_pass_filter_on = 0; ~gs = 8;});
1391                                         if(~gsinemenu.value == 9,  {~kws_setting = 1; ~ratio_setting = "hsine1"; ~low_pass_filter_on = 0; ~gs = 9;});
1392                                         if(~gsinemenu.value == 10, {~kws_setting = 2; ~ratio_setting = "hsine2"; ~low_pass_filter_on = 0; ~gs = 10;});
1393                                         if(~gsinemenu.value == 11, {~kws_setting = 3; ~ratio_setting = "hsine3"; ~low_pass_filter_on = 0; ~gs = 11;});
1394
1395                                         if(~st != nil, {~st.close});
1396                                         ~st = StaticText(~settingsview, Rect(lefttime, top, 200, 20)).background_(Color.black);
1397                                         ~st.stringColor = Color.white;
1398                                         ~st.string = "synthdef setting selected";
1399                                         AppClock.sched(~gm,{~st.close;});
1400                                 });
1401
1402                                 if(~gs == nil, {~gs = 0;});
1403
1404                                 case
1405                                 {~gs == 0}{~gsinemenu.value = 0;}
1406                                 {~gs == 1}{~gsinemenu.value = 1;}
1407                                 {~gs == 2}{~gsinemenu.value = 2;}
1408                                 {~gs == 3}{~gsinemenu.value = 3;}
1409                                 {~gs == 4}{~gsinemenu.value = 4;}
1410                                 {~gs == 5}{~gsinemenu.value = 5;}
1411                                 {~gs == 0}{~gsinemenu.value = 6;}
1412                                 {~gs == 1}{~gsinemenu.value = 7;}
1413                                 {~gs == 2}{~gsinemenu.value = 8;}
1414                                 {~gs == 3}{~gsinemenu.value = 9;}
1415                                 {~gs == 4}{~gsinemenu.value = 10;}
1416                                 {~gs == 5}{~gsinemenu.value = 11;};
1417
1418
1419                                 //set low-pass filter frequency limit
1420
1421                                 ~low_pass_filter_textfield = TextField(~settingsview, Rect(lefttimebox , top=top+heightbox+5, widthbox, heightbox));
1422                                 ~low_pass_filter_textfield.string = ~low_pass_filter_set_value.asString;
1423                                 ~low_pass_filter_textfield.background_(Color.black);
1424                                 ~low_pass_filter_textfield.stringColor_(Color.white);
1425                                 ~low_pass_filter_textfield.action = {arg value; ~freqsetvalue = value.value;
1426
1427                                         ~freqset_textfield_func.value; //this function is found after line 2900
1428
1429                                         ~low_pass_filter_set_value = ~freqsetvalue.value;
1430
1431                                         ~low_pass_filter_textfield.string = ~low_pass_filter_set_value.asString;
1432
1433                                         if(~low_pass_filter_set_value != 0, {
1434                                                 if(~st != nil, {~st.close});
1435                                                 ~st = StaticText(~settingsview, Rect(lefttime, top, 240, 20)).background_(Color.black);
1436                                                 ~st.stringColor = Color.white;
1437                                                 ~st.string = "low-pass filter freq limit selected";
1438                                                 AppClock.sched(~gm,{~st.close;});
1439                                         }, {~low_pass_filter_set_value = ~low_pass_filter_freq_limit; ~low_pass_filter_textfield.string = ~low_pass_filter_set_value.asString;});
1440                                 };
1441
1442
1443                                 //switch to sendreply functions
1444
1445                                 ~sendreplymenu = PopUpMenu(~settingsview,Rect(lefttimebox , top=top+heightbox+5, widthbox, heightbox)).items_(["off","western scale","eastern scale"]).background_(Color.black).stringColor_(Color.white).action_({arg button;
1446
1447                                         case
1448                                         {button.value == 0;}{~sendreplymenu_value = 0;}
1449                                         {button.value == 1;}{~sendreplymenu_value = 1;}
1450                                         {button.value == 2;}{~sendreplymenu_value = 2;};
1451
1452                                         if(~st != nil, {~st.close});
1453                                         ~st = StaticText(~settingsview, Rect(lefttime, top, 200, 20)).background_(Color.black);
1454                                         ~st.stringColor = Color.white;
1455                                         ~st.string = "automate setting selected";
1456                                         AppClock.sched(~gm,{~st.close;});
1457                                 });
1458
1459                                 if(~sendreplymenu_value == nil, {~sendreplymenu_value = 0;});
1460
1461                                 case
1462                                 {~sendreplymenu_value == 0}{~sendreplymenu.value = 0;}
1463                                 {~sendreplymenu_value == 1}{~sendreplymenu.value = 1;}
1464                                 {~sendreplymenu_value == 2}{~sendreplymenu.value = 2;};
1465
1466
1467                                 //set button for all settings
1468
1469                                 ~set1=Button(~settingsview,Rect(lefttimebox+widthbox-60, top=top+height+20, 60, 60/~gm)).states_([["set",Color.white,Color.black]]).mouseDownAction_({
1470
1471                                         if(~bfreq.value > 0, {~basefreq = ~basefreqmap.at(~bfreq.value - 1)}, {~basefreq = ~bfreqstart});
1472
1473                                         (#a,b,c,d,e,f = [ ~basefreq,~basefreq,~basefreq,~basefreq,~basefreq,~basefreq  ]; ~a = a; ~b = b; ~c =c; ~d = d; ~e = e;~f=f;);
1474
1475                                         ~low_pass_filter_freq_limit = ~low_pass_filter_set_value;
1476
1477
1478                                         //set n1-n9 values
1479
1480                                         case
1481                                         {~ratio_setting == "psine1";}{~n_value1 = ~gm;    ~n_value2 = ~gm2;   ~n_value6 = ~gm6;}
1482                                         {~ratio_setting == "psine2";}{~n_value1 = ~ngm1;  ~n_value2 = ~ngm2;  ~n_value6 = ~ngm6;}
1483                                         {~ratio_setting == "psine3";}{~n_value1 = ~nngm1; ~n_value2 = ~nngm2; ~n_value6 = ~nngm6;}
1484                                         {~ratio_setting == "hsine1";}{~n_value1 = ~h1;    ~n_value2 = ~h2;    ~n_value6 = ~h6;}
1485                                         {~ratio_setting == "hsine2";}{~n_value1 = ~nh1;   ~n_value2 = ~nh2;   ~n_value6 = ~nh6;}
1486                                         {~ratio_setting == "hsine3";}{~n_value1 = ~nnh1;  ~n_value2 = ~nnh2;  ~n_value6 = ~nnh6;};
1487
1488
1489                                         //sendyreply values
1490
1491                                         case
1492                                         {~sendreplymenu.value ==  0}{~sendreplysynthdef_on = 0;}
1493                                         {~sendreplymenu.value ==  1}{~sendreplysynthdef_on = 1; ~send_reply_func = ~send_reply_func_western; ~sendreplyfuncswitch = 1;}
1494                                         {~sendreplymenu.value ==  2}{~sendreplysynthdef_on = 1; ~send_reply_func = ~send_reply_func_eastern; ~sendreplyfuncswitch = 2;};
1495
1496
1497                                         //evaluate synthdefs(gsine)
1498
1499                                         case
1500                                         {~menu2.value == 0}{~gsinenum = ~menu2synthdefstart; ~gsine.value;}
1501                                         {~menu2.value == 1}{~gsinenum = 1; ~gsine.value;}
1502                                         {~menu2.value == 2}{~gsinenum = 2; ~gsine.value;}
1503                                         {~menu2.value == 3}{~gsinenum = 3; ~gsine.value;}
1504                                         {~menu2.value == 4}{~gsinenum = 4; ~gsine.value;}
1505                                         {~menu2.value == 5}{~gsinenum = 5; ~gsine.value;}
1506                                         {~menu2.value == 6}{~gsinenum = 6; ~gsine.value;}
1507                                         {~menu2.value == 7}{~gsinenum = 7; ~gsine.value;}
1508                                         {~menu2.value == 8}{~gsinenum = 8; ~gsine.value;}
1509                                         {~menu2.value == 9}{~gsinenum = 9; ~gsine.value;}
1510                                         {~menu2.value == 10}{~gsinenum = 10; ~gsine.value;}
1511                                         {~menu2.value == 11}{~gsinenum = 11; ~gsine.value;}
1512                                         {~menu2.value == 12}{~gsinenum = 12; ~gsine.value;}
1513                                         {~menu2.value == 13}{~gsinenum = 13; ~gsine.value;}
1514                                         {~menu2.value == 14}{~gsinenum = 14; ~gsine.value;}
1515                                         {~menu2.value == 15}{~gsinenum = 15; ~gsine.value;}
1516                                         {~menu2.value == 16}{~gsinenum = 16; ~gsine.value;}
1517                                         {~menu2.value == 17}{~gsinenum = 17; ~gsine.value;}
1518                                         {~menu2.value == 18}{~gsinenum = 18; ~gsine.value;}
1519                                         {~menu2.value == 19}{~gsinenum = 19; ~gsine.value;}
1520                                         {~menu2.value == 20}{~gsinenum = 20; ~gsine.value;}
1521                                         {~menu2.value == 21}{~gsinenum = 21; ~gsine.value;}
1522                                         {~menu2.value == 22}{~gsinenum = 22; ~gsine.value;}
1523                                         {~menu2.value == 23}{~gsinenum = 23; ~gsine.value;}
1524                                         {~menu2.value == 24}{~gsinenum = 24; ~gsine.value;};
1525
1526                                         ~st_load = StaticText(~settingsview, Rect(lefttime, top, 200, 20)).background_(Color.black);
1527                                         ~st_load.stringColor = Color.white;
1528                                         ~st_load.string = "loaded.";
1529                                         AppClock.sched(~gm,{if(~st != nil, {~st.close}); ~st_load.close;});
1530
1531                                 });
1532
1533                                 ~settingsview.background_(Color.black);
1534
1535                                 /*~closessettingsbutton = Button.new(~settingsview,Rect(lefttimebox+widthbox-40, top, 40, 40/~gm)).states_([["close",Color.white,Color.black]]).action_({arg button;
1536
1537                                 ~settingsview.close; ~settingsbutton.value = 0;
1538                                 });*/
1539
1540
1541                         }.value);
1542
1543                         ~settingsview.front;
1544                 }, {~settingsview.close});
1545         });
1546
1547
1548         //open/flow/slide buttons coordinate values
1549
1550         ~bph = 26;
1551         ~bpw = 26/1.6180339887499;
1552         ~bpl = Window.screenBounds.width-(~bph*8)-20;
1553         ~bpt = Window.screenBounds.height-88;
1554
1555         ~bp01l = ~bpl;
1556         ~bp02l = ~bpl+(~bph*1);
1557         ~bp03l = ~bpl+(~bph*2);
1558         ~bp04l = ~bpl+(~bph*3);
1559         ~bp05l = ~bpl+(~bph*4);
1560         ~bp06l = ~bpl+(~bph*5);
1561         ~bp07l = ~bpl+(~bph*6);
1562         ~bp08l = ~bpl+(~bph*7);
1563         ~bpf1l = ~bpl;
1564         ~bpf2l = ~bpl+(~bph*1);
1565         ~bpf3l = ~bpl+(~bph*2);
1566         ~bpf4l = ~bpl+(~bph*3);
1567         ~bpf5l = ~bpl+(~bph*4);
1568         ~bpf6l = ~bpl+(~bph*5);
1569         ~bpf7l = ~bpl+(~bph*6);
1570         ~bpf8l = ~bpl+(~bph*7);
1571
1572         ~bp01t = ~bpt;
1573         ~bp02t = ~bpt;
1574         ~bp03t = ~bpt;
1575         ~bp04t = ~bpt;
1576         ~bp05t = ~bpt;
1577         ~bp06t = ~bpt;
1578         ~bp07t = ~bpt;
1579         ~bp08t = ~bpt;
1580         ~bpf1t = ~bpt+~bpw;
1581         ~bpf2t = ~bpt+~bpw;
1582         ~bpf3t = ~bpt+~bpw;
1583         ~bpf4t = ~bpt+~bpw;
1584         ~bpf5t = ~bpt+~bpw;
1585         ~bpf6t = ~bpt+~bpw;
1586         ~bpf7t = ~bpt+~bpw;
1587         ~bpf8t = ~bpt+~bpw;
1588
1589         ~bp01h = ~bph;
1590         ~bp02h = ~bph;
1591         ~bp03h = ~bph;
1592         ~bp04h = ~bph;
1593         ~bp05h = ~bph;
1594         ~bp06h = ~bph;
1595         ~bp07h = ~bph;
1596         ~bp08h = ~bph;
1597         ~bpf1h = ~bph;
1598         ~bpf2h = ~bph;
1599         ~bpf3h = ~bph;
1600         ~bpf4h = ~bph;
1601         ~bpf5h = ~bph;
1602         ~bpf6h = ~bph;
1603         ~bpf7h = ~bph;
1604         ~bpf8h = ~bph;
1605
1606         ~bp01w = ~bpw;
1607         ~bp02w = ~bpw;
1608         ~bp03w = ~bpw;
1609         ~bp04w = ~bpw;
1610         ~bp05w = ~bpw;
1611         ~bp06w = ~bpw;
1612         ~bp07w = ~bpw;
1613         ~bp08w = ~bpw;
1614         ~bpf1w = ~bpw;
1615         ~bpf2w = ~bpw;
1616         ~bpf3w = ~bpw;
1617         ~bpf4w = ~bpw;
1618         ~bpf5w = ~bpw;
1619         ~bpf6w = ~bpw;
1620         ~bpf7w = ~bpw;
1621         ~bpf8w = ~bpw;
1622
1623         ~tspw=280+210;
1624         ~tsph=280+210/~gm;
1625         ~tspl=Window.screenBounds.width-~tspw;
1626         ~tspt=~bpt-310;
1627
1628
1629         //synthopen 1-8 buttons
1630
1631         ~bplaceo1 = Button.new(w,Rect(~bp01l,~bp01t,~bp01h,~bp01w)).states_([["o1",Color.white,Color.black]]).action_({arg button; button.value.postln}).action_({arg button;
1632
1633                 [~f1=~fp1,~f2=~fp2,~f3=~fp3];
1634
1635                 ~synthopen.value;
1636                 ~currentsynth = "o1"; ~synthmonitorfunc.value;
1637
1638                 if(~ts.value == 1,
1639                         {if(~tst == nil, {nil}, {~tst.close;});
1640                                 ~timevals.value;
1641                                 ~timer.stop; ~systemclock.stop; ~systemclock.clear; ~time1o = 0;
1642                                 ~timer = Routine({inf.do({
1643                                         ~time1o =
1644                                         ~time1o+0.01; ~slot = "o1_"+~time1o.asString; 0.01.wait;});}); ~systemclock = SystemClock.play(~timer);},
1645                         {nil});
1646         });
1647
1648         ~bplaceo2 = Button.new(w,Rect(~bp02l,~bp02t,~bp02h,~bp02w)).states_([["o2",Color.white,Color.black]]).action_({arg button; button.value.postln}).action_({arg button;
1649
1650                 [~f1=~fp1b,~f2=~fp2b,~f3=~fp3b];
1651
1652                 ~synthopen.value;
1653                 ~currentsynth = "o2"; ~synthmonitorfunc.value;
1654
1655                 if(~ts.value == 1,
1656                         {if(~tst == nil, {nil}, {~tst.close;});
1657                                 ~timevals.value;
1658                                 ~timer.stop; ~systemclock.stop; ~systemclock.clear; ~time2o = 0;
1659                                 ~timer = Routine({inf.do({
1660                                         ~time2o =
1661                                         ~time2o+0.01; ~slot = "o2_"+~time2o.asString; 0.01.wait;});}); ~systemclock = SystemClock.play(~timer);},
1662                         {nil});
1663         });
1664         ~bplaceo3 = Button.new(w,Rect(~bp03l,~bp03t,~bp03h,~bp03w)).states_([["o3",Color.white,Color.black]]).action_({arg button; button.value.postln}).action_({arg button;
1665
1666                 [~f1=~fp1c,~f2=~fp2c,~f3=~fp3c];
1667
1668                 ~synthopen.value;
1669                 ~currentsynth = "o3"; ~synthmonitorfunc.value;
1670
1671                 if(~ts.value == 1,
1672                         {if(~tst == nil, {nil}, {~tst.close;});
1673                                 ~timevals.value;
1674                                 ~timer.stop; ~systemclock.stop; ~systemclock.clear; ~time3o = 0;
1675                                 ~timer = Routine({inf.do({
1676                                         ~time3o =
1677                                         ~time3o+0.01; ~slot = "o3_"+~time3o.asString; 0.01.wait;});}); ~systemclock = SystemClock.play(~timer);},
1678                         {nil});
1679         });
1680         ~bplaceo4 = Button.new(w,Rect(~bp04l,~bp04t,~bp04h,~bp04w)).states_([["o4",Color.white,Color.black]]).action_({arg button; button.value.postln}).action_({arg button;
1681
1682                 [~f1=~fp1d,~f2=~fp2d,~f3=~fp3d];
1683
1684                 ~synthopen.value;
1685                 ~currentsynth = "o4"; ~synthmonitorfunc.value;
1686
1687                 if(~ts.value == 1,
1688                         {if(~tst == nil, {nil}, {~tst.close;});
1689                                 ~timevals.value;
1690                                 ~timer.stop; ~systemclock.stop; ~systemclock.clear; ~time4o = 0;
1691                                 ~timer = Routine({inf.do({
1692                                         ~time4o =
1693                                         ~time4o+0.01; ~slot = "o4_"+~time4o.asString; 0.01.wait;});}); ~systemclock = SystemClock.play(~timer);},
1694                         {nil});
1695
1696         });
1697
1698         ~bplaceo5 = Button.new(w,Rect(~bp05l,~bp05t,~bp05h,~bp05w)).states_([["o5",Color.white,Color.black]]).action_({arg button; button.value.postln}).action_({arg button;
1699
1700                 [~f1=~fp1e,~f2=~fp2e,~f3=~fp3e];
1701
1702                 ~synthopen.value;
1703                 ~currentsynth = "o5"; ~synthmonitorfunc.value;
1704
1705                 if(~ts.value == 1,
1706                         {if(~tst == nil, {nil}, {~tst.close;});
1707                                 ~timevals.value;
1708                                 ~timer.stop; ~systemclock.stop; ~systemclock.clear; ~time5o = 0;
1709                                 ~timer = Routine({inf.do({
1710                                         ~time5o =
1711                                         ~time5o+0.01; ~slot = "o5_"+~time5o.asString; 0.01.wait;});}); ~systemclock = SystemClock.play(~timer);},
1712                         {nil});
1713
1714         });
1715         ~bplaceo6 = Button.new(w,Rect(~bp06l,~bp06t,~bp06h,~bp06w)).states_([["o6",Color.white,Color.black]]).action_({arg button; button.value.postln}).action_({arg button;
1716
1717                 [~f1=~fp1f,~f2=~fp2f,~f3=~fp3f];
1718
1719                 ~synthopen.value;
1720                 ~currentsynth = "o6"; ~synthmonitorfunc.value;
1721
1722                 if(~ts.value == 1,
1723                         {if(~tst == nil, {nil}, {~tst.close;});
1724                                 ~timevals.value;
1725                                 ~timer.stop; ~systemclock.stop; ~systemclock.clear; ~time6o = 0;
1726                                 ~timer = Routine({inf.do({
1727                                         ~time6o =
1728                                         ~time6o+0.01; ~slot = "o6_"+~time6o.asString; 0.01.wait;});}); ~systemclock = SystemClock.play(~timer);},
1729                         {nil});
1730         });
1731         ~bplaceo7 = Button.new(w,Rect(~bp07l,~bp07t,~bp07h,~bp07w)).states_([["o7",Color.white,Color.black]]).action_({arg button; button.value.postln}).action_({arg button;
1732
1733                 [~f1=~fp1g,~f2=~fp2g,~f3=~fp3g];
1734
1735                 ~synthopen.value;
1736                 ~currentsynth = "o7"; ~synthmonitorfunc.value;
1737
1738                 if(~ts.value == 1,
1739                         {if(~tst == nil, {nil}, {~tst.close;});
1740                                 ~timevals.value;
1741                                 ~timer.stop; ~systemclock.stop; ~systemclock.clear; ~time7o = 0;
1742                                 ~timer = Routine({inf.do({
1743                                         ~time7o =
1744                                         ~time7o+0.01; ~slot = "o7_"+~time7o.asString; 0.01.wait;});}); ~systemclock = SystemClock.play(~timer);},
1745                         {nil});
1746         });
1747         ~bplaceo8 = Button.new(w,Rect(~bp08l,~bp08t,~bp08h,~bp08w)).states_([["o8",Color.white,Color.black]]).action_({arg button; button.value.postln}).action_({arg button;
1748
1749                 [~f1=~fp1h,~f2=~fp2h,~f3=~fp3h];
1750
1751                 ~synthopen.value;
1752                 ~currentsynth = "o8"; ~synthmonitorfunc.value;
1753
1754                 if(~ts.value == 1,
1755                         {if(~tst == nil, {nil}, {~tst.close;});
1756                                 ~timevals.value;
1757                                 ~timer.stop; ~systemclock.stop; ~systemclock.clear; ~time8o = 0;
1758                                 ~timer = Routine({inf.do({
1759                                         ~time8o =
1760                                         ~time8o+0.01; ~slot = "o8_"+~time8o.asString; 0.01.wait;});}); ~systemclock = SystemClock.play(~timer);},
1761                         {nil});
1762         });
1763
1764
1765         //synthflow 1-8 buttons
1766
1767         ~bplacef1 = Button.new(w,Rect(~bpf1l,~bpf1t,~bpf1h,~bpf1w)).states_([["f1",Color.white,Color.black]]).action_({arg button; button.value.postln}).action_({arg button;
1768
1769                 [~f1=~fp1,~f2=~fp2,~f3=~fp3];
1770
1771                 ~synthflow.value;
1772                 ~currentsynth = "f1"; ~synthmonitorfunc.value;
1773
1774                 if(~ts.value == 1,
1775                         {if(~tst == nil, {nil}, {~tst.close;});
1776                                 ~timevals.value;
1777                                 ~timer.stop; ~systemclock.stop; ~systemclock.clear; ~time1f = 0;
1778                                 ~timer = Routine({inf.do({
1779                                         ~time1f =
1780                                         ~time1f+0.01; ~slot = "f1_"+~time1f.asString; 0.01.wait;});}); ~systemclock = SystemClock.play(~timer);},
1781                         {nil});
1782         });
1783         ~bplacef2 = Button.new(w,Rect(~bpf2l,~bpf2t,~bpf2h,~bpf2w)).states_([["f2",Color.white,Color.black]]).action_({arg button; button.value.postln}).action_({arg button;
1784
1785                 [~f1=~fp1b,~f2=~fp2b,~f3=~fp3b];
1786
1787                 ~synthflow.value;
1788                 ~currentsynth = "f2"; ~synthmonitorfunc.value;
1789
1790                 if(~ts.value == 1,
1791                         {if(~tst == nil, {nil}, {~tst.close;});
1792                                 ~timevals.value;
1793                                 ~timer.stop; ~systemclock.stop; ~systemclock.clear; ~time2f = 0;
1794                                 ~timer = Routine({inf.do({
1795                                         ~time2f =
1796                                         ~time2f+0.01; ~slot = "f2_"+~time2f.asString; 0.01.wait;});}); ~systemclock = SystemClock.play(~timer);},
1797                         {nil});
1798         });
1799
1800         ~bplacef3 = Button.new(w,Rect(~bpf3l,~bpf3t,~bpf3h,~bpf3w)).states_([["f3",Color.white,Color.black]]).action_({arg button; button.value.postln}).action_({arg button;
1801
1802                 [~f1=~fp1c,~f2=~fp2c,~f3=~fp3c];
1803
1804                 ~synthflow.value;
1805                 ~currentsynth = "f3"; ~synthmonitorfunc.value;
1806
1807                 if(~ts.value == 1,
1808                         {if(~tst == nil, {nil}, {~tst.close;});
1809                                 ~timevals.value;
1810                                 ~timer.stop; ~systemclock.stop; ~systemclock.clear; ~time3f = 0;
1811                                 ~timer = Routine({inf.do({
1812                                         ~time3f =
1813                                         ~time3f+0.01; ~slot = "f3_"+~time3f.asString; 0.01.wait;});}); ~systemclock = SystemClock.play(~timer);},
1814                         {nil});
1815         });
1816         ~bplacef4 = Button.new(w,Rect(~bpf4l,~bpf4t,~bpf4h,~bpf4w)).states_([["f4",Color.white,Color.black]]).action_({arg button; button.value.postln}).action_({arg button;
1817
1818                 [~f1=~fp1d,~f2=~fp2d,~f3=~fp3d];
1819
1820                 ~synthflow.value;
1821                 ~currentsynth = "f4"; ~synthmonitorfunc.value;
1822
1823                 if(~ts.value == 1,
1824                         {if(~tst == nil, {nil}, {~tst.close;});
1825                                 ~timevals.value;
1826                                 ~timer.stop; ~systemclock.stop; ~systemclock.clear; ~time4f = 0;
1827                                 ~timer = Routine({inf.do({
1828                                         ~time4f =
1829                                         ~time4f+0.01; ~slot = "f4_"+~time4f.asString; 0.01.wait;});}); ~systemclock = SystemClock.play(~timer);},
1830                         {nil});
1831         });
1832
1833         ~bplacef5 = Button.new(w,Rect(~bpf5l,~bpf5t,~bpf5h,~bpf5w)).states_([["f5",Color.white,Color.black]]).action_({arg button; button.value.postln}).action_({arg button;
1834
1835                 [~f1=~fp1e,~f2=~fp2e,~f3=~fp3e];
1836
1837                 ~synthflow.value;
1838                 ~currentsynth = "f5"; ~synthmonitorfunc.value;
1839
1840                 if(~ts.value == 1,
1841                         {if(~tst == nil, {nil}, {~tst.close;});
1842                                 ~timevals.value;
1843                                 ~timer.stop; ~systemclock.stop; ~systemclock.clear; ~time5f = 0;
1844                                 ~timer = Routine({inf.do({
1845                                         ~time5f =
1846                                         ~time5f+0.01; ~slot = "f5_"+~time5f.asString; 0.01.wait;});}); ~systemclock = SystemClock.play(~timer);},
1847                         {nil});
1848         });
1849
1850         ~bplacef6 = Button.new(w,Rect(~bpf6l,~bpf6t,~bpf6h,~bpf6w)).states_([["f6",Color.white,Color.black]]).action_({arg button; button.value.postln}).action_({arg button;
1851
1852                 [~f1=~fp1f,~f2=~fp2f,~f3=~fp3f];
1853
1854                 ~synthflow.value;
1855                 ~currentsynth = "f6"; ~synthmonitorfunc.value;
1856
1857                 if(~ts.value == 1,
1858                         {if(~tst == nil, {nil}, {~tst.close;});
1859                                 ~timevals.value;
1860                                 ~timer.stop; ~systemclock.stop; ~systemclock.clear; ~time6f = 0;
1861                                 ~timer = Routine({inf.do({
1862                                         ~time6f =
1863                                         ~time6f+0.01; ~slot = "f6_"+~time6f.asString; 0.01.wait;});}); ~systemclock = SystemClock.play(~timer);},
1864                         {nil});
1865         });
1866
1867
1868         ~bplacef7 = Button.new(w,Rect(~bpf7l,~bpf7t,~bpf7h,~bpf7w)).states_([["f7",Color.white,Color.black]]).action_({arg button; button.value.postln}).action_({arg button;
1869
1870                 [~f1=~fp1g,~f2=~fp2g,~f3=~fp3g];
1871
1872                 ~synthflow.value;
1873                 ~currentsynth = "f7"; ~synthmonitorfunc.value;
1874
1875                 if(~ts.value == 1,
1876                         {if(~tst == nil, {nil}, {~tst.close;});
1877                                 ~timevals.value;
1878                                 ~timer.stop; ~systemclock.stop; ~systemclock.clear; ~time7f = 0;
1879                                 ~timer = Routine({inf.do({
1880                                         ~time7f =
1881                                         ~time7f+0.01; ~slot = "f7_"+~time7f.asString; 0.01.wait;});}); ~systemclock = SystemClock.play(~timer);},
1882                         {nil});
1883         });
1884         ~bplacef8 = Button.new(w,Rect(~bpf8l,~bpf8t,~bpf8h,~bpf8w)).states_([["f8",Color.white,Color.black]]).action_({arg button; button.value.postln}).action_({arg button;
1885
1886                 [~f1=~fp1h,~f2=~fp2h,~f3=~fp3h];
1887
1888                 ~synthflow.value;
1889                 ~currentsynth = "f8"; ~synthmonitorfunc.value;
1890
1891                 if(~ts.value == 1,
1892                         {if(~tst == nil, {nil}, {~tst.close;});
1893                                 ~timevals.value;
1894                                 ~timer.stop; ~systemclock.stop; ~systemclock.clear; ~time8f = 0;
1895                                 ~timer = Routine({inf.do({
1896                                         ~time8f =
1897                                         ~time8f+0.01; ~slot = "f8_"+~time8f.asString; 0.01.wait;});}); ~systemclock = SystemClock.play(~timer);},
1898                         {nil});
1899         });
1900
1901
1902         //synthslide 1-8 buttons
1903
1904         ~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;
1905
1906                 if(~slidetime1 == nil, {~slidetime1 = 4}); if(~slidedo1 == nil, {~slidedo1 = 2000;}); ~slidecount = ~slidedo1;
1907                 #g,h,i = (([ ~f1,~f2,~f3 ]-
1908                         [ ~fp1,~fp2,~fp3 ])*(-1)/~slidedo1);
1909
1910                 ~slidetime =~slidetime1; ~slidedo = ~slidedo1;
1911
1912                 ~slideroutine.stop;
1913
1914                 ~synthslide.value;
1915                 ~currentsynth = "s1"; ~synthmonitorfunc.value;
1916
1917                 if(~ts.value == 1,
1918                         {if(~tst == nil, {nil}, {~tst.close;});
1919                                 ~timevals.value;
1920                                 ~timer.stop; ~systemclock.stop; ~systemclock.clear; ~time1s = 0;
1921                                 ~timer = Routine({inf.do({
1922                                         ~time1s =
1923                                         ~time1s+0.01; ~slot = "s1_"+~time1s.asString; 0.01.wait;});}); ~systemclock = SystemClock.play(~timer);},
1924                         {nil});
1925
1926         });
1927         ~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;
1928
1929                 if(~slidetime2 == nil, {~slidetime2 = 4}); if(~slidedo2 == nil, {~slidedo2 = 2000;}); ~slidecount = ~slidedo2;
1930                 #g,h,i = (([ ~f1,~f2,~f3 ]-
1931                         [ ~fp1b,~fp2b,~fp3b ])*(-1)/~slidedo2);
1932
1933                 ~slidetime = ~slidetime2; ~slidedo = ~slidedo2;
1934
1935                 ~slideroutine.stop;
1936
1937                 ~synthslide.value;
1938                 ~currentsynth = "s2"; ~synthmonitorfunc.value;
1939
1940                 if(~ts.value == 1,
1941                         {if(~tst == nil, {nil}, {~tst.close;});
1942                                 ~timevals.value;
1943                                 ~timer.stop; ~systemclock.stop; ~systemclock.clear; ~time2s = 0;
1944                                 ~timer = Routine({inf.do({
1945                                         ~time2s =
1946                                         ~time2s+0.01; ~slot = "s2_"+~time2s.asString; 0.01.wait;});}); ~systemclock = SystemClock.play(~timer);},
1947                         {nil});
1948
1949         });
1950         ~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;
1951
1952                 if(~slidetime3 == nil, {~slidetime3 = 4}); if(~slidedo3 == nil, {~slidedo3 = 2000;}); ~slidecount = ~slidedo3;
1953                 #g,h,i = (([ ~f1,~f2,~f3 ]-
1954                         [ ~fp1c,~fp2c,~fp3c ])*(-1)/~slidedo3);
1955
1956                 ~slidetime = ~slidetime3; ~slidedo = ~slidedo3;
1957
1958                 ~slideroutine.stop;
1959
1960                 ~synthslide.value;
1961                 ~currentsynth = "s3"; ~synthmonitorfunc.value;
1962
1963                 if(~ts.value == 1,
1964                         {if(~tst == nil, {nil}, {~tst.close;});
1965                                 ~timevals.value;
1966                                 ~timer.stop; ~systemclock.stop; ~systemclock.clear; ~time3s = 0;
1967                                 ~timer = Routine({inf.do({
1968                                         ~time3s =
1969                                         ~time3s+0.01; ~slot = "s3_"+~time3s.asString; 0.01.wait;});}); ~systemclock = SystemClock.play(~timer);},
1970                         {nil});
1971
1972         });
1973         ~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;
1974
1975                 if(~slidetime4 == nil, {~slidetime4 = 4}); if(~slidedo4 == nil, {~slidedo4 = 2000;}); ~slidecount = ~slidedo4;
1976                 #g,h,i = (([ ~f1,~f2,~f3 ]-
1977                         [ ~fp1d,~fp2d,~fp3d ])*(-1)/~slidedo4);
1978
1979                 ~slidetime = ~slidetime4; ~slidedo = ~slidedo4;
1980
1981                 ~slideroutine.stop;
1982
1983                 ~synthslide.value;
1984                 ~currentsynth = "s4"; ~synthmonitorfunc.value;
1985
1986                 if(~ts.value == 1,
1987                         {if(~tst == nil, {nil}, {~tst.close;});
1988                                 ~timevals.value;
1989                                 ~timer.stop; ~systemclock.stop; ~systemclock.clear; ~time4s = 0;
1990                                 ~timer = Routine({inf.do({
1991                                         ~time4s =
1992                                         ~time4s+0.01; ~slot = "s4_"+~time4s.asString; 0.01.wait;});}); ~systemclock = SystemClock.play(~timer);},
1993                         {nil});
1994         });
1995         ~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;
1996
1997                 if(~slidetime5 == nil, {~slidetime5 = 4}); if(~slidedo5 == nil, {~slidedo5 = 2000;}); ~slidecount = ~slidedo5;
1998                 #g,h,i = (([ ~f1,~f2,~f3 ]-
1999                         [ ~fp1e,~fp2e,~fp3e ])*(-1)/~slidedo5);
2000
2001                 ~slidetime = ~slidetime5; ~slidedo = ~slidedo5;
2002
2003                 ~slideroutine.stop;
2004
2005                 ~synthslide.value;
2006                 ~currentsynth = "s5"; ~synthmonitorfunc.value;
2007
2008                 if(~ts.value == 1,
2009                         {if(~tst == nil, {nil}, {~tst.close;});
2010                                 ~timevals.value;
2011                                 ~timer.stop; ~systemclock.stop; ~systemclock.clear; ~time5s = 0;
2012                                 ~timer = Routine({inf.do({
2013                                         ~time5s =
2014                                         ~time5s+0.01; ~slot = "s5_"+~time5s.asString; 0.01.wait;});}); ~systemclock = SystemClock.play(~timer);},
2015                         {nil});
2016
2017         });
2018         ~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;
2019
2020                 if(~slidetime6 == nil, {~slidetime6 = 4}); if(~slidedo6 == nil, {~slidedo6 = 2000;}); ~slidecount = ~slidedo6;
2021                 #g,h,i = (([ ~f1,~f2,~f3 ]-
2022                         [ ~fp1f,~fp2f,~fp3f ])*(-1)/~slidedo6);
2023
2024                 ~slidetime = ~slidetime6; ~slidedo = ~slidedo6;
2025                 ~slideroutine.stop;
2026
2027                 ~synthslide.value;
2028                 ~currentsynth = "s6"; ~synthmonitorfunc.value;
2029
2030                 if(~ts.value == 1,
2031                         {if(~tst == nil, {nil}, {~tst.close;});
2032                                 ~timevals.value;
2033                                 ~timer.stop; ~systemclock.stop; ~systemclock.clear; ~time6s = 0;
2034                                 ~timer = Routine({inf.do({
2035                                         ~time6s =
2036                                         ~time6s+0.01; ~slot = "s6_"+~time6s.asString; 0.01.wait;});}); ~systemclock = SystemClock.play(~timer);},
2037                         {nil});
2038
2039         });
2040         ~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;
2041
2042                 if(~slidetime7 == nil, {~slidetime7 = 4}); if(~slidedo7 == nil, {~slidedo7 = 2000;}); ~slidecount = ~slidedo7;
2043                 #g,h,i = (([ ~f1,~f2,~f3 ]-
2044                         [ ~fp1g,~fp2g,~fp3g ])*(-1)/~slidedo7);
2045
2046                 ~slidetime = ~slidetime7; ~slidedo = ~slidedo7;
2047                 ~slideroutine.stop;
2048
2049                 ~synthslide.value;
2050                 ~currentsynth = "s7"; ~synthmonitorfunc.value;
2051
2052                 if(~ts.value == 1,
2053                         {if(~tst == nil, {nil}, {~tst.close;});
2054                                 ~timevals.value;
2055                                 ~timer.stop; ~systemclock.stop; ~systemclock.clear; ~time7s = 0;
2056                                 ~timer = Routine({inf.do({
2057                                         ~time7s =
2058                                         ~time7s+0.01; ~slot = "s7_"+~time7s.asString; 0.01.wait;});}); ~systemclock = SystemClock.play(~timer);},
2059                         {nil});
2060
2061         });
2062         ~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;
2063
2064                 if(~slidetime8 == nil, {~slidetime8 = 4}); if(~slidedo8 == nil, {~slidedo8 = 2000;}); ~slidecount = ~slidedo8;
2065                 #g,h,i = (([ ~f1,~f2,~f3 ]-
2066                         [ ~fp1h,~fp2h,~fp3h])*(-1)/~slidedo8);
2067
2068                 ~slidetime = ~slidetime8; ~slidedo = ~slidedo8;
2069
2070                 ~slideroutine.stop;
2071
2072                 ~synthslide.value;
2073                 ~currentsynth = "s8"; ~synthmonitorfunc.value;
2074
2075                 if(~ts.value == 1,
2076                         {if(~tst == nil, {nil}, {~tst.close;});
2077                                 ~timevals.value;
2078                                 ~timer.stop; ~systemclock.stop; ~systemclock.clear; ~time8s = 0;
2079                                 ~timer = Routine({inf.do({
2080                                         ~time8s =
2081                                         ~time8s+0.01; ~slot = "s8_"+~time8s.asString; 0.01.wait;});}); ~systemclock = SystemClock.play(~timer);},
2082                         {nil});
2083         });
2084
2085
2086         //if slidetime/slidedo is nil
2087
2088         if(~slidetimeall == nil, {~slidetimeall = 1});
2089         if(~slidetime1 == nil, {~slidetime1 = 1});
2090         if(~slidetime2 == nil, {~slidetime2 = 1});
2091         if(~slidetime3 == nil, {~slidetime3 = 1});
2092         if(~slidetime4 == nil, {~slidetime4 = 1});
2093         if(~slidetime5 == nil, {~slidetime5 = 1});
2094         if(~slidetime6 == nil, {~slidetime6 = 1});
2095         if(~slidetime7 == nil, {~slidetime7 = 1});
2096         if(~slidetime8 == nil, {~slidetime8 = 1});
2097
2098         if(~slidedoall == nil, {~slidedoall = 432});
2099         if(~slidedo1 == nil, {~slidedo1 = 432});
2100         if(~slidedo2 == nil, {~slidedo2 = 432});
2101         if(~slidedo3 == nil, {~slidedo3 = 432});
2102         if(~slidedo4 == nil, {~slidedo4 = 432});
2103         if(~slidedo5 == nil, {~slidedo5 = 432});
2104         if(~slidedo6 == nil, {~slidedo6 = 432});
2105         if(~slidedo7 == nil, {~slidedo7 = 432});
2106         if(~slidedo8 == nil, {~slidedo8 = 432});
2107
2108
2109         //frequency set function
2110
2111         ~freqset_textfield_func = {
2112                 ~freqsetvalue = ~freqsetvalue.asString;
2113                 ~freqsetvalue = ~freqsetvalue.separate;
2114                 ~freqsetvalue = ~freqsetvalue.reject{arg item;
2115                         (item != "1") and:
2116                         (item != "2") and:
2117                         (item != "3") and:
2118                         (item != "4") and:
2119                         (item != "5") and:
2120                         (item != "6") and:
2121                         (item != "7") and:
2122                         (item != "8") and:
2123                         (item != "9") and:
2124                         (item != "0") and:
2125                         (item != ".") and:
2126                         (item != "+") and:
2127                         (item != "-") and:
2128                         (item != "*") and:
2129                         (item != "/") and:
2130                         (item != "**") and:
2131                         (item != "%")
2132                 };
2133                 ~freqsetvalue = ~freqsetvalue.join.asString.interpret;
2134         };
2135
2136
2137         //extra options button
2138
2139         ~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;
2140
2141                 if(button.value == 1, {
2142
2143                         ~extraoptionsview = View(w, Rect(Window.screenBounds.width-(540),Window.screenBounds.height-(340+46/1.6180339887499)-150,340+46,380+46/1.6180339887499)).front;
2144                         ~extraoptionsview.background_(Color.black);
2145
2146                         //set slide values button
2147
2148                         ~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;
2149
2150                                 if(button.value == 1, {
2151                                         ({
2152                                                 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;
2153                                                 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;
2154                                                 ~slideview = View(w, Rect(Window.screenBounds.width-(340+46),Window.screenBounds.height-(340+46/1.6180339887499)-150,340+46,380+46/1.6180339887499)).front;
2155                                                 /*w.view.decorator=FlowLayout(w.view.bounds);
2156                                                 w.view.decorator.gap=2@2;*/
2157
2158                                                 tall = StaticText(~slideview, Rect(lefttime , top=top, width, height)).background_(Color.black).string_("all time").stringColor_(Color.white);
2159                                                 t1 = StaticText(~slideview, Rect(lefttime , top=top+height, width, height)).background_(Color.black).string_("s1 time").stringColor_(Color.white);
2160                                                 t2 = StaticText(~slideview, Rect(lefttime , top=top+height, width, height)).background_(Color.black).string_("s2 time").stringColor_(Color.white);
2161                                                 t3 = StaticText(~slideview, Rect(lefttime , top=top+height, width, height)).background_(Color.black).string_("s3 time").stringColor_(Color.white);
2162
2163                                                 top = 0;
2164
2165                                                 stall=NumberBox(~slideview, Rect(lefttimebox , top=top, widthbox, heightbox)).background_(Color.black).normalColor_(Color.white;).value_(~slidetimeall).maxDecimals_(9);
2166                                                 st1=NumberBox(~slideview, Rect(lefttimebox , top=top+heightbox, widthbox, heightbox)).background_(Color.black).normalColor_(Color.white;).value_(~slidetime1).maxDecimals_(9);
2167                                                 st2=NumberBox(~slideview, Rect(lefttimebox , top=top+heightbox, widthbox, heightbox)).background_(Color.black).normalColor_(Color.white;).value_(~slidetime2).maxDecimals_(9);
2168                                                 st3=NumberBox(~slideview, Rect(lefttimebox , top=top+heightbox, widthbox, heightbox)).background_(Color.black).normalColor_(Color.white;).value_(~slidetime3).maxDecimals_(9);
2169
2170                                                 top = 0;
2171
2172                                                 iall = StaticText(~slideview, Rect(leftdo , top=top, width, height)).background_(Color.black).string_("all incr").stringColor_(Color.white);
2173                                                 i1 = StaticText(~slideview, Rect(leftdo , top=top+height, width, height)).background_(Color.black).string_("s1 incr").stringColor_(Color.white);
2174                                                 i2 = StaticText(~slideview, Rect(leftdo , top=top+height, width, height)).background_(Color.black).string_("s2 incr").stringColor_(Color.white);
2175                                                 i3 = StaticText(~slideview, Rect(leftdo , top=top+height, width, height)).background_(Color.black).string_("s3 incr").stringColor_(Color.white);
2176
2177                                                 top = 0;
2178
2179                                                 siall=NumberBox(~slideview, Rect(leftdobox , top=top, widthbox, heightbox)).background_(Color.black).normalColor_(Color.white;).value_(~slidedoall);
2180                                                 si1=NumberBox(~slideview, Rect(leftdobox , top=top+heightbox, widthbox, heightbox)).background_(Color.black).normalColor_(Color.white;).value_(~slidedo1);
2181                                                 si2=NumberBox(~slideview, Rect(leftdobox , top=top+heightbox, widthbox, heightbox)).background_(Color.black).normalColor_(Color.white;).value_(~slidedo2);
2182                                                 si3=NumberBox(~slideview, Rect(leftdobox , top=top+heightbox, widthbox, heightbox)).background_(Color.black).normalColor_(Color.white;).value_(~slidedo3);
2183
2184                                                 stall.action_({arg val;
2185                                                         ~slidetimeall = val.value;
2186                                                         ~slidetime1 = val.value;
2187                                                         ~slidetime2 = val.value;
2188                                                         ~slidetime3 = val.value;
2189                                                         ~slideview.close; ~slidevals.valueAction_(1);
2190                                                 });
2191                                                 st1.action_({arg val; ~slidetime1 = val.value;});
2192                                                 st2.action_({arg val; ~slidetime2 = val.value;});
2193                                                 st3.action_({arg val; ~slidetime3 = val.value;});
2194
2195
2196                                                 siall.action_({arg val;
2197                                                         ~slidedoall = val.value;
2198                                                         ~slidedo1 = val.value;
2199                                                         ~slidedo2 = val.value;
2200                                                         ~slidedo3 = val.value;
2201                                                         ~slideview.close; ~slidevals.valueAction_(1);
2202                                                 });
2203                                                 si1.action_({arg val; ~slidedo1 = val.value;});
2204                                                 si2.action_({arg val; ~slidedo2 = val.value;});
2205                                                 si3.action_({arg val; ~slidedo3 = val.value;});
2206
2207                                                 ~slideview.background_(Color.black);
2208
2209                                                 ~closeslidebutton = Button.new(~slideview,Rect(leftdobox+widthbox-40, top+40, 40, 40/~gm)).states_([["close",Color.white,Color.black]]).action_({arg button;
2210
2211                                                         ~slideview.close; ~slidevals.value = 0;
2212                                                 });
2213
2214                                         }.value);
2215
2216                                         ~slideview.front;
2217                                 }, {~slideview.close;});
2218                         });
2219
2220
2221                         //set individual or all synth frequencies button
2222
2223                         ~beforefreqsetfreqs = [ ~f1,~f2,~f3 ];
2224
2225                         ~synthfreqset = Button.new(~extraoptionsview,Rect(0,0,120,20)).states_([["set frequencies",Color.white,Color.black],["set frequencies",Color.white,Color.black]]).action_({arg button; button.value.postln}).action_({arg button;
2226
2227                                 if(button.value == 1, {
2228                                         ({
2229                                                 arg  top = 0,width=88, revertwidth=75, height = 16,  heightbox = 16, lefttime = 0 , lefttimebox = width+5,  widthbox=165, leftdo = lefttimebox+widthbox+5, leftdobox = leftdo+57, inc=0, lw = 0,  uw = 0, numw = 40;
2230                                                 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;
2231                                                 ~synthfreqsetview = View(w, Rect(Window.screenBounds.width-(340+46),Window.screenBounds.height-(340+46/1.6180339887499)-150,340+46,380+46/1.6180339887499)).front;
2232                                                 /*w.view.decorator=FlowLayout(w.view.bounds);
2233                                                 w.view.decorator.gap=2@2;*/
2234
2235                                                 t1 = StaticText(~synthfreqsetview, Rect(lefttime , top=top, width, height)).background_(Color.black).string_("freq 1 (f1)").stringColor_(Color.white);
2236                                                 t2 = StaticText(~synthfreqsetview, Rect(lefttime , top=top+height, width, height)).background_(Color.black).string_("freq 2 (f2)").stringColor_(Color.white);
2237                                                 t3 = StaticText(~synthfreqsetview, Rect(lefttime , top=top+height, width, height)).background_(Color.black).string_("freq 3 (f3)").stringColor_(Color.white);
2238                                                 tall = StaticText(~synthfreqsetview, Rect(lefttime , top=top+height+10, width, height)).background_(Color.black).string_("all freqs").stringColor_(Color.white);
2239
2240                                                 top = 0;
2241
2242                                                 st1=TextField(~synthfreqsetview, Rect(lefttimebox , top=top, widthbox, heightbox)).background_(Color.black).stringColor_(Color.white).value_(~f1);
2243                                                 st2=TextField(~synthfreqsetview, Rect(lefttimebox , top=top+heightbox, widthbox, heightbox)).background_(Color.black).stringColor_(Color.white).value_(~f2);
2244                                                 st3=TextField(~synthfreqsetview, Rect(lefttimebox , top=top+heightbox, widthbox, heightbox)).background_(Color.black).stringColor_(Color.white).value_(~f3);
2245                                                 stall=TextField(~synthfreqsetview, Rect(lefttimebox , top=top+heightbox+10, widthbox, heightbox)).background_(Color.black).stringColor_(Color.white).value_(~f1);
2246
2247                                                 top = 0;
2248
2249                                                 i1 = Button.new(~synthfreqsetview, Rect(leftdo , top=top, revertwidth, height)).states_([["f1 revert",Color.white,Color.black],["f1 revert",Color.white,Color.black]]).action_({arg button; if(~f1_revert != nil, {if(~f1 != ~f1_revert, {~f1_un_revert = ~f1; ~f1 = ~f1_revert;}, {if(~f1_un_revert != nil, {~f1 = ~f1_un_revert;});}); ~synthflow.value; st1.string = ~f1.asString;});});
2250                                                 i2 = Button.new(~synthfreqsetview, Rect(leftdo , top=top+height, revertwidth, height)).states_([["f2 revert",Color.white,Color.black],["f2 revert",Color.white,Color.black]]).action_({arg button; if(~f2_revert != nil, {if(~f2 != ~f2_revert, {~f2_un_revert = ~f2; ~f2 = ~f2_revert;}, {if(~f2_un_revert != nil, {~f2 = ~f2_un_revert;});}); ~synthflow.value; st2.string = ~f2.asString;});});
2251                                                 i3 = Button.new(~synthfreqsetview, Rect(leftdo , top=top+height, revertwidth, height)).states_([["f3 revert",Color.white,Color.black],["f3 revert",Color.white,Color.black]]).action_({arg button; if(~f3_revert != nil, {if(~f3 != ~f3_revert, {~f3_un_revert = ~f3; ~f3 = ~f3_revert;}, {if(~f3_un_revert != nil, {~f3 = ~f3_un_revert;});}); ~synthflow.value; st3.string = ~f3.asString;});});
2252                                                 iall = Button.new(~synthfreqsetview, Rect(leftdo , top=top+height+10, revertwidth, height)).states_([["all revert",Color.white,Color.black],["all revert",Color.white,Color.black]]).action_({arg button; if(~f_all_revert != nil, {if([ ~f1,~f2,~f3 ] != ~f_all_revert.flatten, {~f_all_un_revert = [ ~f1,~f2,~f3 ].flatten; 8.do(x = 0; {("f"++(x=x+1)).asSymbol.envirPut(~f_all_revert.flatten.at(x-1);)});}, {if(~f_all_un_revert != nil, {8.do(x = 0; {("f"++(x=x+1)).asSymbol.envirPut(~f_all_un_revert.flatten.at(x-1);)});});}); ~synthflow.value; stall.string = ~f1.asString;});});
2253
2254
2255                                                 stall.action_({arg val; ~freqsetvalue = val.value; ~freqset_textfield_func.value; ~f_all_revert = [ ~f1,~f2,~f3 ]; 8.do(x = 0; {("f"++(x=x+1)).asSymbol.envirPut(~freqsetvalue;)}); ~synthflow.value; stall.string = ~freqsetvalue.asString;});
2256                                                 st1.action_({arg val; ~freqsetvalue = val.value; ~freqset_textfield_func.value; ~f1_revert = ~f1; ~f1 = ~freqsetvalue; ~synthflow.value; st1.string = ~freqsetvalue.asString;});
2257                                                 st2.action_({arg val; ~freqsetvalue = val.value; ~freqset_textfield_func.value; ~f2_revert = ~f2; ~f2 = ~freqsetvalue; ~synthflow.value; st2.string = ~freqsetvalue.asString;});
2258                                                 st3.action_({arg val; ~freqsetvalue = val.value; ~freqset_textfield_func.value; ~f3_revert = ~f3; ~f3 = ~freqsetvalue; ~synthflow.value; st3.string = ~freqsetvalue.asString;});
2259
2260                                                 ~synthfreqsetview.background_(Color.black);
2261
2262                                                 ~closesfreqsetbutton = Button.new(~synthfreqsetview,Rect(leftdo+revertwidth-40, top=top+height+20, 40, 40/~gm)).states_([["close",Color.white,Color.black]]).action_({arg button;
2263
2264                                                         ~synthfreqsetview.close;
2265                                                 });
2266
2267                                                 ~beforefreqsetrevert = Button.new(~synthfreqsetview,Rect(lefttime, top+(40/~gm)-height, revertwidth+150, height)).states_([["restore freqs before opening eo",Color.white,Color.black],["revert",Color.white,Color.black]]).action_({arg button;
2268
2269                                                         if([ ~f1,~f2,~f3 ] != ~beforefreqsetfreqs.flatten, {~beforefreqsetfreqs_unrestore = [ ~f1,~f2,~f3 ]; 8.do(x = 0; {("f"++(x=x+1)).asSymbol.envirPut(~beforefreqsetfreqs.flatten.at(x-1);)});}, {if(~beforefreqsetfreqs_unrestore != nil, {8.do(x = 0; {("f"++(x=x+1)).asSymbol.envirPut(~beforefreqsetfreqs_unrestore.flatten.at(x-1);)});});}); ~synthflow.value;
2270                                                 });
2271
2272
2273                                         }.value);
2274
2275                                         ~synthfreqsetview.front;
2276                                 }, {~synthfreqsetview.close});
2277                         });
2278
2279
2280                         Button.new(~extraoptionsview,Rect(0,80,120,20)).states_([["close eo",Color.white,Color.black],["close eo",Color.white,Color.black]]).action_({arg button; button.value.postln}).action_({arg button;
2281
2282                                 ~extraoptionsview.close; ~slideview.close; ~synthfreqsetview.close; ~extraoptions.value = 0;
2283
2284                         });
2285
2286                 }, {~extraoptionsview.close; ~slideview.close; ~synthfreqset.close;});
2287         });
2288
2289
2290         //mute/unmute 1-8 buttons
2291
2292         mute1 = Button.new(w,Rect(~bpl+(16*1),~bpt+69+5,16,16/1.6180339887499)).states_([["1",Color.white,Color.black],["",Color.white,Color.black]]).action_({arg button; button.value.postln}).action_({arg button;
2293                 case
2294                 {~l1a1.isRunning == true}{
2295                         if(button.value == 0, {
2296                                 (~vol1 = ~vol;
2297                                         1.do({
2298                                                 ~l1a1.set(\vol, ~vol1);  ~l1b1.set(\vol, ~vol1);
2299                                                 ~l1c1.set(\vol, ~vol1);  ~l1d1.set(\vol, ~vol1);
2300                                                 ~l1e1.set(\vol, ~vol1);  ~l1f1.set(\vol, ~vol1);
2301
2302                                 }););
2303                         }, {(~vol1 = 0;
2304                                 1.do({
2305                                         ~l1a1.set(\vol, ~vol1);  ~l1b1.set(\vol, ~vol1);
2306                                         ~l1c1.set(\vol, ~vol1);  ~l1d1.set(\vol, ~vol1);
2307                                         ~l1e1.set(\vol, ~vol1);  ~l1f1.set(\vol, ~vol1);
2308
2309                         }););
2310                         });
2311                 }
2312                 {~l1a.isRunning == true}{
2313                         if(button.value == 0, {
2314                                 (~vol1 = ~vol;
2315                                         1.do({
2316                                                 ~l1a.set(\vol, ~vol1);  ~l1b.set(\vol, ~vol1);
2317                                                 ~l1c.set(\vol, ~vol1);  ~l1d.set(\vol, ~vol1);
2318                                                 ~l1e.set(\vol, ~vol1);  ~l1f.set(\vol, ~vol1);
2319
2320                                 }););
2321                         }, {(~vol1 = 0;
2322                                 1.do({
2323                                         ~l1a.set(\vol, ~vol1);  ~l1b.set(\vol, ~vol1);
2324                                         ~l1c.set(\vol, ~vol1);  ~l1d.set(\vol, ~vol1);
2325                                         ~l1e.set(\vol, ~vol1);  ~l1f.set(\vol, ~vol1);
2326
2327                         }););
2328                         });
2329                 };
2330         });
2331
2332         mute2 = Button.new(w,Rect(~bpl+(16*2),~bpt+69+5,16,16/1.6180339887499)).states_([["2",Color.white,Color.black],["",Color.white,Color.black]]).action_({arg button; button.value.postln}).action_({arg button;
2333                 case
2334                 {~l1a1.isRunning == true}{
2335                         if(button.value == 0, {
2336                                 (~vol2 = ~vol;
2337                                         1.do({
2338                                                 ~l2a1.set(\vol, ~vol2);  ~l2b1.set(\vol, ~vol2);
2339                                                 ~l2c1.set(\vol, ~vol2);  ~l2d1.set(\vol, ~vol2);
2340                                                 ~l2e1.set(\vol, ~vol2);  ~l2f1.set(\vol, ~vol2);
2341
2342                                 }););
2343                         }, {(~vol2 = 0;
2344                                 1.do({
2345                                         ~l2a1.set(\vol, ~vol2);  ~l2b1.set(\vol, ~vol2);
2346                                         ~l2c1.set(\vol, ~vol2);  ~l2d1.set(\vol, ~vol2);
2347                                         ~l2e1.set(\vol, ~vol2);  ~l2f1.set(\vol, ~vol2);
2348
2349                         }););
2350                         });
2351                 }
2352                 {~l1a.isRunning == true}{