[SOLVED] Using A For Loop For Good

Here’s a handy(but also rough, since it gives an error) way of listing the available parameters for a plugin using a for-loop.

  
for i=1,6000 do oprint (renoise.song().selected_track.devices[2].parameters[i].name) end  
  

I got this list for Pro-Q:

  
>>> for i=1,6000 do oprint (renoise.song().selected_track.devices[2].parameters[i].name) end  
Num Active Bands  
Band 1 Frequency  
Band 1 Gain  
Band 1 Q  
Band 1 Shape  
Band 1 LP/HP Slope  
Band 1 Stereo Placement  
Band 1 Enabled  
Band 2 Frequency  
Band 2 Gain  
Band 2 Q  
Band 2 Shape  
Band 2 LP/HP Slope  
Band 2 Stereo Placement  
Band 2 Enabled  
Band 3 Frequency  
Band 3 Gain  
Band 3 Q  
Band 3 Shape  
Band 3 LP/HP Slope  
Band 3 Stereo Placement  
Band 3 Enabled  
Band 4 Frequency  
Band 4 Gain  
Band 4 Q  
Band 4 Shape  
Band 4 LP/HP Slope  
Band 4 Stereo Placement  
Band 4 Enabled  
Band 5 Frequency  
Band 5 Gain  
Band 5 Q  
Band 5 Shape  
Band 5 LP/HP Slope  
Band 5 Stereo Placement  
Band 5 Enabled  
Band 6 Frequency  
Band 6 Gain  
Band 6 Q  
Band 6 Shape  
Band 6 LP/HP Slope  
Band 6 Stereo Placement  
Band 6 Enabled  
Band 7 Frequency  
Band 7 Gain  
Band 7 Q  
Band 7 Shape  
Band 7 LP/HP Slope  
Band 7 Stereo Placement  
Band 7 Enabled  
Band 8 Frequency  
Band 8 Gain  
Band 8 Q  
Band 8 Shape  
Band 8 LP/HP Slope  
Band 8 Stereo Placement  
Band 8 Enabled  
Band 9 Frequency  
Band 9 Gain  
Band 9 Q  
Band 9 Shape  
Band 9 LP/HP Slope  
Band 9 Stereo Placement  
Band 9 Enabled  
Band 10 Frequency  
Band 10 Gain  
Band 10 Q  
Band 10 Shape  
Band 10 LP/HP Slope  
Band 10 Stereo Placement  
Band 10 Enabled  
Band 11 Frequency  
Band 11 Gain  
Band 11 Q  
Band 11 Shape  
Band 11 LP/HP Slope  
Band 11 Stereo Placement  
Band 11 Enabled  
Band 12 Frequency  
Band 12 Gain  
Band 12 Q  
Band 12 Shape  
Band 12 LP/HP Slope  
Band 12 Stereo Placement  
Band 12 Enabled  
Band 13 Frequency  
Band 13 Gain  
Band 13 Q  
Band 13 Shape  
Band 13 LP/HP Slope  
Band 13 Stereo Placement  
Band 13 Enabled  
Band 14 Frequency  
Band 14 Gain  
Band 14 Q  
Band 14 Shape  
Band 14 LP/HP Slope  
Band 14 Stereo Placement  
Band 14 Enabled  
Band 15 Frequency  
Band 15 Gain  
Band 15 Q  
Band 15 Shape  
Band 15 LP/HP Slope  
Band 15 Stereo Placement  
Band 15 Enabled  
Band 16 Frequency  
Band 16 Gain  
Band 16 Q  
Band 16 Shape  
Band 16 LP/HP Slope  
Band 16 Stereo Placement  
Band 16 Enabled  
Band 17 Frequency  
Band 17 Gain  
Band 17 Q  
Band 17 Shape  
Band 17 LP/HP Slope  
Band 17 Stereo Placement  
Band 17 Enabled  
Band 18 Frequency  
Band 18 Gain  
Band 18 Q  
Band 18 Shape  
Band 18 LP/HP Slope  
Band 18 Stereo Placement  
Band 18 Enabled  
Band 19 Frequency  
Band 19 Gain  
Band 19 Q  
Band 19 Shape  
Band 19 LP/HP Slope  
Band 19 Stereo Placement  
Band 19 Enabled  
Band 20 Frequency  
Band 20 Gain  
Band 20 Q  
Band 20 Shape  
Band 20 LP/HP Slope  
Band 20 Stereo Placement  
Band 20 Enabled  
Band 21 Frequency  
Band 21 Gain  
Band 21 Q  
Band 21 Shape  
Band 21 LP/HP Slope  
Band 21 Stereo Placement  
Band 21 Enabled  
Band 22 Frequency  
Band 22 Gain  
Band 22 Q  
Band 22 Shape  
Band 22 LP/HP Slope  
Band 22 Stereo Placement  
Band 22 Enabled  
Band 23 Frequency  
Band 23 Gain  
Band 23 Q  
Band 23 Shape  
Band 23 LP/HP Slope  
Band 23 Stereo Placement  
Band 23 Enabled  
Band 24 Frequency  
Band 24 Gain  
Band 24 Q  
Band 24 Shape  
Band 24 LP/HP Slope  
Band 24 Stereo Placement  
Band 24 Enabled  
Output Gain  
Output Pan  
Display Range  
Process Mode  
Channel Mode  
Bypass  
Receive Midi  
Analyzer  
Analyzer Resolution  
Analyzer Speed  
Solo Band  
Ex Band 1 Shape  
Ex Band 2 Shape  
Ex Band 3 Shape  
Ex Band 4 Shape  
Ex Band 5 Shape  
Ex Band 6 Shape  
Ex Band 7 Shape  
Ex Band 8 Shape  
Ex Band 9 Shape  
Ex Band 10 Shape  
Ex Band 11 Shape  
Ex Band 12 Shape  
Ex Band 13 Shape  
Ex Band 14 Shape  
Ex Band 15 Shape  
Ex Band 16 Shape  
Ex Band 17 Shape  
Ex Band 18 Shape  
Ex Band 19 Shape  
Ex Band 20 Shape  
Ex Band 21 Shape  
Ex Band 22 Shape  
Ex Band 23 Shape  
Ex Band 24 Shape  
Ex Display Range  
Ex Analyzer  
  

