External File Wrapper

Hey, as there is a linux version of the Renoise why not take advantage of some linux ways of making things. Apparently the Linux version can’t open MP3 for now, and probably not many other things aswell… So I am proposing this method for opening files.

On renoise startup renoise checks if there is a “renoise-open-wrapper” command. If it exists it activates following mechanism:

  1. You are trying to open a file which Renoise doesn’t support.

  2. Renoise popens “renoise-open-wrapper filename.ext”

  3. The renoise-fopen-wrapper is a standalone script somewhere on path, which checks the file format and tries to convert in arbitrary way.

  4. The wrapper outputs the converted file contents to stdout, renoise reads it and does the usual stuff renoise does when opening a sample/instrument/module.

In case wrapper returns non-zero exit status, renoise acts like it normally acts when it can’t detect the file format.

Example:

  1. You are trying to open snare.mp3
  2. Renoise can’t open it and runs “renoise-open-wrapper /home/suva/samples/snare.mp3”
  3. Wrapper runs command “lame --decode /home/suva/samples/snare.mp3 -o /dev/stdout”
  4. Renoise reads the output as if it was WAV file and opens it as sample.

I could easily post a script that converts MP3, MPC, WAVPACK, etc. formats + extract audio from video files by this evening.

Hey, here is an example of the wrapper. This one currently can decode MP3, WavePack (wv) and MusePack (mpc) formats. If it doesn’t detect decent decoder it tries with sox which additionally supports: 8svx aif aifc aiff aiffc al alsa au auto avr caf cdda cdr cvs cvsd dat dvms fap fssd gsm hcom ima ircam la lu mat mat4 mat5 maud mp2 mp3 nist nul null ogg ossdsp paf prc pvf raw s3 sb sd2 sds sf sl smp snd sndfile sndt sou sph sw txw u3 u4 ub ul uw vms voc vorbis vox w64 wav wve xa xi decoders. But some of the sox decoders are bit broken.

Works nice. Additional format supports and fallbacks can be added easily.

http://suva.ath.cx/renoise-open-wrapper

Sounds like a good method for Mp3 import.

Not only MP3. This script I wrote in 10 already imports dozens of different formats and adding new ones is no problem. Not even .sid, .nsf, etc.

Okay… then write us a few other tracker like .669 and .s3m import converters as well :P

Renoise doesn’t open S3M? :o

Great idea, but we’ll need a way to tell renoise which kind of files the “renoise-open-wrapper” can open, so that we can offer them as samples in the diskbrowser.

So instead of using a sh we could use a simple xml file like (just a draft):

  
<externalsampledecoders doc_version="1"><br>
  <externalsampledecoder><br>
	<fileextensions><br>
	  <fileextension>*.mp3</fileextension><br>
	  <fileextension>*.mp4</fileextension><br>
	</fileextensions><br>
	<checkavailabilitycommand>"lame --version &gt; /dev/null || exit 1</checkavailabilitycommand><br>
	<decodecommand>lame --decode "$1" - 2&gt; /dev/null</decodecommand><br>
  </externalsampledecoder><br>
  <externalsampledecoder><br>
	...<br>
  </externalsampledecoder><br>
</externalsampledecoders>  
  

Renoise would then parse the XML on startup, check which decoders are present via ‘CheckAvailabilityCommand’, then offer the extensions in the browser and decode them via ‘DecodeCommand’…

Yeah, that will probably work much better. Only thing to remember: Doing this kind of opening won’t let you seek in the file. This may or may not be a problem, depending on a sample load implementation.