LUA FFI support in Renoise?

hi, does Renoise support FFI?

No.
“ffi” is for LuaJIT

does luajit work inside renoise?
can renoise, via luajit, work with ffi?

LuaJIT can run in Renoise with some modifications.
Some tools that do a lot of calculations will definitely run faster.
“FFI” can also run but it is related to “C definitions”. It is bridge to libraries, in short.
Variables are defined accordingly, memory access, etc. is also a big risk.

You can try pure “C” implementation for Lua here.

ok looks like there’s just no way to dump the rex sdk into renoise lua via ffi via luajit, right?

I don’t know rex. I don’t know what it is or what it’s for.

.dll .dylib .bundle stuff for allowing for .RX2 format to be loaded using their proprietary DLL.
but if FFI doesn’t work via LuaJIT in Renoise, then it’s best to give up.

REX SDK:

https://developer.reasonstudios.com/downloads/other-products

Ha, it’s not cross platform.
How is it with licenses?
Is rex2 allowed to reverse engineer?

Reason Studios hereby grants you a royalty-free license to study, amend and use this product.
Notwithstanding anything to the contrary in this license agreement, you may not use this
product (or parts thereof) in conjunction with any open source software, free software or
other software that risks creating an obligation to distribute or publish this product
(including any part thereof) or any software used together with this product to any
third party.

just small part of license file.

So how could you theoretically circumvent this, by providing the tool and telling the user to search and install the necessary .dll themselves, not distribute it alongside a tool, just like how certain emulators do this with bios files?

There is more, but i am not familiar with those licenses.
Just the fact that it is not multiplatform discourages me.
But nothing prevents you from writing your own parser, of course in lua and multiplatform :slight_smile:
Unfortunately it is not known how the data is encoded, there are a couple of header structures in the file but i have not looked into it in any way.
Is it just another sample storage format?
Are there multisamples?
I can recognize the file header but then I get crazy, meaningless data.

From chatgpt;

" Yes and no. While REX2 does store sample data, it’s more than just another sample storage format.

How REX2 Differs from Standard Sample Formats

Unlike WAV or AIFF, which store continuous audio, REX2 is designed specifically for loop-based, sliced audio manipulation. Here’s what makes it unique:

1. Sliced Audio Format

  • A REX2 file contains a recording (loop) that has been automatically or manually sliced into smaller segments (transients).
  • Each slice can be individually triggered, similar to how a sampler would play separate drum hits from a drum loop.
  • The slice information allows for automatic tempo matching in DAWs.

2. Embedded Tempo & Groove Data

  • REX2 files embed tempo metadata from the original loop.
  • This allows software (like Reason, Cubase, or Reaper) to stretch or adjust playback speed without altering pitch.
  • Some versions also store groove or timing offsets, so loops retain their original feel when tempo is changed.

3. MIDI Integration

  • Most DAWs import REX2 as a MIDI file + separate audio slices.
  • Each slice is assigned to a MIDI note, allowing for rearranging and resequencing the loop.
  • This makes it a hybrid between a sample file and a MIDI-controlled sample instrument.

4. Compressed Audio (Proprietary Encoding)

  • Unlike WAV or AIFF, which are uncompressed, REX2 files use non-standard lossless compression.
  • This reduces file size while preserving quality, but it also means you can’t just read it as raw audio data.

Conclusion: Is REX2 Just a Sample Format?

Not really. While it contains audio, it’s more of a loop-based sliced sample format designed for tempo flexibility, MIDI triggering, and dynamic rearranging—closer to a loop engine than a simple audio file.

Would you be looking for a way to extract slices, convert them, or integrate REX2 functionality into your Renoise workflow?
"

Basically you can slice in Renoise, but there are a lot of rex 2 soundfiles out on the internets, so it would be cool if this was supported in Renoise, being the ultimate sampler :sunglasses:

windows + macOS at least

yep. tried for multiple hours, but couldn’t even get a standalone cpp / python script going so i could get the audio and slice data out. all i got was errors on REXCreate. giving up for a week, then i’m gonna regroup and try again.

So I don’t use both :frowning:
Sometimes windows because it’s a good bootloader for games.

Proprietary sample encoding :frowning:

i’ve reached out to them requesting a linux version of the REX SDK.
let’s see what happens.
also reached out to them about this issue:

Yes I can read the file header too, a regular hex editor is enough for that and it is readable,
the problem occurs with encoded data. For that you have to use Ghidra or BinaryNinja
and if you find a way to encode it then writing it as a tool in lua will not be a problem :slight_smile: