Dec 042011

Back in 2005 I wrote a short TUN tutorial that was published on the Scala home page, which was originally written for the manual of the LinPlug CronoX VSTi. Since that time, Manuel Op de Coul (the developer of Scala) has added many new and helpful features that make it easier than ever to create the microtuning format files for retuning electronic hardware and software musical instruments.

This new article greatly expands upon the information in the original TUN tutorial and presents a sequence of exercises for the creation of the TUN microtuning format files used for exploring alternative intonation systems in many popular microtunable virtual instruments, and covers how the frequencies of microtonal tunings are mapped to specific MIDI Note Numbers, as well as demonstrating many important new features and functions of the Scala application.  

Microtuning Virtual Instruments – Part 4 | Creating TUN Files

The TUN microtuning format was invented by Mark Henning who is also the developer of the AnaMark VSTi synthesizer, which was first published with TUN support on February 19, 2003, making it one of the earliest VSTi supporting full-controller microtuning tables. The TUN format is an elegant solution for retuning MIDI controlled virtual instruments to alternative intonation systems, because both the MIDI Note Number on which the 1/1 starting note of the microtuning will be placed – and – the MIDI Note Number on which the Reference Frequency will be placed, can be freely specified, and is embedded within a single text file that is read by the instrument.

When creating a tuning table microtuning – of any kind – for a virtual instrument, there are three essential parameters that will be configured:

1.    The Microtuning itself, which, considered alone, typically has no specific pitches assigned to it.

2.    The MIDI Note Number on which the 1/1 Starting Note of the microtuning will be placed.

3.    The MIDI Note Number on which the Reference Frequency will be placed. This is the parameter which directly determines the way specific pitches are mapped to a musician’s MIDI controller.

These three parameters can be easily specified using the popular Scala application which can be used for the creation of most of the microtuning format files used in virtual instruments.

As an obvious first step in following this tutorial, musicians will need to have Scala installed on their computer. Go to the Scala Downloads page, download and install the application. Just in case there are some who may be new to Scala, here is some background information derived from the ’05 tutorial:

“Scala is a freeware utility developed by Manuel Op de Coul in the Netherlands, which can be used for the creation and analysis of historical, ethnic and contemporary microtunings. A powerful capability of Scala is that it enables the user to create the proprietary tuning data required for microtuning a wide range
of hardware and software synthesizers and samplers.”

OK – Let’s get started…

When you first run Scala, you will see the below UI.

Scala is a rather deep application with many features beyond merely creating microtuning format files for retuning virtual instruments. In this, and the other Scala tutorials that will follow, most all of the features that we will focus on will be found under the File and View menus, and by using the functions that are found in the dialog that is presented when clicking the Opts button on the tool bar, all of which are shown above within a red rectangle.

The functions under the File menu are used for creating, saving and exporting new microtunings. There is a feature found in the View menu for viewing the way the frequencies of microtunings are mapped to our controller’s MIDI Note Numbers. The Opts button opens a User Options dialog within which we will specify the keyboard mapping parameters for our microtunings.

As has been repeatedly stressed throughout this series of articles, a crucial part of setting up a full-controller microtuning is being able to freely and arbitrarily configure MIDI Note Numbers to have specific pitches across the entire range of the instrument by defining the Microtuning (the intonation system itself), the MIDI Note Number on which the 1/1 Starting Note will be placed, and finally, the MIDI Note Number on which the Reference Frequency of the microtuning will be placed, which is actually what determines how and where the specific pitches will fall on a musician’s keyboard.

The reasons why musicians and composers will need to be able to specify these parameters in their microtuning tables are many, but here are a few of them:

  • To bring ensembles of instruments into tune with each other so that they all will be able to play in a common intonation.
  • For ethnomusicological studies, musicians may want to tune their instruments to recordings or acoustic instrument intonations that do not use Western music ‘concert’ pitches.
  • To change the sonic character of the music by specifying atypical reference frequencies that may have nothing in common with the twelve-tone-equal-temperament.

All this may sound a bit complicated at first, but don’t worry, because now we will systematically go through three different microtuning scenarios which will endeavor to completely demystify the process of setting up a full-controller microtuning for your TUN-enabled virtual instrument of choice. Go through these exercises if you are new to working with microtonal tunings, and upon completion, you will gain a deeper understanding of how tunings are mapped to instruments and how to work with Scala to get results required of your music.

Scenario 1
Microtuning: Eight Tone Equal Temperament
MIDI Note Number and Reference Frequency: 69.A @ 440 Hz
MIDI Note Number for 1/1 Starting Note: 60.C

As above, our goal in this particular exercise will be to create a TUN file for 8-TET, with the 1/1 on 60.C and our Reference Frequency on 69.A @ 440 Hz.

1. Specifying the Microtuning
Click on the File menu and choose New / Equal Temperament, or use keyboard command Shift+Alt+E (learn keyboard commands to work faster).

