Tutorial: Microtonality in the IT format

Introduction
Welcome to this microtonality tutorial. Here, microtonality is simply using notes other than the 12 chromatic notes that are available in OpenMPT, largely being achieved with portamento effects. If you can read the title, you are in good standing, as this will be focused on the ‘.IT’ Module Format. However, you can use the concepts in this tutorial in the ‘.XM’ Format format as well, but the portamento command letters will change. Microtonality by assigning many tuned samples to an instrument will also be briefly covered.

It is assumed you understand the basics of using OpenMPT. If this is not the case, and you are wondering how to put in notes or effects, it is recommended to first read this Beginner's Tutorial.

A few microtonal systems will be covered, but no time will be spent on whether they sound ‘good’ or debate what the definition of ‘microtonality’ is, etc. This tutorial will not go into depth on microtonality. It is recommended to read This Xenharmonic Wiki Article and do independent research on the subject if further interest is aroused.

NOTE: If you are already comfortable with theory/microtonality and know how to enter some portamento, then skip straight to Implementing Systems - When it is finished of course!

Here are some helpful links on the subject if you are interested:
 * Introduction to Historical Tunings
 * The Xenharmonic Wiki
 * Harpsichord Temperaments

Portamento
Ok, so microtonality means we need to find out how to get to the new notes by using portamento. How exactly is this done? What values do we need to set?

Before we do anything, you need to go to your song properties and turn on Linear Frequency Slides. This makes portamento effects on every note uniform, and surprise, only works in the XM, IT, and MPTM formats.

Second of all, it is time to become very familiar with the portamento effect, which is explained here. The portamento commands have, for our purposes, 3 types of input:


 * 1) Coarse Sliding
 * 2) Fine Sliding
 * 3) Extra Fine Sliding

We will be using exclusively 2 and 3, as coarse sliding has too drastic a range and depends on the speed of the song as well, better suited for ‘cool slides’ on melody or something. We are going to be working with intervals smaller than a half-step (semitone), and the precision of fine and extra fine sliding is what is needed.

To put portamento on a note, put down a note with any instrument you want, then put the effect as shown below.

ModPlug Tracker IT
 * C-501...EF4

Although this may appear to be the note C-5, middle C, it is now actually a note slightly lower in pitch. This is due to the portamento command on it. EF4 means:


 * (E) - Go down in pitch. F is used to go up instead.
 * (F) - Use fine sliding. We will use this and ‘E’, extra fine sliding, only.
 * (4) - Go down 4 fine steps, which is 1/4 of a half-step (more on this later).

Breaking these portamento commands down and analyzing each letter and number will be important for correct and quick recognition in a pattern. Microtonal music is going to have LOTS of these commands, sometimes on every single note.

ModPlug Tracker IT
 * D-401......
 * C#401...FFF
 * F#401...FE8

Here we start off on a plain note D, but the next note may be a surprise. It sounds almost identical to the note before it! This note is going up in pitch by 15 fine steps, which is the maximum range of fine sliding portamento. If these two notes sound nearly the same, are 15 fine steps the same as 1 half-step? The answer is no, because there are 16 fine steps in a half-step (a new OpenMPT note). This misconception is actually very important for microtonality and this entire tutorial, as notes may not be exactly right but still sound the same (almost). All of our work is going to be done with approximations; nothing exact.

You should be getting familiar with the portamento effect syntax or at least practicing it, as you should recognize that the third note is an F# 8 extra fine steps lower than normal. What you may not know yet is how the values relate. The relation is simple in that there are 4 extra fine steps in every fine step. With 16 fine steps making a half-step, there are a total of 64 extra fine steps per half-step. There is a limitation however. Both commands have a max value of 15, or F in the hexadecimal notation. You will not be able to make a slide of more than 15 extra fine steps in a single command. Seeing how microtonality regards new notes as real notes instead of “cool slides”, all of our notes will only use one portamento command. The solution is that outside of the range of 15 extra fine steps, we will instead use fine steps with a higher loss of accuracy on notes. Fine steps are preferred to be written more than extra fine steps, so extra fine steps in multiples of 4 will instead be written as fine steps.

