Defining Nonstandard Tunings

Tuning in MIDI is normally twelve-tone equal temperament. MIDI has no provisions to change this except by using the pitch bend control. In general, a different setting of pitch bend is needed for each pitch in a scale. Needless to say, this can be very tedious to program explicitly; however CMT has a way to automate the use of pitch bend to obtain the desired scale. Notice that pitch bend affects every note on a given channel; therefore, it is generally not possible to play several notes on one channel whenever alternate tunings are desired. (Ignoring this limitation can lead to some very interesting effects, however.)

The tuning mechanism in CMT is quite simple: whenever a program (Adagio, Moxc, etc.) goes to play a note, the note's pitch is used as an index into a table of [pitch, pitch bend] pairs. The pitch bend is sent, followed immediately by the pitch from the table. Using the table, it is possible to translate every specified pitch into an arbitrary pitch and pitch bend.

Important: CMT assumes that you have set up your synthesizer so that the pitch bend range is one semitone (100 cents) and that the synthesizer changes frequency exponentially with respect to the pitch bend value. If your synthesizer is different, it will be necessary to modify CMT to make its tuning mechanism more general. The current system seems to work fine with a DX7. The formula used to calculate the MIDI pitch bend data is

PitchBend = (8192 * c/100) + 8192,
where c is the pitch bend in cents (not the velocity of light).

A scale is defined by a ``tuning'' file ( .tun is the default suffix), which can be created with the help of the Tuning program described below. The format of the file is simple. Each line of text in the file consists of three numbers. The first is a note number (60 is middle C) between 0 and 127. The second is a pitch, also between 0 and 127, and the third is the pitch bend, between -100, and 100. Any pitches that are not mentioned in the file are given their normal equal-temperament interpretation.

To use a tuning file, say meantone.tun, you type the following option anywhere in the command line:

-tune meantone
If no tuning is specified, then notes are not translated and no pitch bend commands are sent.

The Tuning Program

The Tuning program lets you define scales in terms of ratios or cents.

You run Tuning by typing

tuning myscale
where myscale.tun is the name of the tuning file you want to create. (An extension of .tun will automatically be appended.) The program then prints:
You will now create a pitch file.

r - enter a range of values o - enter one octave (that will be generalized) p - enter one pitch (you choose) q - quit Command >>

To which you should respond with one of r, o, p, or q. The actions associated with each command are described below:

Entering a Range of Pitches

The r command prompts you for a range of pitches and then prompts you for a pitch and pitch bend for each pitch in the range. For example, The following is a transcript of what you would do to make C4 through D4 sound 1 step and 10 cents (110 cents) higher (user type-in is underlined):
Command >>r

Adagio note range is 0..127
What range of notes would you like to enter ?
From >> 48

To >> 50

For the given Adagio note number, enter the desired pitch
and the amount of pitchbend in cents
    Bend range =  -100 .. 100,  '0' for no pitch bend
         (100 cents = 1 semitone)
    Pitch range = 0 .. 127, 60 is middle C

Adagio Note 48 pitch >>49 bend >>10 Adagio Note 49 pitch >>50 bend >>10 Adagio Note 50 pitch >>51 bend >>10

Entering an Octave

The o command lets you enter information for one octave and then automatically transpose that information (by octaves) to provide information for all possible pitches. Here is an abbreviated sample transcript for a tuning in which every other note is 50 cents sharp:
Command >>o

You will input the information for one octave and that will be generalized for all octaves.

Would you like to enter the information as (1) frequency ratios of notes to a tonic or (2) semitones (integer) + pitchbend (in cents)

>>2

For the given note number, enter the desired pitch and the amount of pitchbend in cents based on given tonic

1 unit of pitch = 1 semitone -- the tonic (note 0) has pitch 0 and bend 0. Bend range = -100 .. 100 cents, 0 for no pitch bend (100 cents = 1 semitone)

Octave note 1 pitch >>1 bend >>50

Octave note 2 pitch >>2 bend >>0

Octave note 3 pitch >>3 bend >>50

-- six entries are omitted here --

Octave note 10 pitch >>10 bend >>0

Octave note 11 pitch >>11 bend >>50

What note would you like your octave to start on? C C# D D# E F F# G G# A A# B 0 1 2 3 4 5 6 7 8 9 10 11 >>0

Entering One Pitch

You can use the p command to modify just one pitch. This is useful to go back and change information you have entered with the r or o commands. Here is an example that makes A4 (pitch number 57) play an octave higher:
Command >>p

Adagio note range is 0..127.  Which note would you like 
to enter? (type return to quit)
Note >>57

For the given pitch number, enter pitch parameters Bend range = -100 .. 100 cents, 0 for no pitch bend (100 cents = 1 semitone) Pitch range = 0 .. 127, 60 is middle C

Adagio note 57 pitch >>69 bend >>0

Adagio note range is 0..127. Which note would you like to enter? (type return to quit) Note >>

Saving a Tuning File.

When you are done, use the q command to save the tuning file:
Command >>q

As discussed above, you can use the resulting file with Adagio, and Moxc to control tuning.

The Retune Program

A simple demonstration program is included with CMT to allow you to ``retune'' a MIDI controller. To use it, you should connect a MIDI keyboard (e.g. a DX7) to MIDI IN or your computer interface, and connect MIDI OUT of the interface to a synthesizer (e.g. a TX816). Run Retune by typing:
retune -tune myscale
where myscale.tun is a tuning file previously created. Now, as you play on the controller, the Retune program will use pitch bend in real time to adjust the pitch of each note.

Note: The Retune program is in the app/test directory. Also notice that since pitch bends apply to the whole keyboard, polyphonic notes interfere with one another.


Previous Section | Next Section | Table of Contents | Index | Title Page