Renoise api questions

@taktik is it possible that the parameterchunk for VST2s in the active_preset_data is somehow compressed and then base64 encoded? Or bitflipped? Can’t properly decode this one:

eF49kMtqwzAQRfeB/IOYfRvbsYkXVkNxaLppMcSlayGP5QFZCrIU2r+v/KC7ufO45zLV+WfU7IFuIms4pM8JMDTSdmQUh6/27amE88t+t99Vr1pfhBdsFCb0Qvrg0NW2w3iVp3leHossA3bXQZH572dFWp6yEzAZnEPjG2eVEyOHBKIrY9XWSNinGKPVBXsRtAdWC4/Kul8OwG5oJvL0IB/lMSb8WLCxuDrqlqLRIs5SOKyu10CNwx4jUuLEVKBv6vzAoUzicpTvSGrwHIpN11bb4NoB5xDlstJaqz3dZ9dZ3qTQuIJXTHXYPhKRf7syY28=

Should look like after decoding:

That’s zlib-encoded. This is what I got running it through zlib-flate:


<AllData manufacturerCode="1414483522" pluginCode="1412518727" currentProgram="0">
  <Program0 Name="Default" Category="" Sensitivity="30" Mode="0" Grid="0" Play="1"/>
  <GuiPreferences guiWidth="800" guiHeight="500" guiColourTheme="8" guiTooltip="1" guiScaleMode="1"/>
</AllData>

I suppose this answers your question of where to get the plugin ID, assuming all presets have this.

1 Like

Can you explain to me how you exactly decoded the base64 string? Or is the string itself a zlib-string?

The data is first encoded with zlib and then Base64.

1 Like

Ah ok :slight_smile: And how did you decode it? I don’t know any terminal command which would decompress the base64->binary decoded file…

This online decoder works, no idea how I would do that oin lua, even without a zlib library:

Can I use these libs:

local ffi = require("ffi")
local zlib = require("zlib") -- benötigt zlib-ffi oder zlib-lua Binding

local compressed = ... -- zlib-komprimierte Daten als String oder Bytearray
local inflated, err = zlib.inflate()(compressed)

I randomly had a program called zlib-flate on my computer (seems to have been installed by something else). Frankly I don’t have any recommendations for how to do this, especially cross-platform.

I mean, maybe? You can try it. I don’t think you’re supposed to load DLLs and such in Renoise tools. I’ve done it before for some personal tools but I ended up crashing Renoise a lot.

1 Like

“ffi” is disabled in Renoise luaJIT in good reasons.
So no .ddl and .so bridging.

1 Like

I’m not talking about the FFI library. You totally can write a Lua module in C and then load it in Renoise. Most likely it’s just going to crash, though in the past I’ve gotten a few steps beyond just crashing. My response to @ffx wasn’t meant all that seriously. If the tool is meant to be publicly released, please don’t do this.

@taktik So here is something which is missing in the API. Since you already implemented these for the GUI functions, seems to be a low hanging fruit?:

renoise.AudioDevice:import_preset_data()
renoise.AudioDevice:export_preset_data()
renoise.InstrumentPluginDevice:import_preset_data()
renoise.InstrumentPluginDevice:export_preset_data()

But maybe you would need to add code for identifying the plugin by the fxp/vstpreset data itself. To prevent this, the plugin could have to be loaded first, via plugin_path.

Could you give me details about the encoding of the vst2 chunkdata and also audiounit,
for having a quick workaround solution? Or did I just found a wrong chunkdata? Very confusing…

Mh,

no, this doesn’t work. Although it creates some archive with a “PK” header, it can’t be opened by the DAWs.

tar --help
tar --help
tar(bsdtar): manipulate archive files
First option must be a mode specifier:
  -c Create  -r Add/Replace  -t List  -u Update  -x Extract
Common Options:
  -b #  Use # 512-byte records per I/O block
  -f <filename>  Location of archive
  -v    Verbose
  -w    Interactive
Create: tar -c [options] [<file> | <dir> | @<archive> | -C <dir> ]
  <file>, <dir>  add these items to archive
  -z, -j, -J, --lzma  Compress archive with gzip/bzip2/xz/lzma
  --format {ustar|pax|cpio|shar}  Select archive format
  --exclude <pattern>  Skip files that match pattern
  -C <dir>  Change to <dir> before processing remaining files
  @<archive>  Add entries from <archive> to output
List: tar -t [options] [<patterns>]
  <patterns>  If specified, list only entries that match
Extract: tar -x [options] [<patterns>]
  <patterns>  If specified, extract only entries that match
  -k    Keep (don't overwrite) existing files
  -m    Don't restore modification times
  -O    Write entries to stdout, don't restore to disk
  -p    Restore permissions (including ACLs, owner, file flags)

Only gave this a quick test here on Windows 11 and Renoise loads the created file just fine for me, Windows Explorer can read it and Total Commander does as well, even WinRAR. If on another system, make sure to use BSD TAR (tar(bsdtar)) command.

The pattern_iterator:note_columns_in_song(true) seems to have a bug then, it never repeats the same pattern twice. That’s why my export was missing some notes, because my test song initially uses a sequence with all pattern nums ascending, but later repeats patterns, which won’t be outputted here.

The iterator should also output repeated patterns of course, to reflect the actual song sequence.

More easy to test with this (repeat some patterns in early sequence):

    for pos, obj in renoise.song().pattern_iterator:note_columns_in_song(true) do
        if (pos.track == 1 and pos.line == 1) then
            rprint(pos)
            print(' ')
        end
    end

Ah, true. The code is here and it should be easy to fix it by removing the “referenced_patterns” check.

I would consider this a bug. Makes no sense to somehow iterate thru the sequence, but then each pattern only once… will mess up note-offs, too.

FYI @taktik

1 Like

Now I geddit: Renoise saves only for VST3 the actual, pure vstpreset data into active-preset-data’s ParameterChunk node. But for VST2 and AudioUnit, the actual plugin song inline data is used instead… Which is a different data. Or something. So this data then does not follow a standard, it is purely up to the plugin developer which kind of data this is. Can be compressed or not.

@taktik Is that a correct assumption? So any idea how to get the actual .fxp preset? Thanks for any hints.

I now use

for seqIndex = 1, #Song.sequencer.pattern_sequence do
  local patternIndex = Song.sequencer.pattern_sequence[seqIndex]
  ...
  for position, noteColumn in Song.pattern_iterator:note_columns_in_pattern(patternIndex) do
    ...
  end
end

It’s quite a bit slower, but now works properly, also note-offs caused by muted sequence slots work now.

Perhaps the bug is in your understanding of what PatternIterator is meant to do? It isn’t called SongIterator. Being able to efficiently access every pattern once seems pretty useful to me.

You can always cache the data you need from each pattern into a table, and then run through your table using the pattern sequence data.

EDIT: Maybe you are right and also this one is useful for something, and Renoise team simply left it sequence like to save some cpu… At least I find it quite misleading, since there is no SongIterator or PatternSequenceIterator.

I am a bit confused about renoise.PatternTrackAutomation: Though you can place the automation points between the lines in Renoise, the “time” value in the api is an integer only, ranging from 1 - PATTERN_LENGTH.

Am I missing something, is the documentation outdated, or is it simply not possible to read the fine grained value from automation via the api?