Because there will be so much portamento, there will be very little room for other types of effects. Taking advantage of things like envelopes, volume column commands, and song properties will help retain quality of the module. Volume column portamento is extremely coarse and is therefore not an option. There are also some effects that combine portamento with another effect. These will become very useful to you if never used before.

Note: For the XM format, you can do everything in this tutorial as well. The one important thing that changes are the actual letters for the portamento commands. FF becomes E1, EF becomes E2, FE becomes X1, and EE becomes X2.

Intonation
Once you become adept in using portamento, it is time to figure out what new notes are going to be played. If you have ever played an instrument or maybe love sound engineering or something, you will know that notes can be tuned, lowered or raised in pitch. Now music has evolved from cavemen banging on rocks, so tunings on multiple notes leads to something called tunings (cavemen used sticks for this). Tunings will be simply explained here as a set of defined pitches for many notes. For example, if I play an ‘A’ on a piano, I expect to hear such instead of a ‘D’ or a grossly mistuned ‘A’. OpenMPT outside the MPTM format and (most) modules in general all share the same tuning, but first we must cover intervals.

An interval is the difference in pitch between two notes. Intervals are also important enough that they have names. For example you may recognize this interval being discussed in the previous section:

ModPlug Tracker IT
 * C-501......
 * C#501......

This is normally the smallest interval available in OpenMPT, called a half-step. However we want to give intervals new names besides just steps. Intervals are named based on their relation to some other note, this case being the C-5. We will call this interval the minor second, abbreviated to m2. We will also give this interval a number, as if it were in a list: (1). Why is this number (1) and not (2)? This is because we will start our counting at (0), which means the C-5, the base of the interval.

ModPlug Tracker IT
 * G-501......
 * A-501......
 * B-501......
 * D-601......

We have some more intervals here, the first being from G-5 to A-5. We will call this the Major second, or M2, and give it the number (2). G-5 is the base note here, and is still (0). The next note, B-5, leads to an interval of a Major third, M3, with G-5, and the number (4). You may have figured out now that the number is really just counting the half-steps from the base note to the new one, which B-5 is 4 half-steps away from G-5. The last interval with D-6 is a Perfect 5th, P5, and you can guess the number (7). Don't let the ‘Perfect’ bother you, as this interval actually is not. But enough with memorizing cool names now, there is a chart of them in the later sections. All of the important intervals are covered now anyway, except the most important two.

You did not learn this for nothing, as tunings are going to define their set pitches by the use of intervals. The difference in the pitch of notes is going to be by frequency, as OpenMPT plays higher-pitched samples faster than lower ones. You can think of the faster samples as being ‘more frequent’ or whatever. Note that frequency is not entirely what determines the sound for a sample, only the pitch.

Intervals have cool names and numbers, but they will need yet another number attached to them. This number is not for human identification, but rather for actually determining the pitch or frequency of the interval. This is the interval‘s “ratio”, and is the part that matters for a computer. Ratios will be covered more, later.

With the fanciful names from before, OpenMPT actually only has two Perfect intervals. The first is called the Unison, U, (0), and is just the same note again. How exciting. The real star of the show is called the Perfect Octave, P8, (12). The number, of course, tells you that this is what happens when you make an interval of 12 half-steps in a row:

ModPlug Tracker IT
 * E-401......
 * E-501......

You get the same letter for the note, but the number increases by 1! You should know that this number on every note in OpenMPT is the octave number, even more stress for its importance. The reason this ‘Octave’ is called Perfect is because its ratio (vocabulary from only 2 paragraphs ago!) is 2, a simple whole number. The sample for E-5 plays 2 times as fast as E-4, twice the frequency.

If you can reach an octave in 12 half-steps, does that mean you can reach a truly Perfect 5th in 7? The answer is no. The P5 reached in 7 half steps is imperfect, as mentioned before. Why is this though? The octave has a ratio of 2, so what is the P5 ratio, 7/12? 12/12 = 2, sounds good? Too bad that is wrong; the ratio is actually not a fraction, but 27/12. That is right, the interval has a ratio that is an exponent of 2, so after (12) half-steps, the perfect 2 is still achieved in a different manner. However, several conclusions can be reached from this:


 * 1) Every interval in OpenMPT besides Unisons and Octaves have ratios of the form 2N/12. Unisons and Octaves technically do as well, but they reduce.
 * 2) Unisons and octaves are therefore the only OpenMPT intervals that can be considered rational, a fraction.
 * 3) The “Perfect” in P5 is just a name, happening to stem from old nomenclature, rather than a description of its ratio.
 * 4) Truly perfect ratios are rational.

