Xrni Microtuner

Hi all,

There is a new version of the microtuner script available for download:

I’ve made a fair bit of changes to the microtuner script, and it should deliver much better results. However, it still lacks support for multi-sample instruments (planned for next release), and can produce weird results with scales with less than 12 notes/octave. I am not sure how this should be implemented, but try it our for yourself with a complex tunings such as “breed-mult29” (58-note per octave), or “mystic” (which spans 3 octaves before repeating).

Instructions for use:

As always, the first step is to get hold of some tuning files. Download Scala and the Scala archive. The website even has a PDF tutorial explaining how to create .tun files yourself.

Next, have an instrument that you want to use as a starting point. Currently, instruments with multiple samples are not supported, only the first sample is used.

Then, launch the XRNS frontend. It’s use should be pretty self-explanatory :slight_smile:

Changes 0.3

  • Limit output to 120 samples
  • Delete source sample after use
  • Use the generated sample names
  • round off finetune values
  • Find positive value in tuning file when extracting unique tunings (use as offset)
  • When finetune values exceed 128, adjust basenote

Changes 0.2

  • Clean temp-folder before unzipping
  • rename instrument to match output name
  • Fixed: registered interval ‘0’ was reported as non-existing, causing an
    unneeded sample to be created

Here is a bit more background info for the script

Limited range of notes: When a tuning file such as “mystic” is applied to an instrument, some keys are outside the valid range (because mystic has a very large interval between each note). The script will create a blank sample slot, and assign it to any note with an invalid range)

Here, unused sample slot “1C” is assigned to notes outside the valid range.

Wrapped notes with non-pentatonic scales: when number of individual tunings in a scale doesn’t match the amount of keys in an octave (12), they are repeated across the keyboard:

Next version of the microtuner will introduce an option that layout the keyboard differently. With this different approach, a tuning like the above would result in tunings that are repeated for each octave, and require less samples to sound right:

Remember -
The script is a work in progress.
Feel free to post any thoughts and suggestions !

You my friend, are a genius. Thank you so very much. I will have hours of fun with this…

…later… damned time :(

Checked it out and it’s pretty cool.

You should set error_reporting (E_ALL); to catch sloppy undefined variables:

Notice: Undefined variable: reached_octave in /Users/dac514/Desktop/0.3/scripts/xrni_microtuner.php on line 230  
Notice: Undefined index: note -1 in /Users/dac514/Desktop/0.3/scripts/xrni_microtuner.php on line 364  
Notice: Undefined offset: 2 in /Users/dac514/Desktop/0.3/scripts/xrni_microtuner.php on line 575  

As I am no Scala expert, or even tuning amateur for that matter, would it be possible to use the Scala file instead of going through the convoluted TUN conversion procedure? The spec is here:


As the Renoise instrument format is “fixed” and 3600+ readily available .SCL files are there for the taking, it would be much less painful if I could skip the TUN conversion process, letting your script do the dirty work for me. TUN files should of course be supported, but supporting SCL format with basic “for dummies” conversion defaults would be the “killer feature” for me.

Oh yeah! please make a webpage explaining your script in the style of your previous post so XRNS-PHP can host it on sourceforge. I would not have known what the hell was going on without the screenshot, the documentation was extremely helpful. Oh yeah!

Good stuff danoise.

You want [people who use the script] to be able to “browse” different tunings? Well, I agree…It would be a lot easier, and perhaps added to a future version.
However, it’s not as hard as you make it sound - Personally, I use the Scala program to preview the scales before I decide which ones I will use with a Renoise instrument. And once the export feature is set up (done once), it is actually just clicking “export”. For me, this is acceptable workflow.

But until then, how about collecting a lot of “tun” files (I have a fair bit around) and offering them along with the download? I don’t think they are anyone’s intellectual property, so it should be all right, legally speaking.

Yeah, I know. I made them to understand the stuff myself :slight_smile:

Yes, exactly, I want a list of tuning files I can readily use.

There are 3600+ .SCL files available, but using them at this point in time would require me to convert the 3600+ files to TUN.

Why can’t I just use the .SCL files?

Good things come to those that cannot wait…

Here’s a zip file with lots of converted tuning files - no need for Scala


I put them in the CVS, a subdirectory named ./tun/


Any plans for a CVS commit of what you have so far?

Holy craps! This is great. I really want to try this script out, but I’ve been having a sad sad time trying to reinstall Scala. Some GTK+ issues of some kind. If anyone has advice, I would be grateful if you sent me a PM and struck up a conversation.

In the meantime I’ll use your preset tuning files. Thank you for your ambition, danoise.


  1. I’m having a problem with the outputted XRNI. For example, when I loaded 15 TET onto a simple one-sample instrument via this script, the interval between the 15th note (E) and the “octave” (0) is larger than the interval between all other adjacent notes. I think perhaps the intervals may have just been calculated incorrectly?
  2. Why are there both 19_TET.tun and 19_Tone_Equal_Temperament.tun (and similar seemingly redundant pairs) inside the archive you provided?

Hi Diptera,

With the 317 tunings you have a nice starting point, but if you really want to create your own tunings, then, yeah, you need to install Scala

I know, and I plan to fix this. The next version will take a 15 note sequence and distribute it across every 2nd octave on the keyboard, instead of “wrapping” the splits…see the 2nd post about script details, it has a screenshot that explains this.

I just did a quick search on my harddrive for tuning files, and the result is those 317 tunings. So if there are any duplicates, let’s see if we can find & remove them before the script is submitted to sourceforge.

It’s good to see the script being put to use, even if there are still a few issues at hand :wink:


Ah, I see. In that case I eagerly await the updates. :]