Now, why would this be interesting? Well, it was a way of finding out the number and name of the Ex Analyzer (to be able to set the visualizer on in FabFilter Pro-Q, something which loading-a-preset from renoise or from inside Pro-Q did not do. So there’s an arcane thing going wrong in a plugin, you can fix it up by setting the value to that which you like, when you start the plugin via LUA.

This snippet on the other hand pastes in 34 instances of Waldorf D-Pole Filter VST.
for i=2,35 do renoise.song().selected_track:insert_device_at(“Audio/Effects/VST/D-Pole”, i) end

We start from 2 instead of 1 because 1 is TrackVolPanWidth thing.

There’s a total of 35 Native-to-Renoise FX (2.7.2, Sep 21 2011) available when one does a listing:

  
>>> oprint (renoise.song().selected_track.available_devices)  
table: 0x33afb90  
  

So since the available_devices is a table:

  
>>> rprint (renoise.song().selected_track.available_devices)  
[1] => Audio/Effects/Native/Bus Compressor  
[2] => Audio/Effects/Native/Cabinet Simulator  
[3] => Audio/Effects/Native/Chorus  
[4] => Audio/Effects/Native/Comb Filter  
[5] => Audio/Effects/Native/Compressor  
[6] => Audio/Effects/Native/DC Offset  
[7] => Audio/Effects/Native/Delay  
[8] => Audio/Effects/Native/Distortion  
[9] => Audio/Effects/Native/EQ 10  
[10] => Audio/Effects/Native/EQ 5  
[11] => Audio/Effects/Native/Filter  
[12] => Audio/Effects/Native/Flanger  
[13] => Audio/Effects/Native/Gainer  
[14] => Audio/Effects/Native/Gate  
[15] => Audio/Effects/Native/LofiMat  
[16] => Audio/Effects/Native/Maximizer  
[17] => Audio/Effects/Native/Mixer EQ  
[18] => Audio/Effects/Native/mpReverb  
[19] => Audio/Effects/Native/Phaser  
[20] => Audio/Effects/Native/Reverb  
[21] => Audio/Effects/Native/RingMod  
[22] => Audio/Effects/Native/Scream Filter  
[23] => Audio/Effects/Native/Stereo Expander  
[24] => Audio/Effects/#Receive/#Line Input  
[25] => Audio/Effects/#Receive/#ReWire Input  
[26] => Audio/Effects/#Send/#Multiband Send  
[27] => Audio/Effects/#Send/#Send  
[28] => Audio/Effects/*Meta/*Hydra  
[29] => Audio/Effects/*Meta/*Instr. Automation  
[30] => Audio/Effects/*Meta/*Instr. MIDI Control  
[31] => Audio/Effects/*Meta/*Key Tracker  
[32] => Audio/Effects/*Meta/*LFO  
[33] => Audio/Effects/*Meta/*Signal Follower  
[34] => Audio/Effects/*Meta/*Velocity Tracker  
[35] => Audio/Effects/*Meta/*XY Pad  
  
``` .  
  
I hope it'll one day be possible to do a for-loop which displays all of the parameter names + parameter numbers of all of the native fx, so in a way i guess you can see why tried to load 35 instances of something.

That day is today!

  
local rns = renoise.song() --Shortcut  
local all_params = { } -- Where we store our info  
  
-- Loop effects  
local number_of_effects = #rns.selected_track.available_devices  
for i=1,number_of_effects do  
 -- Get name  
 local current_device_name = rns.selected_track.available_devices[i]  
 all_params[current_device_name] = { }  
 -- Insert at position 2  
 rns.selected_track:insert_device_at(current_device_name, 2)   
 -- Loop params  
 local number_of_params = #rns.selected_track.devices[2].parameters   
 for j=1,number_of_params do   
 -- Insert into our info table  
 table.insert(all_params[current_device_name], rns.selected_track.devices[2].parameters[j].name)   
 end  
 -- Delete (save memory)  
 rns.selected_track:delete_device_at(2)  
end  
  
-- Dump info  
rprint(all_params)  
  

Not very practical, though. :)

1 Like

OK, I just realized this was the beginners forum. I thought it was a regular question. Sorry. Hope I didn’t annoy anyone with my code dump.

Keep it up coders!

Used to use that VST in pretty much every one of my projects before it became clear it wasn’t actually freeware/shareware and then when I tried to find it to see if it was an affordable buy found it had been discontinued so I couldn’t even buy it when I tried. I do like the sound though, even if you have to be careful to bring the output down in level if you bring the overdrive up ;)

your master code made me cry, i now feel discouraged to ever try lua coding again. you’ve ruined my life. thank you, i am a better person now.

Hiya, ripping off some code from here

results in this
:

  
for i,v in ipairs(renoise.song().selected_track.available_devices) do print (i .. "_" .. v) end  
1_Audio/Effects/Native/Bus Compressor  
2_Audio/Effects/Native/Cabinet Simulator  
3_Audio/Effects/Native/Chorus  
4_Audio/Effects/Native/Comb Filter  
5_Audio/Effects/Native/Compressor  
6_Audio/Effects/Native/DC Offset  
7_Audio/Effects/Native/Delay  
8_Audio/Effects/Native/Distortion  
9_Audio/Effects/Native/EQ 10  
10_Audio/Effects/Native/EQ 5  
11_Audio/Effects/Native/Filter  
12_Audio/Effects/Native/Flanger  
13_Audio/Effects/Native/Gainer  
14_Audio/Effects/Native/Gate  
15_Audio/Effects/Native/LofiMat  
16_Audio/Effects/Native/Maximizer  
17_Audio/Effects/Native/Mixer EQ  
18_Audio/Effects/Native/mpReverb  
19_Audio/Effects/Native/Phaser  
20_Audio/Effects/Native/Reverb  
21_Audio/Effects/Native/RingMod  
22_Audio/Effects/Native/Scream Filter  
23_Audio/Effects/Native/Stereo Expander  
24_Audio/Effects/#Receive/#Line Input  
25_Audio/Effects/#Receive/#ReWire Input  
26_Audio/Effects/#Send/#Multiband Send  
27_Audio/Effects/#Send/#Send  
28_Audio/Effects/*Meta/*Hydra  
29_Audio/Effects/*Meta/*Instr. Automation  
30_Audio/Effects/*Meta/*Instr. MIDI Control  
31_Audio/Effects/*Meta/*Key Tracker  
32_Audio/Effects/*Meta/*LFO  
33_Audio/Effects/*Meta/*Signal Follower  
34_Audio/Effects/*Meta/*Velocity Tracker  
35_Audio/Effects/*Meta/*XY Pad  

I got PPG V2, d-Pole and Attack for 50e by buying the Waldorf Bundle from Thomann.

for i=1,300 do oprint (renoise.song().selected_track.devices[2].name … “__” … i … “_” … renoise.song().selected_track.devices[2].parameters[i].name) end

  
#Multiband Send__1_Amount 1  
#Multiband Send__2_Receiver 1  
#Multiband Send__3_Amount 2  
#Multiband Send__4_Receiver 2  
#Multiband Send__5_Amount 3  
#Multiband Send__6_Receiver 3  
#Multiband Send__7_Low  
#Multiband Send__8_High  

Getting all parameternames allows you to create a list of parameters and base a quicksearch on it ( For VST effect plugins this is currently a lack).
With these results you can select specific parameters that you want to automate for instance (automatically add one default automated point to have it automated) and then toggle the “show only automated parameters” toggle.
This way you don’t need to unfold all parameters. For some effect plugins this would probably be a huge time saver.

1 Like

I suppose a for loop can have a reference to the plugin parameter index max number?

well, you know, you could use (table.count(renoise.song().selected_track.devices[2].parameters)
Like this:

function inspectPlugin()  
for i=1,(table.count(renoise.song().selected_track.devices[2].parameters))   
do oprint (renoise.song().selected_track.devices[2].name .. " " .. i .. " " .. renoise.song().selected_track.devices[2].parameters[i].name)   
 end  
end  
  
renoise.tool():add_keybinding {name = "Global:Paketti:inspectPlugin", invoke = function() inspectPlugin() end}  
  

Of course it will only show it in the Scripting Terminal & Editor’s Terminal tab, but that’s beside the point :)

except that you’ve called them the wrong names.
inspectPlugin doesn’t inspect the plugin.

anyway, i’ve fixed all these for Paketti - currently the format is like this:

i opted for making it very easy to copy the content that one might want to save / set on the loading of a specific plugin. i.e. if you want the plugin-of-your-choice to have a specific parameter already set to something specific, you can copypaste the row from the terminal and add it to the loader.

i think one might be able to work this into GUI type stuff but that’s further down the line.

and the code (which you can grab from Paketti github) is:

function inspectPlugin()
local s=renoise.song()
local plugin=renoise.song().selected_instrument.plugin_properties.plugin_device

for i=1,(table.count(plugin.parameters)) 
do oprint (plugin.name .. ": " .. i .. ": " .. plugin.parameters[i].name .. ": " .. "renoise.song().selected_instrument.plugin_properties.plugin_device.parameters[" .. i .. "].value=" .. plugin.parameters[i].value) 
--oprint (renoise.song().selected_instrument.plugin_properties.plugin_device.parameters[i].value)
end end

renoise.tool():add_menu_entry{name="Main Menu:Tools:Paketti..:Plugins/Devices:Inspect Plugin",invoke=function() inspectPlugin() end}
renoise.tool():add_keybinding{name="Global:Paketti:Inspect Plugin",invoke=function() inspectPlugin() end}

function inspectEffect()
local devices=renoise.song().selected_track.devices
oprint("Effect Displayname: " .. devices[2].display_name)
oprint("Effect Name: " .. devices[2].name)
oprint("Effect Path: " .. devices[2].device_path)
for i=1,(table.count(devices[2].parameters)) 
do oprint (devices[2].name .. ": " .. i .. ": " .. devices[2].parameters[i].name .. ": " .. "renoise.song().selected_track.devices[" .. i .. "].value=" .. devices[2].parameters[i].value) end
 end

renoise.tool():add_keybinding{name="Global:Paketti:Inspect Device in Slot 2",invoke=function() inspectEffect() end}
renoise.tool():add_menu_entry{name="Main Menu:Tools:Paketti..:Plugins/Devices:Inspect Device in Slot 2",invoke=function() inspectEffect() end}

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.