We can stem directly off the conclusion about names. “Perfect 5th” is just a name that will be used because the name stuck from the past. However, seeing how this is a microtonality tutorial, we are going to be talking about the Truly Perfect 5th, which was also used in the past. It turns out the ratio of 27/12 is very close to a simple fraction, 3/2. This is the value of the Truly Perfect 5th. The intervals discussed before also have ratios very close to simple fractions, to be covered later.

It turns out now with interval names and ratios under our belts, we actually have all we need regarding intonation. Every note in every system discussed here will be defined by their ratios, and most will be classified with the standard naming (and numbering) system. How do we actually get a P5 (7) with ratio of 3/2 though, you may wonder?:

ModPlug Tracker IT
 * F-401......
 * C-501...FE1

We are going to use that ancient tool, portamento, for the task! The portamento command on the C-5 causes it to form a Truly Perfect 5th with the base note, F-4. Except, we still failed. This ratio is not 3/2. It is just barely below 3/2, with human ears barely able to tell the difference. The point is, for the IT module format, we will get very close to these rational intervals but never exact. Exact will only happen for the Unisons and Octaves, as they do not even require portamento.

Octave Transposition
We know about the Perfect Octave, P8 (12), and how notes of different octaves are considered as the same note. C-5 and C-6 are both considered to be the note ‘C’, but are different by an octave. This relationship is called octave equivalence. Due to this, we can change the octave of notes as we see fit.

ModPlug Tracker IT
 * C-401......
 * C-501......
 * C-401......
 * C-301......
 * C-501......
 * C-301......
 * C-501......
 * C-301......

Ratios affected by moving notes up or down an octave, or transposing by octaves, are pretty easy to calculate. For a note moving up an octave, such as the C-4 moving to C-5, the ratio doubles. So if the C-4 has a ratio of 1, C-5 has a ratio of 2.

So far we have only dealt with ascending ratios however; we will want to be able to lower notes as well. To bring a note down an octave, its ratio will be halved. So to change C-4 into a C-3, the ratio goes from 1 to 1/2. The C-5 moving to a C-3 is moving down by two octaves, so you need to halve the ratio twice. 2 down an octave = 1, down another octave = 1/2.

For this tutorial we will usually want to keep everything in the range of a single octave, as it makes things generally easier and some intervals would be extreme without octave reduction.

Inversions
We should have portamento, intervals, octaves, and hopefully basic number skills under our belts now. Memorizing interval names can happen over time, I even provided a great chart for that in a later section. There is one operation we would like to know as well: inversions.

“Inversion” has several different meanings depending on the context, such as with intervals, melody, or harmony. To keep this simple and on task, we will only be doing one type of interval inversion called the “transpositional inversion”. We will refer to all future transpositional inversions as just “inversions”. (For those more familiar with music theory, this is a melodic inversion with the second note octave transposed to stay within the same octave.)

ModPlug Tracker IT
 * C-501......
 * G-501......
 * C-501......
 * F-401......
 * C-501......
 * F-501......
 * C-501......
 * F-501......

Above we have C-5 to G-5, a standard P5 (7). This is the interval we want to do our special inversion on. To carry out an inversion, follow these steps:


 * 1) Find out if the interval is ascending or descending. G-5 is a higher note than C-5, so this interval is ascending.
 * 2) Count the number of half steps in the original interval, which for P5, is (7).
 * 3) Make the new interval the opposite direction, so since the original was ascending, this interval will be descending.
 * 4) Move by the same number of half steps, (7)

You will end up with the second set, C-5 to F-4. We have only done the inversion part so far though; we need to do the transpositional part as well. To do this, we will use octave transposition and get F-4 to be in the same octave as G-5. This is simply done by raising F-4 one octave to get F-5. Now the interval is ascending again, as well as inverted. This new interval is called the Perfect Fourth, P4 (5). Notice that the half step count is (12) - (7) = (5), and that a perfect interval inverts to another perfect interval.

