How to set a specific plugin's or plugin instrument's Init* setting in Renoise

I’d prefer to make it so that TAL Reverb-4 would always boot up with specific settings, specific to Renoise.

in the Init*. settings.
I’m wondering, how does one do that? I could script the presets myself, sure, and boot them up with a shortcut, but I’m wondering, is there no nicer way of doing it, i.e. “Renoise specific preset settings loaded by default, when effect is added to dsp chain”

SOLVED
The solution for this was to write your own shortcuts that load the TrackDSP effect (native, AU, VST) and then, after loading, change the plugin parameters to your preferred ones.

As an example, TAL Reverb-4 would be

  if s.selected_track.devices[checkline].name=="AU: TAL-Togu Audio Line: TAL Reverb 4 Plugin" then 
     s.selected_track.devices[checkline].parameters[2].value=0.0 -- delay
     s.selected_track.devices[checkline].parameters[3].value=0.30 -- High Cut
     s.selected_track.devices[checkline].parameters[4].value=0.88 -- Size
     s.selected_track.devices[checkline].parameters[5].value=0.9 -- Diffuse
     s.selected_track.devices[checkline].parameters[6].value=1 -- Dry
     s.selected_track.devices[checkline].parameters[7].value=0.4 -- low cut
     s.selected_track.devices[checkline].parameters[9].value=0.7 -- wet
  end 

But this opens up a larger question, how to set a specific plug-in instrument settings programmatically.

I could not find any callback/observer that would fit. But here is how to set a preset:

Set preset by index:
renoise.song().selected_device.active_preset = 2

You can print the xml data of the active preset:
print(renoise.song().selected_device.active_preset_data)

Then you can pass it back as a multi-line string
renoise.song().selected_device.active_preset = "xml text here"

You could write a function/shortcut that would load your plugin with a certain preset loaded this way.

1 Like

thanks, that’s actually really good! so i’ll take the “regular init”, modify the xml data slightly so arpeggiator speed is set at a specific reasonable speed, and then dump that back into the synth. thanks! that’s really good.

since this’ll only be called when i add a synth for the first time, i think it won’t wreck things when i load a song with the synth in it already.

cool! will give it a shot.

I tried this, does not seem to work.
I mean, I did this

renoise.song().selected_device.active_preset = "<?xml version="1.0" encoding="UTF-8"?>
<FilterDevicePreset doc_version="11">
  <DeviceSlot type="InstrumentAutomationDevice">
    <IsMaximized>true</IsMaximized>
    <ParameterNumber0>0</ParameterNumber0>
    <ParameterNumber1>1</ParameterNumber1>
    <ParameterNumber2>2</ParameterNumber2>
    <ParameterNumber3>3</ParameterNumber3>
    <ParameterNumber4>4</ParameterNumber4>
    <ParameterNumber5>5</ParameterNumber5>
    <ParameterNumber6>6</ParameterNumber6>
    <ParameterNumber7>7</ParameterNumber7>
    <ParameterNumber8>8</ParameterNumber8>
    <ParameterNumber9>9</ParameterNumber9>
    <ParameterNumber10>10</ParameterNumber10>
    <ParameterNumber11>11</ParameterNumber11>
    <ParameterNumber12>12</ParameterNumber12>
    <ParameterNumber13>13</ParameterNumber13>
    <ParameterNumber14>14</ParameterNumber14>
    <ParameterNumber15>15</ParameterNumber15>
    <ParameterNumber16>16</ParameterNumber16>
    <ParameterNumber17>17</ParameterNumber17>
    <ParameterNumber18>18</ParameterNumber18>
    <ParameterNumber19>19</ParameterNumber19>
    <ParameterNumber20>20</ParameterNumber20>
    <ParameterNumber21>21</ParameterNumber21>
    <ParameterNumber22>22</ParameterNumber22>
    <ParameterNumber23>23</ParameterNumber23>
    <ParameterNumber24>24</ParameterNumber24>
    <ParameterNumber25>25</ParameterNumber25>
    <ParameterNumber26>26</ParameterNumber26>
    <ParameterNumber27>27</ParameterNumber27>
    <ParameterNumber28>28</ParameterNumber28>
    <ParameterNumber29>29</ParameterNumber29>
    <ParameterNumber30>30</ParameterNumber30>
    <ParameterNumber31>31</ParameterNumber31>
    <ParameterNumber32>32</ParameterNumber32>
    <ParameterNumber33>33</ParameterNumber33>
    <ParameterNumber34>34</ParameterNumber34>
    <VisiblePages>1</VisiblePages>
  </DeviceSlot>
