I thought it would be interesting to have a go at implementing additional file format support through the Lua API.
Attached is a simple example which allows Renoise to import and export samples as Akai MPC 2000/3000/4000 ‘SND’ files.
I chose this format only because I could find both a file format specification and example SND files on the 'net. I do not own an MPC to try the exported SND files upon so I cannot test if they are valid. However, hey can be read back into Renoise with the same tool.
Unfortunately, as the sample_data can only be accessed through a function I cannot see a way to use the much faster ipairs iterator rather than a Lua based ‘for loop’ to read/write the sample data. Because of this Renoise may appear to ‘freeze’ while importing/exporting. I did start to extract the wavedata import/export into a ‘chunked’ function which could be ran from the idle loop. If anyone can think of another/better approach feel free to discuss / implement it in this example tool.
The ultimate aim is to provide support for a much larger range of samplers (including other soft-samplers). Hopefully, this may also include instrument importing in addition to just waveforms.
Anyway, if any other developers wish to have a look at the tool and/or wish to suggest/implement additional features feel free to do so.
I downloaded a few free EXS24 sampler patches earlier this evening. Most of these are just a collection of aiff/wave files and a small .exs file which contains all the metadata. These would be ideal for Renoise as the Lua API exposes the standard .wav/.aiff sample loader function.
I’ve spent the last couple of hours looking at the .exs files with a hex editor and I believe I can reliably extract the following information from the metafile:
Each sample name
The base note for each sample
The midi map start note for each sample
The midi map end note for each sample
The midi map min velocity for each sample
The midi map max velocity for each sample
This means we should be able to get basic EXS24 sampler patch import pretty soon.
Obviously we will lose all the modulation data, but with the current limitations of the XRNI format it’s probably for the best at this stage. However, we will have the samples with their mapping correctly imported.
As far as I am aware, not many applications provide EXS24 import. This would make a pretty cool Renoise feature.
I’ll try to code this up over the next few days using the above tool as a base.
Martin
edit: I started coding this and I can read and parse most of the data ‘chunks’.
I think I can also extract the tuning information although I am less sure about this part.
Thus, if anyone has EXS24 can you please create a simple instrument patch (one sample in one zone) with the coarse tuning at 0, minimum and maximum. Please also indicate what the actual value is at maximum and minimum. Please also repeat with the fine tuning parameter. Then please PM me to send me just the .exs patch files (I don’t need the sample).
The FileFormats tool can now import Emagic/Logic EXS24 non-monolithic sampler patches straight into Renoise’s sampler!
I’ve tested it with a dozen or so patches downloaded from the net.
It currently understands each samples base note and the instrument split map.
Quoting myself:
If someone can do the above we can add the tuning information to the import.
I also need to have a think about sustain loop points.
I’m going to tidy the code up over the next few days and release it as version 0.02 of the FileFormats tool.
Also, I am reorganising the code inside the tool so each additional sample/instrument format is it’s own ‘standalone’ lua file. This means that many people can (if they so wish) work on adding additional formats to the tool without disrupting any of the others. This is done by just a handful of simple rules explained inside the tool code.
As promised, please find attached a new version of the ‘FileFormats’ tool. edit: attachment removed as a bug has been found. Updated version to come.
This version allows you to import EXS24 sampler instruments (from Logic) into Renoises sampler. Each samples base note and key range will be imported. I have not found where in the file the loop points are kept, nor am I certain about the tuning parameters, but it is still usable.
I have re-arranged the code within the tool and provided some basic documentation. Each file format filter should be self-contained within a single file.
Also, this tool is designed to be a collaborative effort. If the included rules are followed then the stability of the tool should be guaranteed.
Due to the above I have increased the version number to a massive 0.1
Please test this out and report back any findings - There are a lot of freely downloadable EXS24 patches available on the Internet if required.
I installed com.renoise.FileFormats.0.1.xrnx from post #5, it doesn’t support SND? Where did it go?
Tried to import a garage band EXS file. It asks “where are the samples” I navigate to the appropriate folder, i get:
*** ./instruments/exs24.lua:52: attempt to perform arithmetic on local 'chunk_start' (a nil value)
*** stack traceback:
*** ./instruments/exs24.lua:52: in function 'exs24_extract_chunk'
*** ./instruments/exs24.lua:195: in function 'exs24_import'
*** ./instruments/exs24.lua:231: in function <.><br>
<br>```
<br>
<br>
Huh?</.>
Yes, sorry if that was not clear. EXS24 instrument patches have an EXS file extension.
Do not worry, SND support has just been moved to the ‘attic/’ folder (so it is not included by default). I will return to this over the next few days and tidy the code, but I thought full instrument patches would be more important. Note that this tool should not conflict with the test tool in the first post as I renamed it, so you can have both if you require SND support immediately.
[quote=“Conner_Bw, post:5, topic:30511”]
Tried to import a garage band EXS file. It asks “where are the samples” I navigate to the appropriate folder, i get:
*** ./instruments/exs24.lua:52: attempt to perform arithmetic on local 'chunk_start' (a nil value)
*** stack traceback:
*** ./instruments/exs24.lua:52: in function 'exs24_extract_chunk'
*** ./instruments/exs24.lua:195: in function 'exs24_import'
*** ./instruments/exs24.lua:231: in function <.><br>
<br>```
<br>
<br>
Huh?<br>[/quote]<br>
<br>
Hmm, that didn't last long. <img src="https://files.renoise.com/forum/emoticons/default/rolleyes.gif" class="bbc_emoticon" alt=":rolleyes:"> <br>
<br>
Interesting though, I've not had that problem with my test files. It sounds like it cannot find the first chunk header. Can you possibly send me the EXS file for analysis (through a PM link).<br>
<br>
Thanks for testing,<br>
Martin</.>
Ive found the issue. There appears to be two different versions of the EXS file: one is ‘big-endian’, the other ‘little-endian’. I have added some test code to identify which format the file is in and this appears to work well.
I will update the tool to cope with both endianness later today and upload a new version.
Upon further investigation their appears to be (at least) three different EXS file formats
The attached updated tool (version 0.11) should handle all three of these file types sufficiently.
Please note that velocity switching cannot be performed on Renoises sampler, so sample maps will be overwritten in the order that they are referenced in the file. This may result in ‘unused’ samples in the instrument, which can be deleted.
Exception: This is not a valid WAV file!
Exception: Failed to open the file '/Library/Application Support/GarageBand/Instrument Library/Sampler/Sampler Files/2-Step Remix/nse-2step33.wav' for reading.
Exception: Failed to open the file '/Library/Application Support/GarageBand/Instrument Library/Sampler/Sampler Files/2-Step Remix/nse-2step33.wav' for reading.
Error Message: Sample export failed with the error: 'Failed to open the file '/Library/Application Support/GarageBand/Instrument Library/Sampler/Sampler Files/2-Step Remix/nse-2step33.wav' for reading.'
Exception: This is not a valid WAV file!
Exception: Failed to open the file '/Library/Application Support/GarageBand/Instrument Library/Sampler/Sampler Files/2-Step Remix/fx_-2step39.wav' for reading.
Exception: Failed to open the file '/Library/Application Support/GarageBand/Instrument Library/Sampler/Sampler Files/2-Step Remix/fx_-2step39.wav' for reading.
Error Message: Sample export failed with the error: 'Failed to open the file '/Library/Application Support/GarageBand/Instrument Library/Sampler/Sampler Files/2-Step Remix/fx_-2step39.wav' for reading.'
Exception: Failed to open the file '/Library/Application Support/GarageBand/Instrument Library/Sampler/Sampler Files/2-Step Remix/YT2_TSLRHTX01_1ue.aif'.
Exception: Failed to open the file '/Library/Application Support/GarageBand/Instrument Library/Sampler/Sampler Files/2-Step Remix/YT2_TSLRHTX01_1ue.aif' for reading.
Exception: Failed to open the file '/Library/Application Support/GarageBand/Instrument Library/Sampler/Sampler Files/2-Step Remix/YT2_TSLRHTX01_1ue.aif' for reading.
Error Message: Sample export failed with the error: 'Failed to open the file '/Library/Application Support/GarageBand/Instrument Library/Sampler/Sampler Files/2-Step Remix/YT2_TSLRHTX01_1ue.aif' for reading.'
Exception: Failed to open the file '/Library/Application Support/GarageBand/Instrument Library/Sampler/Sampler Files/2-Step Remix/YT2_TSSMHTX03.aif'.
Exception: Failed to open the file '/Library/Application Support/GarageBand/Instrument Library/Sampler/Sampler Files/2-Step Remix/YT2_TSSMHTX03.aif' for reading.
Exception: Failed to open the file '/Library/Application Support/GarageBand/Instrument Library/Sampler/Sampler Files/2-Step Remix/YT2_TSSMHTX03.aif' for reading.
Error Message: Sample export failed with the error: 'Failed to open the file '/Library/Application Support/GarageBand/Instrument Library/Sampler/Sampler Files/2-Step Remix/YT2_TSSMHTX03.aif' for reading.'
Exception: Failed to open the file '/Library/Application Support/GarageBand/Instrument Library/Sampler/Sampler Files/2-Step Remix/YT2_TSSMHTX02.aif'.
Exception: Failed to open the file '/Library/Application Support/GarageBand/Instrument Library/Sampler/Sampler Files/2-Step Remix/YT2_TSSMHTX02.aif' for reading.
Exception: Failed to open the file '/Library/Application Support/GarageBand/Instrument Library/Sampler/Sampler Files/2-Step Remix/YT2_TSSMHTX02.aif' for reading.
Error Message: Sample export failed with the error: 'Failed to open the file '/Library/Application Support/GarageBand/Instrument Library/Sampler/Sampler Files/2-Step Remix/YT2_TSSMHTX02.aif' for reading.'
Exception: Failed to open the file '/Library/Application Support/GarageBand/Instrument Library/Sampler/Sampler Files/2-Step Remix/YT2_TSSMHTX04.aif'.
Exception: Failed to open the file '/Library/Application Support/GarageBand/Instrument Library/Sampler/Sampler Files/2-Step Remix/YT2_TSSMHTX04.aif' for reading.
Exception: Failed to open the file '/Library/Application Support/GarageBand/Instrument Library/Sampler/Sampler Files/2-Step Remix/YT2_TSSMHTX04.aif' for reading.
Error Message: Sample export failed with the error: 'Failed to open the file '/Library/Application Support/GarageBand/Instrument Library/Sampler/Sampler Files/2-Step Remix/YT2_TSSMHTX04.aif' for reading.'
Exception: Failed to open the file '/Library/Application Support/GarageBand/Instrument Library/Sampler/Sampler Files/2-Step Remix/YT2_TSSMHTX01.aif'.
Exception: Failed to open the file '/Library/Application Support/GarageBand/Instrument Library/Sampler/Sampler Files/2-Step Remix/YT2_TSSMHTX01.aif' for reading.
Exception: Failed to open the file '/Library/Application Support/GarageBand/Instrument Library/Sampler/Sampler Files/2-Step Remix/YT2_TSSMHTX01.aif' for reading.
Error Message: Sample export failed with the error: 'Failed to open the file '/Library/Application Support/GarageBand/Instrument Library/Sampler/Sampler Files/2-Step Remix/YT2_TSSMHTX01.aif' for reading.'
Exception: Failed to open the file '/Library/Application Support/GarageBand/Instrument Library/Sampler/Sampler Files/2-Step Remix/YT2_CBLOHTX01_1ue.aif'.
Exception: Failed to open the file '/Library/Application Support/GarageBand/Instrument Library/Sampler/Sampler Files/2-Step Remix/YT2_CBLOHTX01_1ue.aif' for reading.
Exception: Failed to open the file '/Library/Application Support/GarageBand/Instrument Library/Sampler/Sampler Files/2-Step Remix/YT2_CBLOHTX01_1ue.aif' for reading.
Error Message: Sample export failed with the error: 'Failed to open the file '/Library/Application Support/GarageBand/Instrument Library/Sampler/Sampler Files/2-Step Remix/YT2_CBLOHTX01_1ue.aif' for reading.'
Exception: Failed to open the file '/Library/Application Support/GarageBand/Instrument Library/Sampler/Sampler Files/2-Step Remix/YT2_CSLASHX01_1ue.aif'.
Exception: Failed to open the file '/Library/Application Support/GarageBand/Instrument Library/Sampler/Sampler Files/2-Step Remix/YT2_CSLASHX01_1ue.aif' for reading.
Exception: Failed to open the file '/Library/Application Support/GarageBand/Instrument Library/Sampler/Sampler Files/2-Step Remix/YT2_CSLASHX01_1ue.aif' for reading.
Error Message: Sample export failed with the error: 'Failed to open the file '/Library/Application Support/GarageBand/Instrument Library/Sampler/Sampler Files/2-Step Remix/YT2_CSLASHX01_1ue.aif' for reading.'
ScriptingEngine: ./instruments/exs24.lua:228: Script execution terminated by user.
stack traceback:
./instruments/exs24.lua:123: in function 'exs24_parse_chunk'
./instruments/exs24.lua:228: in function 'exs24_import'
./instruments/exs24.lua:263: in function <./instruments/exs24.lua:257>
Error Message: '/Users/dac514/Library/Preferences/Renoise/V2.6.0/Scripts/Tools/com.renoise.FileFormats.xrnx/' failed to execute in one of its menu entry functions.
Error Message: Please contact the author (Martin Bealby | mxb (mbealby@gmail.com)) for assistance...
Error Message: ./instruments/exs24.lua:228: Script execution terminated by user.
Error Message: stack traceback:
Error Message: ./instruments/exs24.lua:123: in function 'exs24_parse_chunk'
Error Message: ./instruments/exs24.lua:228: in function 'exs24_import'
Error Message: ./instruments/exs24.lua:263: in function <./instruments/exs24.lua:257>
From looking at the attached logs (thanks!) it is trying to load an invalid ‘.wav’ file. I am using the native Renoise import functions for file loading so there is nothing I can do in the tool to fix this. If you try and load the sample directly into Renoise’s sample you will get the same error
Upon further investigation it appears that this file is actually an incorrectly named ‘.aif’ file! Unfortunately, even the sample mapping file (.exs) refers to it as a ‘.wav’.
Thus, the logic is correct, but the actual exs patch refers to incorrectly named files. There isn’t much I can do in this situation.
To Renoise developers: Should the Renoise sample loading function base assumptions from the file extension? Would it be more reliable to probe the file itself for its format?
Ok. Well of all the EXS files I have on my OSX box, I’m not able to load any. I get dozens of “Can’t Load File” popups, to which I press OK. Then several “Terminate Script?” boxes, which I say “No, continue”. After the execution of the script, I expect at least a few samples to be loaded, but instead I get nothing.
Ideally, the script
Catches the “Can’t load messages” instead of presenting me with dozens of annoying popups. Maybe a summary at the end.
Loads something instead of nothing?
Unfortunately, I can’t share my 4 gigs of EXS files that come with Garageband. I simply don’t have the bandwidth. Ideally you can find an OSX box? The files are located in:
Well, unfortunately, the “Can’t Load File” popups are created inside the Renoise Core file loader. As my tool just iterates over them this is nothing I can control.
However, I did manage to open the “12 String Acoustic Chords” with no errors?
Also, if the tool is not terminated, some samples should be loaded but will not be assigned on the midi mapping.
On my box, I get output in the terminal but no samples are actually loaded in the Instrument slots? No errors, though.
Here’s the terminal.
SOBJ false
121 12-STR CHORD
185 Zone #38
185 Zone #16
185 Zone #54
185 Zone #58
185 Zone #55
185 Zone #41
185 Zone #39
185 Zone #2
185 Zone #6
185 Zone #3
185 Zone #7
185 Zone #11
185 Zone #8
185 Zone #13
185 Zone #14
185 Zone #15
185 Zone #44
185 Zone #46
185 Zone #49
185 Zone #52
185 Zone #50
185 Zone #56
185 Zone #9
185 Zone #12
185 Zone #17
185 Zone #21
185 Zone #18
185 Zone #1
185 Zone #4
185 Zone #57
185 Zone #5
185 Zone #70
185 Zone #74
185 Zone #72
185 Zone #27
185 Zone #30
185 Zone #28
185 Zone #31
185 Zone #29
185 Zone #43
185 Zone #47
185 Zone #48
185 Zone #59
185 Zone #45
185 Zone #37
185 Zone #24
185 Zone #19
185 Zone #20
185 Zone #33
185 Zone #36
185 Zone #34
185 Zone #71
185 Zone #65
185 Zone #66
185 Zone #68
185 Zone #67
185 Zone #73
185 Zone #73
185 Zone #63
185 Zone #35
185 Zone #25
185 Zone #10
185 Zone #22
185 Zone #23
185 Zone #26
185 Zone #32
185 Zone #40
185 Zone #42
185 Zone #51
185 Zone #53
185 Zone #60
185 Zone #61
185 Zone #62
185 Zone #64
185 Zone #69
177 12-STR CHORDS
417 50E-GA3-E1MJ.aif
417 50E-GA2-E1MJ.aif
417 50E-GA1-E1MJ.aif
417 50F-GA2-E1MJ.aif
417 50F-GA1-E1MJ.aif
417 50E-GA2-F1MJ.aif
417 50E-GA1-F1MJ.aif
417 50F-GA2-F1MJ.aif
417 50F-GA1-F1MJ.aif
417 50E-GA2-G1MJ.aif
417 50E-GA1-G1MJ.aif
417 50F-GA2-G1MJ.aif
417 50F-GA1-G1MJ.aif
417 50E-GA3-A1MJ.aif
417 50E-GA2-A1MJ.aif
417 50E-GA1-A1MJ.aif
417 50F-GA2-A1MJ.aif
417 50F-GA1-A1MJ.aif
417 50E-GA2-B1MJ.aif
417 50E-GA1-B1MJ.aif
417 50F-GA1-B1MJ.aif
417 50E-GA2-C2MJ.aif
417 50E-GA1-C2MJ.aif
417 50F-GA2-C2MJ.aif
417 50F-GA1-C2MJ.aif
417 50E-GA2-D2MJ.aif
417 50E-GA1-D2MJ.aif
417 50F-GA1-D2MJ.aif
417 50E-GA3-E1MN.aif
417 50E-GA2-E1MN.aif
417 50E-GA1-E1MN.aif
417 50F-GA2-E1MN.aif
417 50F-GA1-E1MN.aif
417 50E-GA2-F1MN.aif
417 50E-GA1-F1MN.aif
417 50F-GA2-F1MN.aif
417 50F-GA1-F1MN.aif
417 50E-GA2-G1MN.aif
417 50E-GA1-G1MN.aif
417 50F-GA1-G1MN.aif
417 50E-GA3-A1MN.aif
417 50E-GA2-A1MN.aif
417 50E-GA1-A1MN.aif
417 50F-GA2-A1MN.aif
417 50F-GA1-A1MN.aif
417 50E-GA2-B1MN.aif
417 50E-GA1-B1MN.aif
417 50F-GA2-B1MN.aif
417 50F-GA1-B1MN.aif
417 50E-GA2-C2MN.aif
417 50E-GA1-C2MN.aif
417 50F-GA2-C2MN.aif
417 50F-GA1-C2MN.aif
417 50E-GA2-D2MN.aif
417 50E-GA1-D2MN.aif
417 50F-GA1-D2MN.aif
368 Default Param
PS: Ordinarily i’d pitch in and actually debug this, but I’m pressed for time these days so I can’t. Thanks for your efforts, they are certainly appreciated.
Until we can fix the aiff/wav issue with EXS patches I have temporarily disabled that part of the code in this tool.
Using a hacky work-around I have added some support code to extract the base note and loop points from wav samples imported through the API (see here for details).
Thus, the tool can now read Akai AKP program patches (Akai S5000 / S6000 / z4 / z8 / MPC5000v2 and MPC4000). It will load the samples and set the base-notes, loop points and sample mapping across the keyboard.
On the Akai samplers, the keyboard is split into zones and each zone can have up to four samples playing at the same time. This is not possible in Renoise and so the tool will only load the 1st sample in each zone. No modulation settings are also imported as this is not possible through the API.
I have tested it with 90% of the patches available from here with no issues.
Sorry to keep jumping around between formats but each file format is bringing up new and different issues.
At least if we have one stable import format users can use a conversion utility (e.g. ChickenSys Translator) to use other formats.
Maybe the problem is somehow related to the endianess? If I understand the output from MPlayer correctly, the file is big endian (“s16be”), but the standard for AIFF files on OSX is little endian…
PS: Great, I fucked up and destroyed one of the files playing around with SoX. Would someone kindly send me the file YTASMLNOMA2X2 from the Alto Sax instrument? I don’t really feel like reinstalling all of iLife just to restore a single file…