This will open the New Equal Temperament dialog.

In the New Equal Temperament dialog type 8 into the Division field, then click the OK button.

Next, click the Show button (shown in red rectangle below) on the tool bar to view the microtuning. 

As you can see, at this point the microtuning is shown in cents and has no mapped pitches associated with it. If you are unfamiliar with the measurement of musical intervals in terms of cents, read this article for clarification: Cent (music).

2. Specifying the Reference Frequency for the microtuning and the MIDI Note Number on which it will be placed.


3. Specifying the MIDI Note Number on which the 1/1 Starting Note of a microtuning will be placed.

Now click the Opts button on the toolbar, which opens the User Options dialog; containing some of the most important features in Scala for specifying the way the specific pitches of microtunings will be mapped to our MIDI controllers.

In the leftmost column there are navigation buttons for selecting various User Options. Click the button labeled MIDI to access the functions for specifying the Keyboard Mapping Parameters. Now perform the following steps:

1.  In the Reference Frequency field, type 440. This will set our Reference Frequency to 440 Hz.

2.  In the Reference Note field, either type, or use the up and down selectors, to enter MIDI Note Number 69. What this does is specify that our Reference Frequency will be placed on MIDI Note Number 69.A and will have a pitch of 440 Hz.

3.  And finally, in the Note for 1/1 field, either type, or use the up and down selectors, to enter MIDI Note Number 60. What this does is specify that our microtuning will start on MIDI Note Number 60.C.

4.  In the Synthesizer Tuning Options (SEND) section, set the Tuning Model to: 112: TUN standard .tun format for many softsynths, via text file.

At this point we have completed the process of specifying the way our microtuning will be mapped to the MIDI controller as well as that we will create a TUN format file for our instrument. Next, click Apply, and then OK to close the User Options dialog.

It’s crucial to recognize that becoming familiar with this User Options / MIDI / Keyboard Mapping Parameters dialog is one of the most important steps in mastering how to configure full-controller microtunings with Scala, and the functions that are found here are relatively new additions which were not available when I wrote the original TUN tutorial in ’05. This dialog has greatly streamlined the process for setting up keyboard mappings by consolidating these features into an easy-to-use GUI-based group.

[Note: Being that 8-TET has equal steps of 150 cents, where the 1/1 is placed will not have an impact on the mapping in the way that it will with microtunings that have non-equal step sizes and more interval classes. We’ll examine these matters more as we progress through the other scenarios.]

4. Viewing the results of the Keyboard Mapping
Another powerful Scala feature is the ability to view the results of the settings we made in the User Options / MIDI / Keyboard Mapping Parameters dialog.

From the View menu, choose Keyboard Mapping (keyboard command Shift+Ctrl+K) to see the keyboard mapping parameters that will be applied to our TUN files.

We can also examine the entire Keyboard Mapping by using the View menu and choosing Tuning Dump Numbers (keyboard command Shift+Ctrl+V).

As you can see, this shows all of the MIDI Note Numbers from 0-127, the Cents Values and the associated Specific Pitches (Hz) that are mapped to each note. Since the creation of microtuning files for virtual instruments gives musicians and composers a repeatable, and therefore verifiable result, it is possible to use this mapping information to insure that an instrument is indeed playing the correct frequencies when a new intonation system is loaded.

Compare this frequency data to the 12-TET pitches that were discussed in the first article in this series – MIDI Notes, Pitches and Notation Standards – to see how we have now configured a completely new intonation system for our instruments.

5. Exporting the TUN File
Now that we have completely configured our microtuning and its keyboard mapping parameters, it’s time to export our TUN file.

1. Under the File menu, choose Export Synth Tuning (keyboard command Shift+Ctrl+T).

2. Using the Save File dialog, navigate to a directory on your computer where you want to save your TUN files.

3. Name the TUN file. In this case, name it “8-TET-Ref-69A-440.tun“.

4. Click OK and now we’ve completed the process of creating a TUN file for 8-TET with a reference frequency of 69.A @ 440 Hz. Now the TUN file can be loaded into the instrument.