</FilterDevicePreset>"

and it just complains that that’s not valid.
also, the printout of the active preset data does not seem to have any specific parameter parameters (… parameter settings?) set…?

what am i missing here?

ok looks like changing tack to

>>> oprint (renoise.song().instruments[renoise.song().selected_instrument_index].plugin_properties.plugin_device.active_preset_data)

is a way to get some data out. now, about trying to put it back in though, that’s a bigger question

If I try to yank out everything with " in it, I get

*** exception: ''[BinStream]' is not a Renoise FilterDevicePreset file. Expected a 'FilterDevicePreset' root node, but found a 'ParameterChunk' root node.'
*** stack traceback:
***   [C]: ?
***   [C]: in function '__newindex'
***   [string "do..."]:22: in function <[string "do..."]:9>
***   ./loaders.lua:129: in function 'LoadPPG'
***   ./loaders.lua:135: in function <./loaders.lua:135>

so not sure how to do it properly. like can i do this with a file instead of having it in the script itself?

ok so i saved PPG_Arpeg.xml and am trying to get

renoise.song().instruments[renoise.song().selected_instrument_index].plugin_properties.plugin_device.active_preset_data="PPG_Arpeg.XML"

but it just refuses to load it.

just complains about

*** exception: 'Failed to parse a memory XML file (^
*** )!'
*** stack traceback:
***   [C]: ?
***   [C]: in function '__newindex'
***   [string "do..."]:22: in function <[string "do..."]:9>
***   ./loaders.lua:129: in function 'LoadPPG'
***   ./loaders.lua:135: in function <./loaders.lua:135>

I don’t know the specific solution to your case. I only verified that what I said works in principle, I tried it with a different plugin, “Wolf-Shaper”. I just stored the xml in a global variable, changed some sliders and restored the preset from the global variable again.
I was not easily able to declare the xml as string literal (I think due to containing quotes) , that’s as far as I got for now.
I would have expected that loading from a file would work.

1 Like

Okay, could you let me know how you stored the XML as a global variable? That would probably solve the whole thing. Yep, I ran into the quotation issue.

(Also not sure how to load the xml content from a file)

myvar = renoise.song().selected_device.active_preset_data

Move sliders to change preset, then revert back:
renoise.song().selected_track_device.active_preset_data = myvar

Let me know whether this works with the TAL reverb. I have a feeling t hat it won’t.
I am assuming that every plugin handles the preset data slightly differenty, the XML you showed seemed to carry no relevant data.

This is what wolfshaper gives me, I think ParameterChunk is encoded binary data

