LUA script for listing basic parameters of controls

Hi,

to avoid long search for “mysterious” behaviour of controls it could be helpful to have a list of their parameters. The following LUA code lists parameter ref number, name, CC and overlayID.

-- get reference numbers of controls and overlays
control_ref = {}
overlay_ref = {}
-- adjust your maximum ref number
maxrefnumber = 100 
for i=1,maxrefnumber do
  if pcall(controls.get, i) then
    table.insert(control_ref, i)
  elseif pcall(overlays.get, i) then
    table.insert(overlay_ref, i)
  end
end
-- list control parameters: ref#, name, CC, overlay# (overlay# = 0 means no overlay !)
print("---------- controls ----------")
contname = {}
contCC = {}
contovl = {}
for i=1,#(control_ref) do
  cname = controls.get(control_ref[i]):getName()
  table.insert(contname, cname)
  cc = controls.get(control_ref[i]):getValue("value"):getMessage():getParameterNumber()
  table.insert(contCC, cc)
  ovl_Id = controls.get(control_ref[i]):getValues()[1]:getOverlayId()
  table.insert(contovl, ovl_Id)
  print(string.format("ref %2d, name: %14s, CC: %3d, overlay: %2d", control_ref[i], cname, cc, ovl_Id))
end

An example (Ableton Wavetable Oscillators):

13:07:21.503 ---- START ----
13:07:21.639 lua: ---------- controls ----------
13:07:21.639 lua: ref  1, name:          OSC 1, CC:   6, overlay:  0
13:07:21.639 lua: ref  7, name:       CATEGORY, CC:   1, overlay:  1
13:07:21.639 lua: ref  8, name:      WAVETABLE, CC:   2, overlay:  2
13:07:21.640 lua: ref  9, name:         EFFECT, CC:   7, overlay:  4
13:07:21.640 lua: ref 10, name:           FX 1, CC:   8, overlay:  0
13:07:21.640 lua: ref 11, name:           FX 2, CC:   9, overlay:  0
13:07:21.640 lua: ref 12, name:           SEMI, CC:  10, overlay:  5
13:07:21.640 lua: ref 13, name:         DETUNE, CC:  11, overlay:  6
13:07:21.641 lua: ref 14, name:            PAN, CC:   3, overlay:  3
13:07:21.641 lua: ref 15, name:           GAIN, CC:   4, overlay:  0
13:07:21.641 lua: ref 16, name:       POSITION, CC:   5, overlay:  0
13:07:21.641 lua: ref 20, name:       CATEGORY, CC:  13, overlay:  1
13:07:21.642 lua: ref 21, name:      WAVETABLE, CC:  14, overlay:  2
13:07:21.642 lua: ref 22, name:            PAN, CC:  15, overlay:  3
13:07:21.642 lua: ref 23, name:           GAIN, CC:  16, overlay:  0
13:07:21.642 lua: ref 24, name:       POSITION, CC:  17, overlay:  0
13:07:21.643 lua: ref 25, name:         EFFECT, CC:  19, overlay:  4
13:07:21.643 lua: ref 26, name:           FX 1, CC:  20, overlay:  0
13:07:21.643 lua: ref 27, name:           FX 2, CC:  21, overlay:  0
13:07:21.643 lua: ref 28, name:           SEMI, CC:  22, overlay:  5
13:07:21.644 lua: ref 29, name:         DETUNE, CC:  23, overlay:  6
13:07:21.644 lua: ref 31, name:          OSC 2, CC:  18, overlay:  0
13:07:21.644 lua: ref 32, name:            SUB, CC:  31, overlay:  0
13:07:21.644 lua: ref 33, name:           GAIN, CC:  32, overlay:  0
13:07:21.645 lua: ref 34, name:           TONE, CC:  33, overlay:  0
13:07:21.645 lua: ref 35, name:         OCTAVE, CC:  34, overlay:  7
13:07:21.645 lua: ref 36, name:      TRANSPOSE, CC:  35, overlay:  8

Regards

Dieter (new member of the forum)

5 Likes

Nice work, thanks , I will certainly use this in my presets (adding at the end, usually quoted away)
I did change the print command into a string with semicolons:
print(string.format(";ref; %2d; name; %14s; CC; %3d; overlay; %2d", control_ref[i], cname, cc, ovl_Id))
and added on top
print(";ref; refNum; name; ctlName; CC; CCnum; overlay; ovrlNum")

this results in :

If you now copy and paste those lines in Notepad and save it as a csv file, you can open it directly in Excel and filter or sort on each column:

This being said, could you enrich your script further ?
It now assumes all parameters are of type CC, which they are not, so adding what parameter type they are is handy.
Adding to it the other attributes of a control (like min, max, color) or a parameter would also be helpful.

1 Like

Hi,

here is the updated core-routine that additionally prints control-type (number), min, max and color.

Remark: the defined tables (for name, parameter number and overlay) are not used at the moment, but can be used for detection of doubles.

print("---------- controls ----------")
contname = {}
contparnum = {}
contovl = {}
print(";ref; refNum; name; ctlName; Type; ctlType; ParNum; parnum; Min; CCMin, Max; CCMax, overlay; ovrlNum; Color; color")
for i=1,#(control_ref) do
  cname = controls.get(control_ref[i]):getName()
  table.insert(contname, cname)
  parnum = controls.get(control_ref[i]):getValue("value"):getMessage():getParameterNumber()
  table.insert(contparnum, parnum)
  type = controls.get(control_ref[i]):getValue("value"):getMessage():getType()
  min = controls.get(control_ref[i]):getValue("value"):getMessage():getMin()
  max = controls.get(control_ref[i]):getValue("value"):getMessage():getMax()
  color = controls.get(control_ref[i]):getColor()
  ovl_Id = controls.get(control_ref[i]):getValues()[1]:getOverlayId()
  table.insert(contovl, ovl_Id)
  print(string.format(";ref; %3d; name; %14s; Type; %d; ParNum; %3d; Min; %3d, Max; %3d; overlay; %2d; color; %X", control_ref[i], cname, type, parnum, min, max, ovl_Id, color))
end
1 Like