As far as the ratios of these notes, the ratio for a P5 (7) is 3/2. We will only need half as many steps to follow to handle this process, one for each word.


 * 1) Take the reciprocal of the ratio, 3/2-1 = 2/3
 * 2) Octave transpose to get to the original octave. Between C-5 and C-6 is between 1 and 2. Raise 2/3 by one octave to get 4/3. (2/3 * 2)

The resultant ratio 4/3 is the ratio for a P4 (5).

So why do we really want to learn this operation? The most practical use is that an inverted interval keeps the same portamento as the original, but in the opposite direction. For example:

ModPlug Tracker IT
 * C-501......
 * G-501...FE1
 * C-501......
 * F-501...EE1
 * F-501...EE1

The P5 (7) has a portamento of FE1. When inverted to a P4 (5), the only thing that changes about the portamento is the first letter, in this case an F changing to an E. The portamento size is still the same, E1.

Because of this property, for any set of intervals or a tuning, you can figure out half of the set and then find the other half by inverting. If we know that a M3 (4) has a portamento of EF2 and ratio of 5/4, we can invert it to find the minor 6th, m6 (8), and its portamento of FF2 and ratio 8/5. We can figure out the whole set just with half of the notes, although we need the first, middle, and last notes.

Dyads & Chords
So far we have only played notes sequentially, not at the same time. Now that we have the tools necessary to enact microtonality, we can quickly cover some basic microtonal harmony and how things will generally work.

ModPlug Tracker IT ModPlug Tracker MPT
 * C-501......|G-501......
 * C-501......|F-501......
 * C-501......|F-501......

When two notes are played at the same time, it is called a “dyad”. The notes being played together does not change much, we can still carry out our previously discussed operations. C-5 to G-5 is still a P5 (7), so we can invert it to form a P4 (5), C-5 to F-5. Just think of everything happening on the same line rather than multiple.

ModPlug Tracker IT
 * C-501......|E-501...EF2

Portamento will be applied individually to the notes that require it, each note is independent. This example is a Major 3rd, M3 (4), but nearly perfectly in tune. I recommend you listen to this dyad and compare it to a normal M3 (4) without the portamento. If you have never heard a perfectly in tune M3 (4) before, this might sound better, mellower, out of tune, or whatever. It is up to you to make these judgements, although I recommend you put aside bias and be open to hearing new things. After all, you are reading a microtonality tutorial.

ModPlug Tracker IT
 * C-501......|E-501......|G-501......
 * C-501......|E-501...EF2|G-501...FE1
 * C-501......|E-501...EF2|G-501...FE1

When three or more notes are played together, this is called a “chord”. The first chord above is called a Major triad, as it consists of a base note, C-5, with a M3 (4) and a P5 (7). However, it is made up of the normal OpenMPT notes, with ratios of 24/12 and 27/12. We want to hear the more in-tune version, the Just Intonation version.

The second chord has two portamento effects defined on the M3 (4) and P5 (7). We've seen both of these more in-tune notes before, but not played at the same time. Give the second chord a listen in OpenMPT. The more perfectly in tune E-5, which we heard earlier, will most likely be more noticeable a difference than the G-5. This is because EF2 is much stronger a portamento than FE1, and therefore more noticeable. The second chord is only an approximation to a perfectly in tune Major triad, but much more close than with OpenMPT's normal notes. The ratios of the second chord are around 5/4 for the M3 (4), and 3/2 P5 (7).

Note that inverting a chord of three or more notes will not have much use for this tutorial, so inversions will be used only on intervals between two notes and dyads. You can of course octave transpose any note of a dyad or chord, which will also result in a slightly different sound.

Harmonic Limits
We know a few ratios for certain types of notes, such as 3/2 for P5 (7) and 5/4 for M3 (4). Covering more on which notes are what ratios will come in a later section, but there is one property that we will want to cover before we get there: The Harmonic Limit.

