|
@@ -0,0 +1,894 @@
|
|
1
|
+# Generate the 'mod' file for time_line_lite.js
|
|
2
|
+
|
|
3
|
+import sys,copy
|
|
4
|
+
|
|
5
|
+# Selected presets
|
|
6
|
+scoreSeqL = [
|
|
7
|
+ ( 1,"g_1_d"),
|
|
8
|
+ ( 18,"a"),
|
|
9
|
+ ( 43,"d"),
|
|
10
|
+ ( 55,"g_1_a"),
|
|
11
|
+ ( 74,"a"),
|
|
12
|
+ ( 80,"d"),
|
|
13
|
+ ( 91,"dry"),
|
|
14
|
+ ( 95,"b"),
|
|
15
|
+ ( 102,"g_a"),
|
|
16
|
+ ( 126,"b"),
|
|
17
|
+ ( 142,"a"),
|
|
18
|
+ ( 156,"a"),
|
|
19
|
+ ( 171,"a"),
|
|
20
|
+ ( 186,"b"),
|
|
21
|
+ ( 231,"f_4"),
|
|
22
|
+ ( 236,"g_1_d"),
|
|
23
|
+ ( 264,"g_1_d"),
|
|
24
|
+ ( 286,"dry"),
|
|
25
|
+ ( 291,"f_3"),
|
|
26
|
+ ( 353,"f_4"),
|
|
27
|
+ ( 378,"g_1_a"),
|
|
28
|
+ ( 384,"f_4"),
|
|
29
|
+ ( 391,"g_1_d"),
|
|
30
|
+ ( 451,"f_1"),
|
|
31
|
+ ( 480,"f_4"),
|
|
32
|
+ ( 544,"f_1"),
|
|
33
|
+ ( 559,"dry"),
|
|
34
|
+ ( 610,"dry"),
|
|
35
|
+ ( 699,"g_a"),
|
|
36
|
+ ( 778,"f_3"),
|
|
37
|
+ ( 917,"g_1_d"),
|
|
38
|
+ ( 971,"f_3"),
|
|
39
|
+ (1025,"g_1_d"),
|
|
40
|
+ (1090,"g_1_d")
|
|
41
|
+ ]
|
|
42
|
+
|
|
43
|
+# Hard-coded presets
|
|
44
|
+initPresetStr = """
|
|
45
|
+ init:
|
|
46
|
+ [
|
|
47
|
+ // wnd len:1=512 2=1024 3=2048 4=4096 5=8192
|
|
48
|
+ { loc:-1, mod:m1, var:win0, type:set, rate:100, val:3 },
|
|
49
|
+ { var:win1, rate:100, val:2 },
|
|
50
|
+
|
|
51
|
+ // hop: 1=1 2=2 3=4 4=8 5=16
|
|
52
|
+ { var:hop0, rate:100, val:3 },
|
|
53
|
+ { var:hop1, rate:100, val:3 },
|
|
54
|
+
|
|
55
|
+ { var:mod0, val:1 },
|
|
56
|
+ { var:mod1, val:1 },
|
|
57
|
+
|
|
58
|
+ { var:thr0, val:65 },
|
|
59
|
+ { var:thr1, val:65 },
|
|
60
|
+
|
|
61
|
+ { var:upr0, val:0 },
|
|
62
|
+ { var:upr1, val:0 },
|
|
63
|
+ { var:lwr0, val:2.0 }, // lwr has a hardcoded min. of 0.3
|
|
64
|
+ { var:lwr1, val:2.0 },
|
|
65
|
+
|
|
66
|
+ { var:off0, val:20 },
|
|
67
|
+ { var:off1, val:20 },
|
|
68
|
+
|
|
69
|
+ { var:wet0, val:0.0 },
|
|
70
|
+ { var:wet1, val:0.0 },
|
|
71
|
+
|
|
72
|
+ { var:mint0, val:55 },
|
|
73
|
+ { var:maxt0, val:85 },
|
|
74
|
+ { var:minu0, val:0.0 },
|
|
75
|
+ { var:maxu0, val:0.5 },
|
|
76
|
+ { var:minl0, val:0 },
|
|
77
|
+ { var:maxl0, val:3 },
|
|
78
|
+ { var:mino0, val:-100.0 },
|
|
79
|
+ { var:maxo0, val:100.0 },
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+ { var:mint1, val:55 },
|
|
83
|
+ { var:maxt1, val:85 },
|
|
84
|
+ { var:minu1, val:0.0 },
|
|
85
|
+ { var:maxu1, val:0.5 },
|
|
86
|
+ { var:minl1, val:0 },
|
|
87
|
+ { var:maxl1, val:3 },
|
|
88
|
+ { var:mino1, val:-100.0 },
|
|
89
|
+ { var:maxo1, val:100.0 },
|
|
90
|
+
|
|
91
|
+ { var:xfad0, val:100.0 },
|
|
92
|
+ { var:xfad1, val:100.0 },
|
|
93
|
+ { var:sw0, type:decl, val:1 },
|
|
94
|
+ { var:sw1, type:decl, val:1 },
|
|
95
|
+
|
|
96
|
+ // compressor
|
|
97
|
+ { var:cbyp0, type:set, val:0.0 },
|
|
98
|
+ { var:cigain0, val:3.0 },
|
|
99
|
+ { var:cthrsh0, val:-20.0 },
|
|
100
|
+ { var:cratio0, val:2.0 },
|
|
101
|
+ { var:catkms0, val:20.0 },
|
|
102
|
+ { var:crlsms0, val:1000.0 },
|
|
103
|
+ { var:cmakeup0, val:1.0 },
|
|
104
|
+ { var:cwndms0, val:200 },
|
|
105
|
+
|
|
106
|
+ { var:cbyp1, val:0.0 },
|
|
107
|
+ { var:cigain1, val:3.0 },
|
|
108
|
+ { var:cthrsh1, val:-20.0 },
|
|
109
|
+ { var:cratio1, val:2.0 },
|
|
110
|
+ { var:catkms1, val:20.0 },
|
|
111
|
+ { var:crlsms1, val:1000.0 },
|
|
112
|
+ { var:cmakeup1, val:1.0 },
|
|
113
|
+ { var:cwndms1, val:200 },
|
|
114
|
+
|
|
115
|
+ { var:dgain0, val:1.0 },
|
|
116
|
+ { var:dgain1, val:1.0 },
|
|
117
|
+ { var:wgain0, val:1.0 },
|
|
118
|
+ { var:wgain1, val:1.0 },
|
|
119
|
+ ]
|
|
120
|
+
|
|
121
|
+// Dry
|
|
122
|
+ preset_dry :
|
|
123
|
+ [
|
|
124
|
+ { loc:-1 mod:m1 var:mod0, type:set, val:1 },
|
|
125
|
+ { var:cigain0, val: 5.0 },
|
|
126
|
+ { var:wet0 val: 0.0}
|
|
127
|
+ { var:sw0, val:0 },
|
|
128
|
+
|
|
129
|
+ { var:mod1 val:1 },
|
|
130
|
+ { var:cigain1, val: 5.0 },
|
|
131
|
+ { var:wet1 val: 0.0}
|
|
132
|
+ { var:sw1, val:0 },
|
|
133
|
+ ]
|
|
134
|
+
|
|
135
|
+"""
|
|
136
|
+
|
|
137
|
+
|
|
138
|
+# Default labels to match the 'kc' menu.
|
|
139
|
+dfltLabelsL = [ "a","b","c","d","f_1", "f_2", "f_3", "f_4", "g", "g_a", "g_1_a", "g_1_d" ]
|
|
140
|
+
|
|
141
|
+# Default preset values.
|
|
142
|
+dfltPresetL = [
|
|
143
|
+
|
|
144
|
+ {"a":
|
|
145
|
+ [
|
|
146
|
+ {
|
|
147
|
+ "mod": 1,
|
|
148
|
+ "thr": 60.0,
|
|
149
|
+ "upr": -1.1,
|
|
150
|
+ "lwr": 2.0,
|
|
151
|
+ "off": 0.0,
|
|
152
|
+ "cigain": 6.0,
|
|
153
|
+ "wet": 1.0,
|
|
154
|
+ "wgain": 1.75,
|
|
155
|
+ "sw": 0
|
|
156
|
+ },
|
|
157
|
+
|
|
158
|
+ {
|
|
159
|
+ "mod": 1,
|
|
160
|
+ "thr": 60.0,
|
|
161
|
+ "upr": -0.99,
|
|
162
|
+ "lwr": 2.0,
|
|
163
|
+ "off": 0.0,
|
|
164
|
+ "cigain": 6.0,
|
|
165
|
+ "wet": 1.0,
|
|
166
|
+ "wgain": 1.75,
|
|
167
|
+ "sw": 0
|
|
168
|
+ }
|
|
169
|
+ ]
|
|
170
|
+ },
|
|
171
|
+
|
|
172
|
+ {"b":
|
|
173
|
+ [
|
|
174
|
+ {
|
|
175
|
+ "mod": 1,
|
|
176
|
+ "thr": 77.0,
|
|
177
|
+ "upr": -0.5,
|
|
178
|
+ "lwr": 3.0,
|
|
179
|
+ "off": 0.0,
|
|
180
|
+ "cigain":10.0,
|
|
181
|
+ "wet": 1.0,
|
|
182
|
+ "wgain": 1.75,
|
|
183
|
+ "sw": 0
|
|
184
|
+ },
|
|
185
|
+
|
|
186
|
+ {
|
|
187
|
+ "mod": 1,
|
|
188
|
+ "thr": 74.0,
|
|
189
|
+ "upr": -0.5,
|
|
190
|
+ "lwr": 2.0,
|
|
191
|
+ "off": 0.0,
|
|
192
|
+ "cigain":10.0,
|
|
193
|
+ "wet": 1.0,
|
|
194
|
+ "wgain": 1.75,
|
|
195
|
+ "sw": 0
|
|
196
|
+ }
|
|
197
|
+ ]
|
|
198
|
+ },
|
|
199
|
+
|
|
200
|
+ {"c":
|
|
201
|
+ [
|
|
202
|
+ {
|
|
203
|
+ "mod": 1,
|
|
204
|
+ "thr": 80.0,
|
|
205
|
+ "upr": -0.5,
|
|
206
|
+ "lwr": 5.0,
|
|
207
|
+ "off": 0.0,
|
|
208
|
+ "cigain":11.0,
|
|
209
|
+ "wet": 1.0,
|
|
210
|
+ "wgain": 1.0,
|
|
211
|
+ "sw": 0
|
|
212
|
+ },
|
|
213
|
+
|
|
214
|
+ {
|
|
215
|
+ "mod": 1,
|
|
216
|
+ "thr": 80.0,
|
|
217
|
+ "upr": -0.5,
|
|
218
|
+ "lwr": 5.0,
|
|
219
|
+ "off": 0.0,
|
|
220
|
+ "cigain":11.0,
|
|
221
|
+ "wet": 1.0,
|
|
222
|
+ "wgain": 1.0,
|
|
223
|
+ "sw": 0
|
|
224
|
+ }
|
|
225
|
+ ]
|
|
226
|
+ },
|
|
227
|
+
|
|
228
|
+
|
|
229
|
+ {"d":
|
|
230
|
+ [
|
|
231
|
+ {
|
|
232
|
+ "mod": 1,
|
|
233
|
+ "thr": 70.0,
|
|
234
|
+ "upr": -3.9,
|
|
235
|
+ "lwr": 4.0,
|
|
236
|
+ "off": 0.0,
|
|
237
|
+ "cigain": 9.0,
|
|
238
|
+ "wet": 1.0,
|
|
239
|
+ "wgain": 1.0,
|
|
240
|
+ "sw": 0
|
|
241
|
+ },
|
|
242
|
+
|
|
243
|
+ {
|
|
244
|
+ "mod": 1,
|
|
245
|
+ "thr": 70.0,
|
|
246
|
+ "upr": -4.5,
|
|
247
|
+ "lwr": 4.0,
|
|
248
|
+ "off": 0.0,
|
|
249
|
+ "cigain": 9.0,
|
|
250
|
+ "wet": 1.0,
|
|
251
|
+ "wgain": 1.0,
|
|
252
|
+ "sw": 0
|
|
253
|
+ }
|
|
254
|
+ ]
|
|
255
|
+ },
|
|
256
|
+
|
|
257
|
+ {"f_1":
|
|
258
|
+ [
|
|
259
|
+ {
|
|
260
|
+ "mod": 1,
|
|
261
|
+ "thr": 50.0,
|
|
262
|
+ "upr": -3.0,
|
|
263
|
+ "lwr": 1.0,
|
|
264
|
+ "off": 0.0,
|
|
265
|
+ "cigain": 6.0,
|
|
266
|
+ "wet": 1.0,
|
|
267
|
+ "wgain": 2.0,
|
|
268
|
+ "sw": 0
|
|
269
|
+ },
|
|
270
|
+
|
|
271
|
+ {
|
|
272
|
+ "mod": 1,
|
|
273
|
+ "thr": 50.0,
|
|
274
|
+ "upr": -3.0,
|
|
275
|
+ "lwr": 1.0,
|
|
276
|
+ "off": 0.0,
|
|
277
|
+ "cigain": 6.0,
|
|
278
|
+ "wet": 1.0,
|
|
279
|
+ "wgain": 2.0,
|
|
280
|
+ "sw": 0
|
|
281
|
+ }
|
|
282
|
+ ]
|
|
283
|
+ },
|
|
284
|
+
|
|
285
|
+ {"f_2":
|
|
286
|
+ [
|
|
287
|
+ {
|
|
288
|
+ "mod": 1,
|
|
289
|
+ "thr": 60.0,
|
|
290
|
+ "upr": -3.0,
|
|
291
|
+ "lwr": 1.0,
|
|
292
|
+ "off": 0.0,
|
|
293
|
+ "cigain": 6.0,
|
|
294
|
+ "wet": 1.0,
|
|
295
|
+ "wgain": 2.0,
|
|
296
|
+ "sw": 0
|
|
297
|
+ },
|
|
298
|
+
|
|
299
|
+ {
|
|
300
|
+ "mod": 1,
|
|
301
|
+ "thr": 60.0,
|
|
302
|
+ "upr": -3.0,
|
|
303
|
+ "lwr": 1.0,
|
|
304
|
+ "off": 0.0,
|
|
305
|
+ "cigain": 6.0,
|
|
306
|
+ "wet": 1.0,
|
|
307
|
+ "wgain": 2.0,
|
|
308
|
+ "sw": 0
|
|
309
|
+ }
|
|
310
|
+ ]
|
|
311
|
+ },
|
|
312
|
+
|
|
313
|
+ {"f_3":
|
|
314
|
+ [
|
|
315
|
+ {
|
|
316
|
+ "mod": 1,
|
|
317
|
+ "thr": 55.0,
|
|
318
|
+ "upr": -3.0,
|
|
319
|
+ "lwr": 1.0,
|
|
320
|
+ "off": 0.0,
|
|
321
|
+ "cigain": 6.0,
|
|
322
|
+ "wet": 1.0,
|
|
323
|
+ "wgain": 2.0,
|
|
324
|
+ "sw": 0
|
|
325
|
+ },
|
|
326
|
+
|
|
327
|
+ {
|
|
328
|
+ "mod": 1,
|
|
329
|
+ "thr": 55.0,
|
|
330
|
+ "upr": -3.0,
|
|
331
|
+ "lwr": 1.0,
|
|
332
|
+ "off": 0.0,
|
|
333
|
+ "cigain": 6.0,
|
|
334
|
+ "wet": 1.0,
|
|
335
|
+ "wgain": 2.0,
|
|
336
|
+ "sw": 0
|
|
337
|
+ }
|
|
338
|
+ ]
|
|
339
|
+ },
|
|
340
|
+
|
|
341
|
+ {"f_4":
|
|
342
|
+ [
|
|
343
|
+ {
|
|
344
|
+ "mod": 1,
|
|
345
|
+ "thr": 55.0,
|
|
346
|
+ "upr": -5.0,
|
|
347
|
+ "lwr": 1.0,
|
|
348
|
+ "off": 0.0,
|
|
349
|
+ "cigain": 6.0,
|
|
350
|
+ "wet": 1.0,
|
|
351
|
+ "wgain": 2.0,
|
|
352
|
+ "sw": 0
|
|
353
|
+ },
|
|
354
|
+
|
|
355
|
+ {
|
|
356
|
+ "mod": 1,
|
|
357
|
+ "thr": 55.0,
|
|
358
|
+ "upr": -5.0,
|
|
359
|
+ "lwr": 1.0,
|
|
360
|
+ "off": 0.0,
|
|
361
|
+ "cigain": 6.0,
|
|
362
|
+ "wet": 1.0,
|
|
363
|
+ "wgain": 2.0,
|
|
364
|
+ "sw": 0
|
|
365
|
+ }
|
|
366
|
+ ]
|
|
367
|
+ },
|
|
368
|
+
|
|
369
|
+ {"g":
|
|
370
|
+ [
|
|
371
|
+ {
|
|
372
|
+ "mod": 4,
|
|
373
|
+ "thr": 60.0,
|
|
374
|
+ "upr": -0.7,
|
|
375
|
+ "lwr": 8.0,
|
|
376
|
+ "off": 20.0,
|
|
377
|
+ "cigain":10.0,
|
|
378
|
+ "wet": 1.0,
|
|
379
|
+ "wgain": 1.0,
|
|
380
|
+ "sw": 0
|
|
381
|
+ },
|
|
382
|
+
|
|
383
|
+ {
|
|
384
|
+ "mod": 4,
|
|
385
|
+ "thr": 64.0,
|
|
386
|
+ "upr": -0.7,
|
|
387
|
+ "lwr": 8.0,
|
|
388
|
+ "off": 20.0,
|
|
389
|
+ "cigain":10.0,
|
|
390
|
+ "wet": 1.0,
|
|
391
|
+ "wgain": 1.0,
|
|
392
|
+ "sw": 0
|
|
393
|
+ }
|
|
394
|
+ ]
|
|
395
|
+ },
|
|
396
|
+
|
|
397
|
+ {"g_a":
|
|
398
|
+ [
|
|
399
|
+ {
|
|
400
|
+ "mod": 4,
|
|
401
|
+ "thr": 50.0,
|
|
402
|
+ "upr": -0.7,
|
|
403
|
+ "lwr": 2.0,
|
|
404
|
+ "off": 40.0,
|
|
405
|
+ "cigain":10.0,
|
|
406
|
+ "wet": 1.0,
|
|
407
|
+ "wgain": 1.0,
|
|
408
|
+ "sw": 0
|
|
409
|
+ },
|
|
410
|
+
|
|
411
|
+ {
|
|
412
|
+ "mod": 4,
|
|
413
|
+ "thr": 54.0,
|
|
414
|
+ "upr": -0.7,
|
|
415
|
+ "lwr": 8.0,
|
|
416
|
+ "off": 40.0,
|
|
417
|
+ "cigain":10.0,
|
|
418
|
+ "wet": 1.0,
|
|
419
|
+ "wgain": 1.0,
|
|
420
|
+ "sw": 0
|
|
421
|
+ }
|
|
422
|
+ ]
|
|
423
|
+ },
|
|
424
|
+
|
|
425
|
+ {"g_1_a":
|
|
426
|
+ [
|
|
427
|
+ {
|
|
428
|
+ "mod": 4,
|
|
429
|
+ "thr": 50.0,
|
|
430
|
+ "upr": -0.7,
|
|
431
|
+ "lwr": 8.0,
|
|
432
|
+ "off": 20.0,
|
|
433
|
+ "cigain":10.0,
|
|
434
|
+ "wet": 1.0,
|
|
435
|
+ "wgain": 1.0,
|
|
436
|
+ "sw": 0
|
|
437
|
+ },
|
|
438
|
+
|
|
439
|
+ {
|
|
440
|
+ "mod": 4,
|
|
441
|
+ "thr": 54.0,
|
|
442
|
+ "upr": -0.7,
|
|
443
|
+ "lwr": 2.0,
|
|
444
|
+ "off": 20.0,
|
|
445
|
+ "cigain":10.0,
|
|
446
|
+ "wet": 1.0,
|
|
447
|
+ "wgain": 1.0,
|
|
448
|
+ "sw": 0
|
|
449
|
+ }
|
|
450
|
+ ]
|
|
451
|
+ },
|
|
452
|
+
|
|
453
|
+ {"g_1_d":
|
|
454
|
+ [
|
|
455
|
+ {
|
|
456
|
+ "mod": 4,
|
|
457
|
+ "thr": 40.0,
|
|
458
|
+ "upr": -0.4,
|
|
459
|
+ "lwr": 7.0,
|
|
460
|
+ "off": 60.0,
|
|
461
|
+ "cigain":10.0,
|
|
462
|
+ "wet": 1.0,
|
|
463
|
+ "wgain": 1.0,
|
|
464
|
+ "sw": 0
|
|
465
|
+ },
|
|
466
|
+
|
|
467
|
+ {
|
|
468
|
+ "mod": 4,
|
|
469
|
+ "thr": 34.0,
|
|
470
|
+ "upr": -0.3,
|
|
471
|
+ "lwr": 5.0,
|
|
472
|
+ "off": 64.0,
|
|
473
|
+ "cigain":10.0,
|
|
474
|
+ "wet": 1.0,
|
|
475
|
+ "wgain": 1.0,
|
|
476
|
+ "sw": 0
|
|
477
|
+ }
|
|
478
|
+ ]
|
|
479
|
+ }
|
|
480
|
+
|
|
481
|
+ ]
|
|
482
|
+
|
|
483
|
+
|
|
484
|
+def write_seq( f, label, seqL ):
|
|
485
|
+ """ Write a sequence preset.
|
|
486
|
+ seqL = [
|
|
487
|
+ (loc preset_label) # Set 'preset_label' to 'None' to assign the seq. label to the preset label.
|
|
488
|
+ (loc var ch value) # 'ch' is 0=left or 1=right
|
|
489
|
+ ]
|
|
490
|
+ """
|
|
491
|
+
|
|
492
|
+ f.write("seq_%s :\n" % label)
|
|
493
|
+ f.write("[\n")
|
|
494
|
+ f.write("{ loc:-1 type:exec val:init },\n")
|
|
495
|
+ f.write("{ loc:-1 val:preset_dry },\n")
|
|
496
|
+
|
|
497
|
+ typ0 = 'exec'
|
|
498
|
+ for x in seqL:
|
|
499
|
+ typ1 = typ0
|
|
500
|
+ if len(x) == 2:
|
|
501
|
+ typ1 = 'exec'
|
|
502
|
+ preset_label = label if x[1]==None else x[1]
|
|
503
|
+ typeS = 'type:exec,' if typ0!=typ1 else ' '
|
|
504
|
+ f.write("{ loc:%5i, %s val:preset_%s },\n" % (x[0],typeS,preset_label))
|
|
505
|
+ elif len(x) == 4:
|
|
506
|
+ typ1 = 'set'
|
|
507
|
+ typeS = 'type:set' if typ0!=typ1 else ' '
|
|
508
|
+ f.write("{ loc:%5i %s var:%s%i val:%7.2f },\n" % (x[0],typeS,x[1],x[2],x[3]))
|
|
509
|
+
|
|
510
|
+ typ0 = typ1
|
|
511
|
+
|
|
512
|
+
|
|
513
|
+ f.write("]\n\n")
|
|
514
|
+
|
|
515
|
+def write_preset_ch( f, presetD, ch ):
|
|
516
|
+
|
|
517
|
+ fmt0 = "{ loc:-1 mode:m1 var:%6s%i, type:set, val:%7.2f },\n"
|
|
518
|
+ fmt1 = "{ var:%6s%i, val:%7.2f },\n"
|
|
519
|
+ fmt = fmt0 if ch==0 else fmt1
|
|
520
|
+ for key,val in presetD.items():
|
|
521
|
+ f.write(fmt % (key,ch,val))
|
|
522
|
+ fmt = fmt1
|
|
523
|
+
|
|
524
|
+def write_preset( f, label, psL ):
|
|
525
|
+
|
|
526
|
+ f.write("preset_%s : \n" % label)
|
|
527
|
+ f.write("[\n")
|
|
528
|
+ write_preset_ch(f, psL[0], 0 )
|
|
529
|
+ f.write("\n")
|
|
530
|
+ write_preset_ch(f, psL[1], 1 )
|
|
531
|
+ f.write("]\n")
|
|
532
|
+
|
|
533
|
+
|
|
534
|
+def write_seqs( f, labelL, seqL ):
|
|
535
|
+ """ Assign a list of preset changes to all sequences named in labelL."""
|
|
536
|
+
|
|
537
|
+ for label in labelL:
|
|
538
|
+ write_seq( f, label, seqL )
|
|
539
|
+
|
|
540
|
+def write_presets( f, presetL ):
|
|
541
|
+
|
|
542
|
+ for x in presetL:
|
|
543
|
+ label = x.keys()[0]
|
|
544
|
+ psL = x[label]
|
|
545
|
+ write_preset(f,label,psL)
|
|
546
|
+
|
|
547
|
+def label_to_psL( presetL, keyLabel ):
|
|
548
|
+ for preset in presetL:
|
|
549
|
+ label = preset.keys()[0]
|
|
550
|
+ if label == keyLabel:
|
|
551
|
+ return preset[label]
|
|
552
|
+
|
|
553
|
+ raise ValueError( "Preset %s not found." % keyLabel)
|
|
554
|
+
|
|
555
|
+
|
|
556
|
+def dupl_preset( presetL, keyLabel, labelsL ):
|
|
557
|
+ """ Create a new preset list formed by duplicating the preset
|
|
558
|
+ identified by 'keyLabel' for each label in 'labelsL'
|
|
559
|
+ """
|
|
560
|
+ psL = label_to_psL(presetL,keyLabel);
|
|
561
|
+ newL = []
|
|
562
|
+
|
|
563
|
+ for label in labelsL:
|
|
564
|
+ newL.append( { label:copy.deepcopy(psL) } )
|
|
565
|
+
|
|
566
|
+ return newL
|
|
567
|
+
|
|
568
|
+def mod_range( presetL, var, val00, val01, val10, val11 ):
|
|
569
|
+
|
|
570
|
+ N = len(presetL)
|
|
571
|
+ v0L = []
|
|
572
|
+ v1L = []
|
|
573
|
+ for i in range(0,N):
|
|
574
|
+ v0L.append( val00 + (i*(val01-val00)/(N-1)) )
|
|
575
|
+ v1L.append( val10 + (i*(val11-val10)/(N-1)) )
|
|
576
|
+
|
|
577
|
+
|
|
578
|
+ for i,preset in enumerate(presetL):
|
|
579
|
+ label = preset.keys()[0]
|
|
580
|
+ psL = preset[label]
|
|
581
|
+
|
|
582
|
+ #print "%i %s %f %f" % (i,label,v0L[i],v1L[i])
|
|
583
|
+
|
|
584
|
+ psL[0][var] = v0L[i]
|
|
585
|
+ psL[1][var] = v1L[i]
|
|
586
|
+
|
|
587
|
+
|
|
588
|
+def mod_discrete_range( presetL, var, v0L, v1L ):
|
|
589
|
+
|
|
590
|
+ assert( len(v0L) == len(v1L) )
|
|
591
|
+
|
|
592
|
+ N = min(len(v0L),len(presetL))
|
|
593
|
+
|
|
594
|
+
|
|
595
|
+ for i in range(N):
|
|
596
|
+ preset = presetL[i]
|
|
597
|
+ label = preset.keys()[0]
|
|
598
|
+ psL = preset[label]
|
|
599
|
+
|
|
600
|
+ print "%i %s %f %f" % (i,label,v0L[i],v1L[i])
|
|
601
|
+
|
|
602
|
+ psL[0][var] = v0L[i]
|
|
603
|
+ psL[1][var] = v1L[i]
|
|
604
|
+
|
|
605
|
+ return N
|
|
606
|
+
|
|
607
|
+def print_preset( presetL ):
|
|
608
|
+
|
|
609
|
+ for x in presetL:
|
|
610
|
+ label = x.keys()[0]
|
|
611
|
+ psL = x[label]
|
|
612
|
+ print "%s %i" % (label,len(psL))
|
|
613
|
+
|
|
614
|
+ for i,psD in enumerate(psL):
|
|
615
|
+ for var,val in psD.items():
|
|
616
|
+ print "%s%i:%f" % (var,i,val)
|
|
617
|
+
|
|
618
|
+
|
|
619
|
+
|
|
620
|
+
|
|
621
|
+if __name__ == "__main__":
|
|
622
|
+
|
|
623
|
+ #print_preset( presetL )
|
|
624
|
+
|
|
625
|
+ fn = sys.argv[1]
|
|
626
|
+
|
|
627
|
+
|
|
628
|
+ #
|
|
629
|
+ seq0L = [
|
|
630
|
+ ( 961, "g_1_d"), # (loc preset_label)
|
|
631
|
+ ( 967, "wnd", 0, 3 ), # (loc var channel value)
|
|
632
|
+ ( 967, "f_3"), # (loc preset_label)
|
|
633
|
+ (1023, None) # (loc preset_label = seq_label)
|
|
634
|
+ ]
|
|
635
|
+
|
|
636
|
+ seq1L =[
|
|
637
|
+ (1, None) # meas 1
|
|
638
|
+ #(301, None) # meas 33
|
|
639
|
+ #(480, None) # meas 41
|
|
640
|
+ ]
|
|
641
|
+
|
|
642
|
+
|
|
643
|
+ presetL = []
|
|
644
|
+
|
|
645
|
+ # assign a sequential range of thresholds to each preset
|
|
646
|
+ if 0: # 12/28/16
|
|
647
|
+
|
|
648
|
+ mod_range( presetL, "thr", 50.0, 90.0, 55.0, 95.0 )
|
|
649
|
+ mod_range( presetL, "cigain", 6.0, 12.0, 6.0, 12.0 )
|
|
650
|
+ mod_range( presetL, "upr", 2.5, -5.0, 2.3, -5.2)
|
|
651
|
+ mod_range( presetL, "lwr", 0.5, 2.0, 0.5, 2.0)
|
|
652
|
+
|
|
653
|
+ if 0: # 12/28/16
|
|
654
|
+
|
|
655
|
+ # make all presets identical to preset 'a'.
|
|
656
|
+ presetL = dupl_preset( dfltPresetL, "g_1_d", dfltLabelsL)
|
|
657
|
+
|
|
658
|
+ #mod_range( presetL, "thr", 30.0, 90.0, 35.0, 95.0 )
|
|
659
|
+ #mod_range( presetL, "cigain", 10.0, 16.0, 10.0, 16.0 )
|
|
660
|
+ mod_range( presetL, "thr", 65.0, 65.0, 65.0, 65.0 )
|
|
661
|
+ #mod_range( presetL, "upr", -0.05, 4.5, -0.05, 4.5) # upr slope min: -0.05
|
|
662
|
+ mod_range( presetL, "upr", -0.05, -0.05, -0.05, -0.05)
|
|
663
|
+ #mod_range( presetL, "lwr", 1.1, 8.0, 1.1, 8.0 ) # 1.5 is good
|
|
664
|
+ #mod_range( presetL, "lwr", 8.0, 8.0, 8.0, 8.0 )
|
|
665
|
+ mod_range( presetL, "lwr", 1.5, 1.5, 1.5, 1.5 )
|
|
666
|
+ mod_range( presetL, "off", 0.0, 99.9, 0.0, 99.9)
|
|
667
|
+ #mod_range( presetL, "upr", 2.5, -5.0, 2.3, -5.2)
|
|
668
|
+ #mod_range( presetL, "lwr", 0.5, 2.0, 0.5, 2.0)
|
|
669
|
+
|
|
670
|
+ if 0: # 1/14/17
|
|
671
|
+
|
|
672
|
+ seq1L =[
|
|
673
|
+ (778, None) # meas 50
|
|
674
|
+ ]
|
|
675
|
+
|
|
676
|
+ if 0:
|
|
677
|
+ presetL = dupl_preset( dfltPresetL, "f_3", dfltLabelsL)
|
|
678
|
+
|
|
679
|
+ # thr: (40 ok) - (71 0k) upr:-3.0 lwr:1.0 cigain:6.0 vetted trajectory for measure 50
|
|
680
|
+
|
|
681
|
+ mod_range( presetL, "thr", 40.0, 71.0, 40.0, 71.0 )
|
|
682
|
+ #mod_range( presetL, "thr", 68.0, 68.0, 68.0, 68.0 )
|
|
683
|
+ #mod_range( presetL, "upr", -4.0, 0.0, -4.0, 0.0)
|
|
684
|
+ mod_range( presetL, "upr", -3.0, -3.0, -3.0, -3.0)
|
|
685
|
+ mod_range( presetL, "lwr", 1.0, 1.0, 1.0, 1.0 )
|
|
686
|
+ mod_range( presetL, "cigain", 6.0, 6.0, 6.0, 6.0 )
|
|
687
|
+
|
|
688
|
+ else: # 3/6/17
|
|
689
|
+
|
|
690
|
+ presetL = dupl_preset( dfltPresetL, "g_1_a", dfltLabelsL)
|
|
691
|
+
|
|
692
|
+ mod_range( presetL, "thr", 20.0, 50.0, 20.0, 50.0 ) # offs:65 thr:20-50
|
|
693
|
+ mod_range( presetL, "off", 10.0, 80.0, 10.0, 80.0)
|
|
694
|
+ mod_range( presetL, "upr", -0.7, -0.2, -0.7, -0.2 )
|
|
695
|
+ mod_range( presetL, "lwr", 2.0, 2.0, 8.0, 4.0 )
|
|
696
|
+
|
|
697
|
+ mod_range( presetL, "cigain", 10.0, 14.0, 10.0, 14.0 )
|
|
698
|
+
|
|
699
|
+
|
|
700
|
+ if 0: # 1/14/17 and 1/28/17
|
|
701
|
+
|
|
702
|
+ seq1L =[
|
|
703
|
+ (917, None) # meas 53
|
|
704
|
+ #(1, None) # meas 1
|
|
705
|
+ ]
|
|
706
|
+
|
|
707
|
+ # 2/4/17 vetted for both meas 53 and meas 1
|
|
708
|
+
|
|
709
|
+ # make all presets identical to preset 'a'.
|
|
710
|
+ presetL = dupl_preset( dfltPresetL, "g_1_d", dfltLabelsL)
|
|
711
|
+
|
|
712
|
+ mod_range( presetL, "thr", 20.0, 50.0, 20.0, 50.0 ) # offs:65 thr:20-50
|
|
713
|
+ #mod_range( presetL, "off", 10.0, 80.0, 10.0, 80.0)
|
|
714
|
+ #mod_range( presetL, "off", 65.0, 65.0, 65.0, 65.0) # thr 34, offset should be > 50
|
|
715
|
+ #mod_range( presetL, "off", 50.0, 80.0, 50.0, 80.0)
|
|
716
|
+ mod_range( presetL, "off", 10.0, 80.0, 10.0, 80.0)
|
|
717
|
+ mod_range( presetL, "cigain", 14.0, 14.0, 14.0, 14.0 )
|
|
718
|
+
|
|
719
|
+ if 0: # 1/28/17
|
|
720
|
+
|
|
721
|
+ seq1L =[
|
|
722
|
+ (917, None) # meas 53
|
|
723
|
+ ]
|
|
724
|
+
|
|
725
|
+ # make all presets identical to preset 'a'.
|
|
726
|
+ presetL = dupl_preset( dfltPresetL, "f_3", dfltLabelsL)
|
|
727
|
+
|
|
728
|
+ mod_range( presetL, "thr", 40.0, 90.0, 40.0, 90.0 )
|
|
729
|
+ mod_range( presetL, "upr", 0.0, 0.0, 0.0, 0.0 )
|
|
730
|
+ mod_range( presetL, "lwr", 4.0, 4.0, 4.0, 4.0) # vocal artifacts come in with lwr < 4
|
|
731
|
+ mod_range( presetL, "cigain", 3.0, 8.0, 3.0, 8.0 )
|
|
732
|
+
|
|
733
|
+
|
|
734
|
+ if 0: # 2/4/17
|
|
735
|
+
|
|
736
|
+ seq1L =[
|
|
737
|
+ (378, None), # meas 36
|
|
738
|
+ ]
|
|
739
|
+
|
|
740
|
+ presetL = dupl_preset( dfltPresetL, "g_1_a", dfltLabelsL)
|
|
741
|
+
|
|
742
|
+ mod_range( presetL, "thr", 20.0, 50.0, 20.0, 50.0 ) # offs:65 thr:20-50
|
|
743
|
+ mod_range( presetL, "off", 10.0, 80.0, 10.0, 80.0)
|
|
744
|
+ mod_range( presetL, "upr", -0.7, -0.2, -0.7, -0.2 )
|
|
745
|
+ mod_range( presetL, "lwr", 2.0, 2.0, 8.0, 4.0 )
|
|
746
|
+
|
|
747
|
+ mod_range( presetL, "cigain", 10.0, 14.0, 10.0, 14.0 )
|
|
748
|
+
|
|
749
|
+
|
|
750
|
+
|
|
751
|
+ if 0: # 2/4/17
|
|
752
|
+
|
|
753
|
+ seq1L =[
|
|
754
|
+ (378, "g_1_a"), # meas 36
|
|
755
|
+ (384, None),
|
|
756
|
+ ]
|
|
757
|
+
|
|
758
|
+ presetL = dupl_preset( dfltPresetL, "f_4", dfltLabelsL)
|
|
759
|
+
|
|
760
|
+ mod_range( presetL, "thr", 70.0, 75.0, 70.0, 75.0 )
|
|
761
|
+ mod_range( presetL, "upr", -8.0, -4.0, -8.0, -4.0 )
|
|
762
|
+ mod_range( presetL, "lwr", 8.0, 1.0, 8.0, 1.0)
|
|
763
|
+ mod_range( presetL, "cigain", 10.0, 14.0, 10.0, 14.0 )
|
|
764
|
+
|
|
765
|
+
|
|
766
|
+ if 0:
|
|
767
|
+
|
|
768
|
+ seq1L =[
|
|
769
|
+ (1, None) # meas 1
|
|
770
|
+ ]
|
|
771
|
+
|
|
772
|
+ # 2/4/17 vetted for both meas 53 and meas 1
|
|
773
|
+
|
|
774
|
+ # make all presets identical to preset 'a'.
|
|
775
|
+ presetL = dupl_preset( dfltPresetL, "g_1_d", dfltLabelsL)
|
|
776
|
+
|
|
777
|
+ print "preset len:",len(presetL)
|
|
778
|
+
|
|
779
|
+ w0L = [ 512, 512, 512, 512, 1024, 1024, 1024, 2048, 2048, 4096 ]
|
|
780
|
+ w1L = [ 512, 1024, 2048, 4096, 1024, 2048, 4096, 2048, 4096, 4096 ]
|
|
781
|
+
|
|
782
|
+
|
|
783
|
+
|
|
784
|
+ N = mod_discrete_range( presetL, "win", w0L, w1L )
|
|
785
|
+
|
|
786
|
+ presetL = presetL[0:N]
|
|
787
|
+
|
|
788
|
+ mod_range( presetL, "thr", 40.0, 40.0, 40.0, 40.0 ) # offs:65 thr:20-50
|
|
789
|
+ mod_range( presetL, "off", 55.0, 55.0, 55.0, 55.0)
|
|
790
|
+ mod_range( presetL, "cigain", 14.0, 14.0, 14.0, 14.0 )
|
|
791
|
+
|
|
792
|
+
|
|
793
|
+ if 0: # 3/6/17
|
|
794
|
+
|
|
795
|
+ seq1L =[
|
|
796
|
+ (1, None) # meas 1
|
|
797
|
+ ]
|
|
798
|
+
|
|
799
|
+ presetL = dupl_preset( dfltPresetL, "g_1_d", dfltLabelsL)
|
|
800
|
+
|
|
801
|
+ mod_range( presetL, "thr", 20.0, 50.0, 20.0, 50.0 ) # offs:65 thr:20-50
|
|
802
|
+ mod_range( presetL, "off", 10.0, 80.0, 10.0, 80.0)
|
|
803
|
+ mod_range( presetL, "cigain", 14.0, 14.0, 14.0, 14.0 )
|
|
804
|
+
|
|
805
|
+
|
|
806
|
+ if 0: # 3/6/17
|
|
807
|
+
|
|
808
|
+ seq1L =[
|
|
809
|
+ (1, None) # meas 1
|
|
810
|
+ ]
|
|
811
|
+
|
|
812
|
+
|
|
813
|
+ presetL = dupl_preset( dfltPresetL, "a", dfltLabelsL)
|
|
814
|
+ mod_range( presetL, "thr", 55.0, 65.0, 55.0, 65.0 )
|
|
815
|
+ mod_range( presetL, "upr", -1.0, -5.0, -1.0, -5.0 )
|
|
816
|
+ mod_range( presetL, "lwr", 2.0, 1.0, 2.0, 1.0 )
|
|
817
|
+ mod_range( presetL, "cigain", 6.0, 8.0, 6.0, 8.0 )
|
|
818
|
+
|
|
819
|
+
|
|
820
|
+ if 0: # 3/6/17
|
|
821
|
+
|
|
822
|
+ seq1L =[
|
|
823
|
+ #(1, None) # meas 38
|
|
824
|
+ (476, None)
|
|
825
|
+ ]
|
|
826
|
+
|
|
827
|
+ presetL = dupl_preset( dfltPresetL, "f_4", dfltLabelsL)
|
|
828
|
+
|
|
829
|
+ """
|
|
830
|
+ w0L = [ 512, 512, 512, 512, 1024, 1024, 1024, 2048, 2048, 4096 ]
|
|
831
|
+ w1L = [ 512, 1024, 2048, 4096, 1024, 2048, 4096, 2048, 4096, 4096 ]
|
|
832
|
+
|
|
833
|
+ N = mod_discrete_range( presetL, "win", w0L, w1L )
|
|
834
|
+
|
|
835
|
+ presetL = presetL[0:N]
|
|
836
|
+ """
|
|
837
|
+ if 1:
|
|
838
|
+ mod_range( presetL, "thr", 55.0, 65.0, 55.0, 65.0 )
|
|
839
|
+ mod_range( presetL, "upr", -1.0, -5.0, -1.0, -5.0 )
|
|
840
|
+ mod_range( presetL, "lwr", 2.0, 1.0, 2.0, 1.0 )
|
|
841
|
+ mod_range( presetL, "cigain", 6.0, 8.0, 6.0, 8.0 )
|
|
842
|
+ else:
|
|
843
|
+ mod_range( presetL, "thr", 55.0, 75.0, 55.0, 75.0 )
|
|
844
|
+ mod_range( presetL, "upr", -8.0, -4.0, -8.0, -4.0 )
|
|
845
|
+ mod_range( presetL, "lwr", 8.0, 1.0, 8.0, 1.0)
|
|
846
|
+ mod_range( presetL, "cigain", 10.0, 14.0, 10.0, 14.0 )
|
|
847
|
+
|
|
848
|
+ if 1: # 3/11/17
|
|
849
|
+
|
|
850
|
+ seq1L =[
|
|
851
|
+ (1015, None) # meas 57 (just before section 29)
|
|
852
|
+ #(1068, None) # meas 58 (just before section 29)
|
|
853
|
+ ]
|
|
854
|
+
|
|
855
|
+
|
|
856
|
+ presetL = dupl_preset( dfltPresetL, "g_1_d", dfltLabelsL)
|
|
857
|
+
|
|
858
|
+ # this is a good parameter space - notice that it can
|
|
859
|
+ # generate 4 lines connecting the diagnals of a cube
|
|
860
|
+
|
|
861
|
+ mod_range( presetL, "thr", 10.0, 80.0, 10.0, 80.0 ) # line 1
|
|
862
|
+ mod_range( presetL, "off", 10.0, 99.0, 10.0, 99.0)
|
|
863
|
+
|
|
864
|
+ #mod_range( presetL, "thr", 10.0, 80.0, 10.0, 80.0 ) # line 2
|
|
865
|
+ #mod_range( presetL, "off", 99.0, 10.0, 99.0, 10.0)
|
|
866
|
+
|
|
867
|
+ #mod_range( presetL, "upr", 5.0, -1.5, 5.0, -1.5 )
|
|
868
|
+ mod_range( presetL, "upr", -1.5, 5.0, -1.5, 5.0 )
|
|
869
|
+
|
|
870
|
+ #mod_range( presetL, "lwr", 0.9, 30.0, 0.9, 30.0 )
|
|
871
|
+
|
|
872
|
+ mod_range( presetL, "cigain", 14.0, 14.0, 14.0, 14.0 )
|
|
873
|
+
|
|
874
|
+
|
|
875
|
+
|
|
876
|
+
|
|
877
|
+ # thr upr lwr offs
|
|
878
|
+ # 65 -0.05 1.5 0.0
|
|
879
|
+ # 99.9
|
|
880
|
+ # 65 -0.05 10.0 0.0
|
|
881
|
+ # 99.0
|
|
882
|
+
|
|
883
|
+ with open(fn,"wt") as f:
|
|
884
|
+ f.write("{\n")
|
|
885
|
+
|
|
886
|
+ write_seqs(f,dfltLabelsL,seq1L) # assign seq0L to each sequence
|
|
887
|
+ #write_seqs(f,'a',scoreSeqL); # the only sequence will be 'a'
|
|
888
|
+
|
|
889
|
+ f.write("%s\n" % initPresetStr)
|
|
890
|
+
|
|
891
|
+ write_presets(f,presetL)
|
|
892
|
+
|
|
893
|
+ f.write("}\n")
|
|
894
|
+
|