As mentioned above, creating microtuning table files gives us a repeatable and verifiable result. Try setting your synth to a sine-waveform and place a software tuner after the instrument such as GTune, and using the frequency information from Step 4 above, start playing on middle 60.C and check the results of the tuning. It’s very informative to see and hear how different this is from 12-TET. Check the first couple of octaves, and you should see that your instrument is producing the below frequencies beginning with 201.7409 Hz and terminating on 806.9636 Hz:

    60.C  3: 5550      201.7409 Hz  !  0.0 cents      C.0
    61.C# 3: 5700      220.0000 Hz  !  150.0 cents  
    62.D  3: 5850      239.9117 Hz  !  300.0 cents    Eb.0
    63.Eb 3: 6000      261.6256 Hz  !  450.0 cents  
    64.E  3: 6150      285.3047 Hz  !  600.0 cents    F#.0
    65.F  3: 6300      311.1270 Hz  !  750.0 cents  
    66.F# 3: 6450      339.2864 Hz  !  900.0 cents    A.0
    67.G  3: 6600      369.9944 Hz  !  1050.0 cents 
    68.G# 3: 6750      403.4818 Hz  !  1200.0 cents   C.1
    69.A  3: 6900      440.0000 Hz  !  1350.0 cents 
    70.Bb 3: 7050      479.8234 Hz  !  1500.0 cents   Eb.1
    71.B  3: 7200      523.2511 Hz  !  1650.0 cents 
    72.C  4: 7350      570.6094 Hz  !  1800.0 cents   F#.1
    73.C# 4: 7500      622.2540 Hz  !  1950.0 cents 
    74.D  4: 7650      678.5728 Hz  !  2100.0 cents   A.1
    75.Eb 4: 7800      739.9888 Hz  !  2250.0 cents 
    76.E  4: 7950      806.9636 Hz  !  2400.0 cents   C.2

If your instrument is accurately reproducing these frequencies, then you have configured your microtuning correctly for this particular scenario.

[Note: The other scenarios that were originally intended to be a part of this article will be published at a later date.]


 Posted by at 9:36 pm

  7 Responses to “Microtuning Virtual Instruments – Part 4”

  1. This is an awesome tutorial! I hope you find time to keep your contributions coming. I don’t have a hardware-synth/keyboard, and would prefer to have a scenario listed for a free-software setup (free VSTi etc) [for WinXP].

    On the other hand, you might not have heard of Mus2, which is an awesome microtonal notation/composition software (which plays back the music)… but unfortunately requires too much computer to even run on my sub-Ghz processor.

  2. Hi,

    Thanks so much for the positive comments. Although lots of people visit these pages, you are the first to comment on this series.

    I am planning to continue writing the rest of the articles and there are many more important microtuning issues to discuss related to the other popular formats.

    Also in the works are new microtonal instruments in various states of completion, as well new music.

    Haven’t heard of Mus2, but I’ll try to research it soon. If you’ve got any microtonal tunes up on the web, feel free to make me aware of them.

  3. I would like to see these tutorials put more emphasis on raw sys-ex messages such as those from the controller.

    Also since many of the VST hosts tend to ignore sys-ex messages it would be helpful to list those that do service these messages.

    It would be helpful also if MTS sys-ex tuning examples were shown.

    Retuning by manually loading .tun files only ignores the versatility of MIDI automation and restricts players from rapid live performance retuning.

  4. Why is it that every preset bank or instrument file ( fxb, fxp ) loaded is deemed in invalid file ?

  5. FXB and FXP – bank and patch files – can only be opened with the virtual instrument they were created with.

    If in case you are referring to the Xen-Arts VSTi line, and in particular Xen-FMTS 1.0 and Xen-FMTS 1.1, the bank and patch files are not compatible, due to fundamental changes to the internals of the updated version, which is clearly and concisely mentioned in the plugin release documentation.

    For the record, I’ve never heard from any of the literally thousands of users of these instruments, about the FXB and FXP files created with a given plugin not loading into the instruments they were created with.

    If indeed you believe you have observed such behavior, write using the contact section above with specific and detailed information about your system specs, the plugins you are using and the circumstances, and especially it is important to email some examples patches and banks. As one can well imagine, it is impossible to diagnose what’s going on without it, but on the other hand, if the question is more general in nature about FXB and FXB files created with *any* virtual instruments, then please reference the first statement in this response.

  6. Jacky I meant to load other virtual instruments’ bank-files into XenFont in order to extend its sonic personality.

    Book suggestion:
    Musimathics: Volume 1 The Mathematical Foundations of Music
    Chapter 3 Musical Scales, Tuning, and Intonation

    Web suggestion:
    An Introduction to Historical Tunings

    Well v.s. Equal Temperament

    Why 12 notes to the Octave?

  7. Hi A,

    Yes – unfortunately this would be a case of them not working by virtue of being created with another plugin.

    The way these instruments work, is that each control of the plugin – the sliders, selectors, switches, etc. – has its own patch memory, and as well, each one has its own unique internal architecture. Because they are distinctly different from one another at this level, doesn’t permit their patches to work in other plugins.

    For what it may be worth, the way I have my version of XenFont configured, is that I’ve downloaded lots of SF2 banks and extracted the ones I wish to use in the music into its content folder (where its default SF2 and microtuning files are stored). This selection of SF2 banks constitutes a vast archive of possible oscillators that can used for custom sound-designs, and if one chooses to store other SF2 in the XenFont plugin content directory, they are centrally located and become immediately available for creating variations of the ‘factory’ bank.

    Often I enjoy combining the timbres from different SF2 banks in patches, and I’ve created many variations of the initial patches and banks using this method.

    Please feel free to make me aware of any music you create or publish using the VSTi; would love to hear it, and thanks for your reading list.

 Leave a Reply

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>