This topic can be explained easily with a little bit of math, most notably, prime factoring. You can factor the numerator and denominator, and thus the ratio as a whole, into a product of prime numbers. Two examples: 5/4 factors into (5) / (2*2), and 64/35 factors into (2*2*2*2*2*2) / (5*7), or (26) / (5*7). The first few primes are 2, 3, 5, 7, 11, 13, 17, and 19, with primes higher than this rarely encountered (unless desired!).

The harmonic limit of a ratio is determined by the biggest prime factor in either the numerator or denominator, notated as N-limit. So because 64/35 = (26) / (5*7), this ratio belongs to the 7th harmonic limit; it is a 7-limit interval. 5/4 is only 5-limit, as its biggest prime factor is 5.

Ratios of a certain limit will not reach a higher limit through multiplication or division (going up or down by an interval). You can go up or down by the intervals 3/2 and 5/4 many times, but you will never reach the 7th-limit, only ending up with a 5-limit (or 3-limit if only 3/2 is used) ratio in the end. This is relevant, as the system OpenMPT uses is not very accurate in representing ratios beyond the 5-limit. Accurate 7-limit intervals and higher will almost surely need microtonality and portamento.

Straining yourself on the concept of the harmonic limit will not be necessary. It is mostly here as a definition to be referenced, as limits will be mentioned in this tutorial.

Getting Started
We now have the necessary theoretical knowledge to begin learning how to make microtonal music in OpenMPT, as well as skill in portamento effect usage. Surprising or not, you can make most of your music exactly the same way as before. With microtonality, you just have new notes to choose from instead of the familiar 12. Drums, synths, strings, pianos, voice, etc. will all still be viable, and all genres still accessible.

---unfinished part

This is how you make a just intonation Major triad:

ModPlug Tracker IT
 * C-501......|E-501...EF2|G-501...FE1

Portamento will also be used for melodies:

ModPlug Tracker IT
 * C-501......
 * E-501...EF2
 * F-501...EE1
 * G-501...FE1

links ref: conversion charts Implementing Systems

Just Intonation
(Almost) Pure intervals instead of tempered ones.

For Just Intonation, just figure out of the intervals you want to use in the conversion charts. This section will be written up later, along with a math formula to calculate the portamento for any obscure interval so desired.

Here is a comparison of a normal, 12-edo major triad, and the just version.

ModPlug Tracker IT
 * C-501......|E-501......|G-501......
 * C-501......|E-501...EF2|G-501...FE1
 * C-501......|E-501...EF2|G-501...FE1

Here is how you make a perfect 7th tetrad:

ModPlug Tracker IT
 * C-501......|E-501...EF2|G-501...FE1|A#501...EF5

Note that perfectly in-tune Just Intonation is only possible in the .MPTM format. These are just extremely close tempered notes.

Meantone & Well Temperaments
All well temperaments will have the note ‘C’ as their base, but you can easily change the base to any other note. If you imagine the inner portamento circle being free to rotate, you can rotate it from the top ‘C’ to another base note. Wolf intervals should be between G# and Eb unless otherwise noted.

To use a well temperament, compare any notes you use to the picture and give it the appropriate portamento effect. All octaves are perfect on well temperaments, so there will only be 12 types of notes.

1/4 Comma Meantone
Wolf fifth is between Eb and G#.

24-edo (Quarter Tones)
This is the 24-edo chromatic scale. Twice as many notes to use now:

ModPlug Tracker IT
 * C-501......
 * C-501...FF8
 * C#501......
 * C#501...FF8
 * D-501......
 * D-501...FF8
 * D#501......
 * D#501...FF8
 * E-501......
 * E-501...FF8
 * F-501......
 * F-501...FF8
 * F#501......
 * F#501...FF8
 * G-501......
 * G-501...FF8
 * G#501......
 * G#501...FF8
 * A-501......
 * A-501...FF8
 * A#501......
 * A#501...FF8
 * B-501......
 * B-501...FF8
 * C-601......

There are now 24 quarter steps in an octave. A quarter step will be achieved with portamento commands of EF8 (lower) or FF8 (raise).

Non-Octave Systems
Non-octave systems are difficult in the IT format.

Basically for non-octave systems, you need to pick a base note (C-5 is always good), and then all portamento should be defined in relation to this base note.