<?xml version="1.0" encoding="UTF-8"?>
<FilterDevicePreset doc_version="12">
  <DeviceSlot type="AudioPluginDevice">
    <IsMaximized>true</IsMaximized>
    <ActiveProgram>0</ActiveProgram>
    <PluginType>VST</PluginType>
    <PluginIdentifier>wolf-shaper-vst</PluginIdentifier>
    <PluginDisplayName>VST: Patrick Desaulniers: wolf-shaper-vst</PluginDisplayName>
    <PluginShortDisplayName>wolf-shaper-vst</PluginShortDisplayName>
    <PluginEditorWindowPosition>-1,-1</PluginEditorWindowPosition>
    <ParameterChunkType>Chunk</ParameterChunkType>
    <ParameterChunk><![CDATA[Z3JhcGgAMHgwcCswLDB4MHArMCwweDBwKzAsMDsweDFwKzAsMHgxcCswLDB4MHArMCwwOwAAcHJlZ2FpbgAxLjAwMDAwMAB3ZXQAMS4wMDAwMDAAcG9zdGdhaW4AMS4wMDAwMDAAcmVtb3ZlZGMAMS4wMDAwMDAAb3ZlcnNhbXBsZQAwLjAwMDAwMABiaXBvbGFybW9kZQAwLjAwMDAwMAB3YXJwdHlwZQAwLjAwMDAwMAB3YXJwYW1vdW50ADAuMDAwMDAwAHZ3YXJwdHlwZQAwLjAwMDAwMAB2d2FycGFtb3VudAAwLjAwMDAwMAAA]]></ParameterChunk>
  </DeviceSlot>
</FilterDevicePreset>

Similarly I noticed that the Surge synth does not allow selecting presets from Renoise either and has it’s own preset selection in it’s GUI instead.

Update: I grabbed TAL-Reverb-4-64 on my windows machine and it does work, This is how the XML looks for me:

<?xml version="1.0" encoding="UTF-8"?>
<FilterDevicePreset doc_version="12">
  <DeviceSlot type="AudioPluginDevice">
    <IsMaximized>true</IsMaximized>
    <ActiveProgram>0</ActiveProgram>
    <PluginType>VST</PluginType>
    <PluginIdentifier>TAL-Reverb-4-64</PluginIdentifier>
    <PluginDisplayName>VST: TAL-Togu Audio Line: TAL-Reverb-4-64</PluginDisplayName>
    <PluginShortDisplayName>TAL-Reverb-4-64</PluginShortDisplayName>
    <PluginEditorWindowPosition>-1,-1</PluginEditorWindowPosition>
    <ParameterChunkType>Chunk</ParameterChunkType>
    <ParameterChunk><![CDATA[VkMyIX8BAAA8dGFsIGN1cnByb2dyYW09IjAiIHZlcnNpb249IjEiPjxwcm9ncmFtcz48cHJvZ3JhbSBwcm9ncmFtbmFtZT0iU3RhcnR1cCIgY2F0ZWdvcnk9ImNhdGVnb3J5IDEiIGVmZmVjdHJldmVyYm9uPSIxIiBlZmZlY3RyZXZlcmJhbW91bnQ9IjAuNDM1MDAwMDAyMzg0MTg1NzkxMDIiIGVmZmVjdHJldmVyYnNpZ25hbGFtb3VudD0iMC42MjAwMDAwMDQ3NjgzNzE1ODIwMyIgZWZmZWN0cmV2ZXJiZGVsYXk9IjAuMzQwMDAwMDAzNTc2Mjc4Njg2NTIiIGVmZmVjdHJldmVyYnNpemU9IjAuNDc0OTk5OTk0MDM5NTM1NTIyNDYiIGVmZmVjdHJldmVyYmxvdz0iMSIgZWZmZWN0cmV2ZXJiaGlnaD0iMC4yMzk5OTk5OTQ2MzU1ODE5NzAyMSIvPjwvcHJvZ3JhbXM+PG1pZGltYXAvPjwvdGFsPgA=]]></ParameterChunk>
  </DeviceSlot>
</FilterDevicePreset>

Ok, I think I see what’s going on here.

I often start a thread about one thing, then modify it to be about another.

For something like TAL-Reverb 4, it is easy to load it, and then modify parameters. That’s what I do like this

  if s.selected_track.devices[checkline].name=="AU: TAL-Togu Audio Line: TAL Reverb 4 Plugin" then 
     s.selected_track.devices[checkline].parameters[2].value=0.0 -- delay
     s.selected_track.devices[checkline].parameters[3].value=0.30 -- High Cut
     s.selected_track.devices[checkline].parameters[4].value=0.88 -- Size
     s.selected_track.devices[checkline].parameters[5].value=0.9 -- Diffuse
     s.selected_track.devices[checkline].parameters[6].value=1 -- Dry
     s.selected_track.devices[checkline].parameters[7].value=0.4 -- low cut
     s.selected_track.devices[checkline].parameters[9].value=0.7 -- wet
  end 