So far I found apparent duplicates in the .tun files for the following equal temperaments (TET): 12, 13, 17, 19, 24, 31.

If you need anyone to test and play around with the script, I’m your guy.

Nice to see a new person involved, hi Diptera!

Danoise, what’s the word on moving this developement into CVS?

I can put it in there if you give me an update of the script and config file.

Also, give me a file list (full names of the files) to be removed from the presets in the ./tun/ directory of the CVS.

I’d like to package a new released and do a freshmeat announcement by the end of the month, if possible. Including “Microtuner Script” in the hype of a freshmeat broadcast. It would also be good for Renoise 1.9, as a freshmeat announcement creates a shitload of automatic linkage in the open source world.

It would be great if you could add it to the repository, still not entirely sure about the inner workings of CVS. Kind of like a 3-year old that doesn’t want to swim, I expect it will be very useful experience, once you have learned it.
As for duplicate presets, I just looked at them, and I think Diptera has it pretty much nailed down.

BTW: The “end of the month” - is that a flexible deadline? I may require a few days more to prepare a new version of the microtuner (namely the octave spanning feature)

It’s an arbitrary deadline, no worries from me.

We should aslo update the included PHP files to 5.2.5.


After looking at the output of your script, it seems that in order to create a re-tuned XRNI, one needs multiple copies of the same file, because one sample can only have one tuning. This takes up extra storage space, of course, since there are many copies of the same sample in one instrument. Imagine a non-octave-repeating scale like the Bohlen-Pierce scale – you might need one new sample for EVERY note in the XRNI, since no two notes have the exact same tuning offset.

I had an idea for Renoise that could help out microtonal instruments: What if the XRNI had tuning for every single note on the virtual keyboard, rather than just “global fine tuning” for each sample? One could reuse a single sample across a whole keyboard, while each note could have unique tuning. So basically, reference the same sample, but have unique properties for each note (or perhaps the option to switch between “global sample properties” and “note-unique properties”). I suppose this could theoretically affect properties like sample amplitude and panning.

Does this seem possible? Logical? Do you think the Renoise developers might consider it? Also, .scl support would be really nice…

I have tested with the Bohlen Pierce scale, and, yes, its output is complex. But I think you’ll agree that it would be stupid to sit around and wait for Taktik to implement a new instrument format, when the price for microtonal support is a few (thousand) kilobytes of RAM.

The [shared instrument samplepool] change is bound to happen sometime, but there might still not be native support for microtonal instruments by then, so I’d just upgrade the script to the new instrument version.

BTW there’s a forum topic covering this:

I do. I don’t plan to “sit around and wait” – Musicians and clever computer users always find ways to do things within their limitations. Hence your script!

Thanks for the link. I’ll read up.


I’ve spent the last couple of days playing with Scala and Microtuner.

Scala works fine, but for some reason Microtuner makes only 10 notes out of my 12 tone scale.

I’ve made a 12 tone scale very similar to the Pythagorean scale, so it shouldn’t be too hard to make an instrument out of the .tun…

Am I doing something wrong?

Any ideas?

Best regards,


Hi Delight,

with 12 notes it should work, so I guess something must be wrong with the 'tuner…
Can you send the scale file to me - I’ll look into it and see if I can fix it for you!