Bohlen Pierce uses a tritave instead of an octave, ratio of 3 instead of 2. Figure out the step size between two notes, and then that will be your fundamental way of calculating every note. The step will probably have to be rounded to a fine portamento step.

Scales with no repeating octave-like interval, such as Wendy Carlos’s alpha scale, will also need their step size calculated. Rounding this step to a fine portamento step is encouraged do to the limited scope of extra fine portamento.

Other Systems
If you like your note ‘A’ being 432 Hz, 420 Hz, 445 Hz, or 415 Hz, etc., then it is much easier to just tune your samples rather than with portamento. To even further discourage this, adjusting the standard ‘A’ through portamento might affect the usable ranges of extra fine portamento, meaning less precision.

With the conversion charts you can pretty much do anything you need. Figure out step sizes of Equal Temperaments by knowing that EF1 or FF1 = 100/16 of a cent, or 21/192. For example, a Quarter Step is 50 cents = 21/24, so it needs FF8, as 8 * 100/16 = 100/2 = 50 cents. Remember that a new note = 100 cents, so use that to get past the maximum of EFF or FFF, 93.75 cents. EE* or FE* can be used for steps smaller than 25 cents, as each value here is 100/64 = 21/768

Note that for a lot of Equal Temperaments like 7-edo or 22-edo, step sizes will need to be uneven to keep portamento on one line. You can do this by making one portamento step larger than all the rest, just make sure everything adds up eventually to the octave. The error will hardly be noticeable anyway. N steps in N-edo needs to add up to 1 octave. 22-edo is a good example of an edo that will be difficult to do in general, as the 54.5 cent step is just inbetween FF8 and FF9. Careful work will need to be done balancing the steps and chords.

How to Use the Conversion Charts
First column: The interval that the conversion is for. This can be a named note, or just the ratio as noted below.

Ratio: The note's frequency in relation to the base note, or fundamental. The fundamental can be any pitch or note, such as C-5 or G#2 or anything else, but for these charts it will always be ‘1’. For example, a perfect third has a value of 5/4 in relation to a fundamental of 1. This is because it is the 5th harmonic, taken down two octaves (as an octave is the 2nd harmonic, so 2 * 2 = 4), and the fundamental will always be 1 here. The ratio here will always be in range of an octave.

Note to use (12-edo number): This is the closest note in 12-edo to use the portamento command on. The reason you would want to use this note is that Fine and Extra-Fine Portamento have a limited range, and outside that range is where precision is lost. Two ways of classifying the notes are given. The first is the tonal interval in relation to the fundamental. Examples would be the Unison - The fundamental, minor 2nd (m2) - a half-step above the unison, such as C#5 above C-5, or the Tritone (T), such as D#6 above an A-5. The second number in parenthesis is the 12-edo number starting from 0 (0,1,2,3,4,5,6,7,8,9,10,11). This just numbers half-steps above the fundamental, such as (4) being E-5 above C-5 or (11) being F#8 above G-7.

Here is a helpful chart:

Portamento Command: This is the portamento effect you will put on the Note to Use. This command is calculated to be as close as possible to the target note in a single command, with a small error. Target notes not within Extra Fine Portamento Range will have more error. Error will never be larger than one Fine Portamento step (a ratio of 2^(1/192)).

Quick & Common Reference
Here is a condensed table with some important notes for quick reference.

Harmonics
Most octaves of odd harmonics (such as 6 & 10 for example) are not listed.

Conclusion
That’s it for now. If you have any questions, feel free to ask them at the forums or private message me there. Make sure you check out the websites in the Introduction for more information about what possible tuning systems you can use and such, or if you still are having trouble with microtonality in general.

MPTM Format
If you really want your just intonation to be perfect, or loathe putting in portamento, you be might interested in the ‘.MPTM’ Format. While it is an exclusive format for OpenMPT, it has support for custom tunings, making microtonality much less of a hassle than it is in the IT format. Its exclusivity means it is not supported well by other trackers and players though, so weigh your options accordingly. (MPTM tuning tutorial coming after this one, put link here)

Here is a tuning pack for .mptm in case you want to compare or look at a list of some tuning systems available. You can look at the tunings with OpenMPT, and with a little portamento math, effectively recreate any tuning.