this sets specific settings for TAL4.

However, what I’m actually now trying to do, after being able to do this (and I’ve now done this for VST/AU loaders such as: Schaack Transient Shaper, FabFilter Pro-Q, TAL Reverb 4, ValhallaVintageVerb, KTGranulator and George Yohng’s W1 Limiter)…

is to set a specific init state for a plugin-instrument, such as a Waldorf PPG Wave V2.

In it, for no reason whatsoever, the init state for an arpeggio is set to 1/32, which is ridiculous sounding. I’m trying to set it to 1/8t, which is much more pleasing to the ears.

So I’m trying to go from “print settings in plugin instrument” to “save the settings inside the script” and to automatically loading them in, when I run a shortcut that loads the plugin.

So far, no luck. It seems that plugin-instrument is much harder than track dsp EFX like VST/AU or Native EFX. Those are pretty easy to program, all you need to do is discover which effect parameter you want to modify and how.

Sorry for the confusion.

Here is the file writing/reading stuff:

-- Save preset
local file = io.open("c:\\tmp\\test.lua", "w")
file.write(file, renoise.song().selected_track_device.active_preset_data)
io.close(file)

-- Load preset
local file = io.open("c:\\tmp\\test.lua", "r")
local content = file:read("*all")
renoise.song().selected_track_device.active_preset_data = content
io.close(file)

I can’t find any command to just import a preset file in the API otherwise, please let me know if you found it

Update again: I feel stupid, here it is:
renoise.app():load_track_device_preset(filename)

1 Like

wow. just wow. you just solved my issue of not knowing how to save the midimappings that i have for my scripts.

renoise.song():load_midi_mappings(filename)
renoise.song():save_midi_mappings(filename)

that’s awesome. i’ll have to try and get the renoise.app():load_instrument_device_preset(filename) to work too.

Update: load_track_device_preset works only for internal effects saved as “.xrdp” file.
I tried passing the active_preset_data content to it but that causes a crash.

I cannot get this to work, it does nothing and signals some failure (returns false)
print(renoise.app():load_track_device_preset("c:\\tmp\\wolf.fxp"))

Docs:

-- Load a file into the currently selected components (selected instrument,
-- track, sampl, ...) of the song. If no component is selected it will be 
-- created when possible. Any errors during the export are shown to the user. 
-- returns success.
renoise.app():load_track_device_chain(filename) 
  -> [boolean]
renoise.app():load_track_device_preset(filename) 
  -> [boolean]

Now I remember, I don’t like that Renoise does not show presets for plugins inline in the GUI like it does for internal effects. AFAIK you have to use the import/export file browser every time.

why would you be using double \ instead of single \ on this? just asking, cos i don’t know.

What I’d do is go to the terminal and execute these two lines:

print("c:\tmp\wolf.fxp")
print("c:\\tmp\\wolf.fxp")

then I’d look, think and maybe do a little research in backslash escape characters.

>>> print("c:\\tmp\\wolf.fxp")
c:\tmp\wolf.fxp
>>> print("c:\tmp\wolf.fxp")
c:  mpwolf.fxp

The backslash is a special character that will insert other characters. For example \n inserts a new line, \t inserts a tab and so forth.
Two subsequent backslashes prevent this and result in a single backslash, it’s just a syntax convention.
Python has a string-directive that also prevents this in an easier way, I wonder whether LUA has something similar

Python:
print(r"Raw-String that is not escaped, see: \")

Linux-filepaths are more forgiving with this because they use forward slashes to begin with.

1 Like