-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmicrokorg_xl.lua
4728 lines (4424 loc) · 140 KB
/
microkorg_xl.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
local learning = false
class 'MKMidi' (Midi)
function MKMidi:__init(midi_in_device_name, midi_out_device_name)
Midi.__init(self, midi_in_device_name, midi_out_device_name)
end
function MKMidi:send_sysex(message_template, number, value)
local message = {}
if value < 0 then
value = 0x4000 + value
end
for k,v in pairs(message_template) do
if v == "cc" then
table.insert(message, self.midi_channel-1)
elseif v == "lnn" then
table.insert(message, number%0x80)
elseif v == "hnn" then
table.insert(message, math.floor(number/0x80))
elseif v == "lvv" then
table.insert(message, value%0x80)
elseif v == "hvv" then
table.insert(message, math.floor(value/0x80))
else
table.insert(message, v)
end
end
self:send(message)
end
local old_Group = Group
local function Group(tbl)
local g = old_Group(tbl)
local require_large_group = false
for i, v in ipairs(g.children) do
v.group = g
if v.require_large_group then
require_large_group = v.require_large_group
end
end
if require_large_group then
g.create_ui = function (self)
local ret = old_Group.create_ui(self)
ret.height = self.synth_definition.content_height - 50
g.ui = ret
return ret
end
end
return g
end
local old_Parameter = Parameter
local function Parameter(tbl)
local p = old_Parameter(tbl)
p.rev_value_callback = tbl.rev_value_callback
p.send_midi = function (self)
if self.enabled ~= false then
old_Parameter.send_midi(self)
end
-- Work-around for a bug in Guru
self.value = self.patch_document_variable.value
end
p.to_notify = {}
p.refresh = function (self)
for i, id in ipairs(self.to_notify) do
local p = self.synth_definition.parameters[id]
local params = {}
for i, v in ipairs(p.notify_visibility) do
table.insert(params, self.synth_definition.parameters[v])
end
local old = p.enabled
p.enabled = p.visibility(unpack(params))
p.ui.visible = p.enabled
p.group.ui.height = self.synth_definition.content_height
self.synth_definition.dialog_content.height = self.synth_definition.orig_height
if old ~= p.enabled then
if p.enabled and not self.synth_definition.is_loading then
p:send_midi()
end
end
end
end
p.set_value = function (self, value)
local ret = old_Parameter.set_value(self, value)
self:refresh()
return ret
end
p.ui_set_value = function (self, value)
local ret = old_Parameter.ui_set_value(self, value)
self:refresh()
return ret
end
p.vf_set_value = function (self, value)
local ret = old_Parameter.vf_set_value(self, value)
self:refresh()
return ret
end
p.create_ui = function (self)
local ret = old_Parameter.create_ui(self)
self.ui = ret
ret.visible = self.enabled
return ret
end
p.initialize = function (self, ...)
old_Parameter.initialize(self, ...)
if self.notify_visibility ~= nil and self.visibility ~= nil then
for i, v in ipairs(self.notify_visibility) do
if self.synth_definition.parameters[v] == nil then
print(("Wrong id '%s'"):format(v))
end
table.insert(self.synth_definition.parameters[v].to_notify, self.id)
end
self.enabled = false
else
self.enabled = true
end
end
p.notify_visibility = tbl.notify_visibility
p.visibility = tbl.visibility
p.require_large_group = tbl.notify_visibility ~= nil and tbl.visibility ~= nil
return p
end
class 'MKDefinition' (SynthDefinition)
function print_diff(old, new)
assert(#old, #new)
for i, v in ipairs(old) do
if new[i] ~= v then
print(("Changed 0x%02x from %02x to %02x"):format(i, v, new[i]))
end
end
end
function print_dump(message)
print(string.char(unpack(message, 1, 9)))
for i = 0, #message/8-1 do
local line = ("%02x|%02x %02x %02x %02x %02x %02x %02x %02x"):format(i, unpack(message, 1+8*i, 8+8*i))
print(line)
end
local lastline = ("%02x|"):format(#message/8)
for k = 1,#message%8 do
lastline = lastline .. ("%02x "):format(message[k+8*math.floor(#message/8)])
end
print(lastline)
end
function MKDefinition:decode_data(message)
assert(message[1] == 0xF0 and message[#message] == 0xF7)
local encoded = {}
for i = 6, #message-1 do
encoded[i-5] = message[i]
end
local out = {}
for i, v in ipairs(encoded) do
if i%8 == 1 then
for j = 1, 8 do
if v%2 == 1 then
out[7*(i-1)/8+j] = 0x80
else
out[7*(i-1)/8+j] = 0x00
end
v = math.floor(v / 2)
end
else
out[i-math.floor((i+7)/8)] = out[i-math.floor((i+7)/8)] + v
end
end
return out
end
function MKDefinition:got_input(message)
if message[1] == 0xF0 then
self.buffer = nil
if message[#message] == 0xF7 then
self:receive_sysex(message)
else
self. buffer = {}
for i, v in ipairs(message) do
self.buffer[i] = v
end
end
else
assert(self.buffer ~= nil)
local os = #(self.buffer)
for i, v in ipairs(message) do
self.buffer[os+i] = v
end
if self.buffer[#(self.buffer)] == 0xF7 then
message = self.buffer
self.buffer = nil
self:receive_sysex(message)
end
end
end
function MKDefinition:__init(tbl)
self.event_root = {}
self.data_map = tbl.data_map
self.data_map_keys = {}
for k, v in pairs(self.data_map) do
table.insert(self.data_map_keys, k)
end
table.sort(self.data_map_keys)
self.known_data_map = {}
self.tool = renoise.tool()
SynthDefinition.__init(self, tbl)
end
function MKDefinition:create_ui()
local ui = SynthDefinition.create_ui(self)
self.orig_height = ui.height
return ui
end
function MKDefinition:receive_midi(message)
if message[1] >= 0xC0 and message[1] <= 0xCF then
-- program change
self:refresh_data()
end
end
function MKDefinition:refresh_data_callback()
self.tool:remove_timer({self, MKDefinition.refresh_data_callback})
self.midi.midi_out_device:send({0xF0, 0x42, 0x30, 0x7e, 0x10, 0xF7})
end
function MKDefinition:refresh_data()
if self.tool:has_timer({self, MKDefinition.refresh_data_callback}) then
self.tool:remove_timer({self, MKDefinition.refresh_data_callback})
end
self.tool:add_timer({self, MKDefinition.refresh_data_callback},
300)
end
function MKDefinition:receive_sysex(message)
local params = self:find_param_from_sysex(message)
if params ~= nil then
local found_one_enabled = false
for y, param in ipairs(params) do
local enabled = param.enabled
local ok = true
if enabled ~= nil then
ok = enabled
end
if ok then
if self.known_data_map[param.id] == nil and learning then
print("Missing data map for ".. param.id)
self:refresh_data()
end
found_one_enabled = true
assert(#(param.sysex_message_template) == #message)
local vv = 0
for i, v in ipairs(param.sysex_message_template) do
if v == "lvv" then
vv = vv + message[i]
elseif v == "hvv" then
vv = vv + 0x80*message[i]
end
end
if vv >= 0x2000 then
vv = vv - 0x4000
end
local item_values = param.item_values
if item_values ~= nil then
for j, x in ipairs(item_values) do
if x == vv then
if param.value ~= j then
param:set_value(j)
end
break
end
end
else
local rev = param.rev_value_callback
if rev ~= nil then
local new_v = rev(vv)
if param.value ~= new_v then
param:set_value(new_v)
end
else
if param.value ~= vv then
param:set_value(vv)
end
end
end
end
end
if not found_one_enabled then
self:refresh_data()
local s = {}
for i, v in ipairs(message) do
s[i] = ("%02x"):format(v)
end
print(unpack(s))
end
else
assert(message[#message] == 0xF7)
local recognized = true
local header = {0xF0, 0x42, 0x30, 0x7e, 0x40}
for i, v in ipairs(header) do
if message[i] ~= v then
recognized = false
break
end
end
if recognized then
self.is_loading = true
local data = self:decode_data(message)
for i, k in ipairs(self.data_map_keys) do
local v = self.data_map[k]
if type(v) == "string" then
if self.parameters[v] == nil then
print(("Bad parameter '%s'"):format(v))
else
if self.parameters[v].min_value < 0 then
print(("Not expecting a string for '%s'"):format(v))
end
self.known_data_map[self.parameters[v].id] = true
local enabled = self.parameters[v].enabled
local ok = true
if enabled ~= nil then
ok = enabled
end
if ok then
local item_values = self.parameters[v].item_values
if item_values ~= nil then
for j, x in ipairs(item_values) do
if x == data[k] then
if self.parameters[v].value ~= j then
self.parameters[v]:set_value(j)
end
break
end
end
else
if self.parameters[v].value ~= data[k] then
self.parameters[v]:set_value(data[k])
end
end
end
end
else
for q, w in ipairs(v(data[k], data)) do
if self.parameters[w[1]] == nil then
print(("Bad parameter '%s'"):format(w[1]))
else
self.known_data_map[w[1]] = true
local enabled = self.parameters[w[1]].enabled
local ok = true
if enabled ~= nil then
ok = enabled
end
if ok then
local item_values = self.parameters[w[1]].item_values
if item_values ~= nil then
for j, x in ipairs(item_values) do
if x == w[2] then
if self.parameters[w[1]].value ~= j then
self.parameters[w[1]]:set_value(j)
end
break
end
end
else
if self.parameters[w[1]].value ~= w[2] then
self.parameters[w[1]]:set_value(w[2])
end
end
end
end
end
end
end
self.is_loading = false
if learning then
--print_dump(data)
if self.old_data ~= nil then
print_diff(self.old_data, data)
end
self.old_data = data
end
elseif learning then
local s = {}
for i, v in ipairs(message) do
s[i] = ("%02x"):format(v)
end
print(unpack(s))
self:refresh_data()
end
end
end
function MKDefinition:add_event_parser(message, param)
local cur = self.event_root
for i, v in ipairs(message) do
if v == "cc" then
v = self.midi.midi_channel-1
elseif v == "hnn" then
v = math.floor(param.number/0x80)
elseif v == "lnn" then
v = param.number%0x80
end
if cur[v] == nil then
cur[v] = {}
end
cur = cur[v]
end
if cur["parameters"] == nil then
cur["parameters"] = {param}
else
cur["parameters"][1+#(cur["parameters"])] = param
end
end
function MKDefinition:find_param_from_sysex_rec(message, pos, cur)
if pos > #message then
return cur["parameters"]
end
local next = cur[message[pos]]
if next ~= nil then
local ret = self:find_param_from_sysex_rec(message, pos+1, next)
if ret ~= nil then
return ret
end
end
next = cur["hvv"]
if next ~= nil then
return self:find_param_from_sysex_rec(message, pos+1, next)
end
next = cur["lvv"]
if next ~= nil then
return self:find_param_from_sysex_rec(message, pos+1, next)
end
return nil
end
function MKDefinition:find_param_from_sysex(message)
return self:find_param_from_sysex_rec(message, 1, self.event_root)
end
function MKDefinition:collect_parameters(node)
if type(node) == "Parameter" then
self:add_event_parser(node.sysex_message_template, node)
return
end
if node.children ~= nil then
for i, child in ipairs(node.children) do
self:collect_parameters(child)
end
end
end
function MKDefinition:initialize()
SynthDefinition.initialize(self)
self:collect_parameters(self)
end
function MKDefinition:init_midi()
local midi_out_device = self.preferences.midi_out_device_name.value
local midi_in_device = self.preferences.midi_in_device_name.value
if midi_out_device == nil then
midi_out_device = guru.preferences.midi_out_device_name.value
end
if midi_in_device == nil then
midi_in_device = guru.preferences.midi_in_device_name.value
end
self.midi = MKMidi(midi_in_device, midi_out_device)
self.midi:set_midi_channel(self.preferences.midi_out_channel.value)
local found = false
for i, v in ipairs(renoise.Midi.available_input_devices()) do
if self.midi.midi_in_device_name == v then
found = true
end
end
if not found then
self.midi.midi_in_device_name = renoise.Midi.available_input_devices()[1]
end
self.midi_in_device = renoise.Midi.create_input_device(self.midi.midi_in_device_name,
{self, self.receive_midi},
{self, self.got_input})
end
function range(from, to)
local out = {}
for i = 1, to-from+1 do
out[i] = from+i-1
end
return out
end
local knob_values = {"none", "portamento", "osc1 c1", "osc1 c2", "osc2 semi",
"osc2 tune", "osc1 lvl", "osc2 lvl", "noise lvl", "cutoff1", "reso1",
"filt1 bal", "eg1 int1", "cutoff2", "reso2", "eg1 int2", "level",
"panpot", "ws depth", "attack1", "decay1", "sustain1", "release1",
"attack2", "decay2", "sustain2", "release2",
"lfo1 freq", "lfo2 freq", "p int1", "p int2", "p int3", "p int4", "p int5",
"p int6", "hi eq gain", "lo eq gain", "fx1 D/W", "fx1 ctrl1",
"fx1 ctrl2", "fx2 D/W", "fx2 ctrl1", "fx2 ctrl2", "gate time",
"oct range", "arp swing", "vc t1 lvl", "vc t2 lvl",
"vc hpf lvl", "vc fc ofst", "vc reso", "vc ef sens",
"vc fc mint", "vc dir lvl", "vc level"}
local patch_sources = {"EG1", "EG2", "EG3",
"LFO1", "LFO2", "velocity",
"p bend", "mod wheel",
"key track", "MIDI 1", "MIDI 2", "MIDI 3"}
local patch_dests = {"pitch", "osc2 tune", "osc1 c1", "osc1 level",
"osc2 level", "noise level", "filt1 bal",
"cutoff1", "reso1", "cutoff2", "ws depth",
"level", "panpot", "lfo1 freq",
"lfo2 freq", "portamento", "osc1 c2", "eg1 int1",
"key track 1", "reso 2", "eg1 int2", "key track 2",
"attack1", "decay1", "sustain1", "release1",
"attack2", "decay2", "sustain2", "release2",
"attack3", "decay3", "sustain3", "release3",
"p int1", "p int2", "p int3", "p int4", "p int5", "p int6"}
local fx_types = {"off", "compressor", "filter", "band eq", "distortion",
"decimator", "delay", "lcr delay", "pan delay", "mod delay",
"tape echo", "chorus", "flanger", "vibrato",
"phaser", "tremolo", "ring mod", "grain sft"}
local sync_notes = {"8/1", "4/1", "2/1", "1/1", "3/4", "1/2", "3/8", "1/4", "3/16", "1/6",
"1/12", "1/16", "1/24", "1/32", "1/64"}
function get_timbre_sections(timbre)
local old_Parameter = Parameter
local function Parameter(tbl)
tbl.id = tbl.id .. ("_%d"):format(timbre)
if tbl.notify_visibility ~= nil then
for i, v in ipairs(tbl.notify_visibility) do
tbl.notify_visibility[i] = ("%s_%d"):format(v, timbre)
end
end
return old_Parameter(tbl)
end
local r = {Section {
sysex_message_template = {0xF0, 0x42, 0x30, 0x7e, 0x41, 0x10 + timbre, 0x00, "lnn", "hnn", "lvv", "hvv", 0xF7},
name = ("Timbre %d osc"):format(timbre),
Group {
name = "Voice",
Parameter {
name = "Assign",
id = "assign_voice",
items = {"mono 1", "mono 2", "poly"},
item_values = range(0, 2),
default_value = 3,
number = 0x0b,
},
},
Group {
name = "Unisson",
Parameter {
name = "Mode",
id = "unisson_mode",
number = 0x08,
items = {"off", "2 voice", "3 voice", "4 voice"},
item_values = range(0, 3),
},
Parameter {
name = "Detune",
id = "unisson_detune",
number = 0x09,
default_value = 0,
max_value = 0x63,
},
Parameter {
name = "Spread",
id = "unisson_spread",
number = 0x0a,
default_value = 0,
max_value = 0xf7,
},
},
Group {
name = "Pitch",
Parameter {
name = "Analog tune",
id = "analog_tune",
max_value = 0x7f,
number = 0x13,
},
Parameter {
name = "Transpose",
min_value = -48,
max_value = 48,
default_value = 0,
id = "transpose",
number = 0x14,
},
Parameter {
name = "Detune",
min_value = -50,
max_value = 50,
default_value = 0,
id = "detune",
number = 0x15,
},
Parameter {
name = "Vib int",
id = "vib_int",
number = 0x16,
min_value = -63,
max_value = 63,
default_value = 10,
},
Parameter {
name = "P bend",
id = "p_bend",
number = 0x10,
min_value = -12,
max_value = 12,
default_value = 2,
},
Parameter {
name = "Portamento",
id = "portamento",
number = 0x11,
min_value = 0,
max_value = 127,
default_value = 0,
},
},
Group {
name = "Oscillator 1",
Parameter {
name = "Wave",
id = "wave_1",
items = {"saw", "pulse", "triangle", "sine", "formant",
"noise", "pcm/dwgs", "audio in",},
item_values = range(0, 7),
number = 0x17,
},
Parameter {
name = "Osc mod",
id = "osc_mod_1",
items = {"waveform", "cross", "unisson", "vpm"},
item_values = range(0, 3),
number = 0x18,
},
Parameter {
name = "Waveform (C1)",
id = "osc1_waveform",
max_value = 127,
number = 0x19,
notify_visibility = {"wave_1", "osc_mod_1"},
visibility = function (wave, osc_mod)
return (wave.value == 1 or wave.value == 3) and osc_mod.value == 1
end
},
Parameter {
name = "Wave shape (C1)",
id = "osc1_wave_shape",
max_value = 127,
number = 0x19,
notify_visibility = {"wave_1", "osc_mod_1"},
visibility = function (wave, osc_mod)
return wave.value == 4 and osc_mod.value == 1
end
},
Parameter {
name = "Pulse width (C1)",
id = "osc1_pulse_width",
max_value = 127,
number = 0x19,
notify_visibility = {"wave_1", "osc_mod_1"},
visibility = function (wave, osc_mod)
return wave.value == 2 and osc_mod.value == 1
end
},
Parameter {
name = "Formant width (C1)",
id = "osc1_formant_width",
max_value = 127,
number = 0x19,
notify_visibility = {"wave_1", "osc_mod_1"},
visibility = function (wave, osc_mod)
return wave.value == 5 and osc_mod.value == 1
end
},
Parameter {
name = "Formant width (C2)",
id = "osc1_formant_sft",
max_value = 63,
min_value = -63,
default_value = 0,
number = 0x1a,
notify_visibility = {"wave_1", "osc_mod_1"},
visibility = function (wave, osc_mod)
return wave.value == 5 and osc_mod.value == 1
end
},
Parameter {
name = "Reso (C1)",
id = "osc1_reso",
max_value = 127,
number = 0x19,
notify_visibility = {"wave_1", "osc_mod_1"},
visibility = function (wave, osc_mod)
return wave.value == 6 and osc_mod.value == 1
end
},
Parameter {
name = "Bal (C2)",
id = "osc1_bal",
max_value = 63,
min_value = -63,
default_value = 0,
number = 0x1a,
notify_visibility = {"wave_1", "osc_mod_1"},
visibility = function (wave, osc_mod)
return wave.value == 6 and osc_mod.value == 1
end
},
Parameter {
name = "Gain (C1)",
id = "osc1_gain",
max_value = 63,
min_value = -63,
default_value = 0,
number = 0x19,
notify_visibility = {"wave_1", "osc_mod_1"},
visibility = function (wave, osc_mod)
return wave.value == 8 and osc_mod.value == 1
end
},
Parameter {
name = "Detune (C1)",
id = "osc1_detune",
max_value = 127,
number = 0x19,
notify_visibility = {"wave_1", "osc_mod_1"},
visibility = function (wave, osc_mod)
return (wave.value == 1 or wave.value == 2 or wave.value == 3 or wave.value == 4) and osc_mod.value == 3
end
},
Parameter {
name = "Mod depth (C1)",
id = "osc1_mod_depth",
max_value = 127,
number = 0x19,
notify_visibility = {"wave_1", "osc_mod_1"},
visibility = function (wave, osc_mod)
return (wave.value == 1 or wave.value == 2 or wave.value == 3 or wave.value == 4) and (osc_mod.value == 2 or osc_mod.value == 4)
end
},
Parameter {
name = "LFO mod depth (C2)",
id = "osc1_lfo1_mod_depth",
max_value = 127,
number = 0x1a,
notify_visibility = {"wave_1", "osc_mod_1"},
visibility = function (wave, osc_mod)
return (wave.value == 1 or wave.value == 2 or wave.value == 3 or wave.value == 4) and (osc_mod.value == 1 or osc_mod.value == 2)
end
},
Parameter {
name = "Phase (C2)",
id = "osc1_phase",
max_value = 127,
number = 0x1a,
notify_visibility = {"wave_1", "osc_mod_1"},
visibility = function (wave, osc_mod)
return (wave.value == 1 or wave.value == 2 or wave.value == 3 or wave.value == 4) and osc_mod.value == 3
end
},
Parameter {
name = "Harmonic (C2)",
id = "osc1_harmonic",
max_value = 127,
number = 0x1a,
notify_visibility = {"wave_1", "osc_mod_1"},
visibility = function (wave, osc_mod)
return (wave.value == 1 or wave.value == 2 or wave.value == 3 or wave.value == 4) and osc_mod.value == 4
end
},
Parameter {
name = "Wave sel (C2)",
id = "osc1_sample",
items = {"ac piano", "rose ep", "wurly ep", "vpm ep1", "vpm ep2",
"clav 1", "clav 2", "clav 3",
"organ 1", "organ 2", "organ 3", "m1 organ", "full organ",
"vox organ",
"pipe organ", "strings", "brass",
"guitar 1", "guitar 2", "bass 1", "bass 2", "bass 3",
"bell 1", "bell 2", "bell 3",
"synpad 1", "synpad 2", "synpad 3",
"synsine 1", "synsine 2", "synsine 3", "synsine 4",
"synsine 5", "synsine 6", "synsine 7",
"synwave 1", "synwave 2", "synwave 3", "synwave 4",
"synwave 5", "synwave 6", "synwave 7",
"synwire 1", "synwire 2", "synwire 3", "synwire 4",
"5th saw", "5th square",
"digi 1", "digi 2", "digi 3", "digi 4", "digi 5",
"digi 6", "digi 7", "digi 8", "digi 9",
"synvox 1", "synvox 2", "endless",
"noise 1", "noise 2", "noise 3", "noise 4"},
item_values = range(0, 0x3f),
number = 0x1b,
notify_visibility = {"wave_1", "osc_mod_1"},
visibility = function (wave, osc_mod)
return wave.value == 7 and osc_mod.value == 1
end
},
},
Group {
name = "Oscillator 2",
Parameter {
name = "Wave",
id = "wave_2",
items = {"saw", "pulse", "triangle", "sine"},
item_values = range(0, 3),
number = 0x20,
},
Parameter {
name = "Osc mod",
id = "osc_mod_2",
items = {"off", "ring", "sync", "ring+sync"},
item_values = range(0, 3),
number = 0x21,
},
Parameter {
name = "Semitone",
id = "osc2_semi",
max_value = 24,
min_value = -24,
default_value = 0,
number = 0x22,
},
Parameter {
name = "Tune",
id = "osc2_tune",
max_value = 63,
min_value = -63,
default_value = 0,
number = 0x23,
},
},
Group {
name = "mixer",
Parameter {
name = "Osc1",
id = "osc1_lvl",
max_value = 127,
default_value = 127,
number = 0x28,
},
Parameter {
name = "Osc2",
id = "osc2_lvl",
max_value = 127,
number = 0x29,
},
Parameter {
name = "Noise",
id = "noise_lvl",
max_value = 127,
number = 0x2a,
},
Parameter {
name = "Punch",
id = "punch_lvl",
max_value = 127,
number = 0x57,
},
},
Group {
name = "Drive/WS",
Parameter {
name = "Type",
id = "drive_type",
items = {"off", "drive", "decimator", "hard clip", "oct saw", "multi tri",
"multi sin", "sb psc saw", "sb psc tri", "sb psc sin",
"lvl boost"},
item_values = range(0, 10),
number = 0x51,
},
Parameter {
name = "Position",
id = "drive_position",
items = {"pre filt1", "pre amp"},
item_values = {0, 1},
number = 0x52,
},
Parameter {
name = "Depth",
id = "drive_depth",
max_value = 127,
number = 0x54,
},
}
},
Section {
name = ("Timbre %d filters"):format(timbre),
sysex_message_template = {0xF0, 0x42, 0x30, 0x7e, 0x41, 0x10 + timbre, 0x00, "lnn", "hnn", "lvv", "hvv", 0xF7},
Group {
name = "Filter 1",
Parameter {
name = "Cutoff",
id = "filt1_cutoff",
max_value = 127,
number = 0x32,
},
Parameter {
name = "Resonance",
id = "filt1_reso",
max_value = 127,
number = 0x33,
},
Parameter {
name = "Type",
id = "filt1_type",
max_value = 127,
default_value = 127,
number = 0x31,
},
Parameter {
name = "EG1 int",
id = "filt1_eg1_int",
max_value = 63,
min_value = -63,
default_value = 0,
number = 0x34,
},
Parameter {
name = "Key track",
id = "filt1_key_track",
max_value = 63,
min_value = -63,
default_value = 0,
number = 0x35,
},
Parameter {
name = "Vel. sens.",
id = "filt1_vel_sens",
max_value = 63,
min_value = -63,
default_value = 0,
number = 0x36,
},
Parameter {
name = "Routing",
id = "routing",
items = {"single", "serial", "parallel", "indiv"},
item_values = range(0, 3),
number = 0x30,
},
},
Group {
name = "Filter 2",
Parameter {
name = "Cutoff",
id = "filt2_cutoff",
max_value = 127,
number = 0x42,
},
Parameter {
name = "Resonance",