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 meantoneIf no tuning is specified, then notes are not translated and no pitch bend commands are sent.
The Tuning ProgramThe Tuning program lets you define scales in terms of ratios or cents.
You run Tuning by typing
tuning myscalewhere myscale.
tunis the name of the tuning file you want to create. (An extension of
.tunwill automatically be appended.) The program then prints:
You will now create a pitch file.To which you should respond with one of
r - enter a range of values o - enter one octave (that will be generalized) p - enter one pitch (you choose) q - quit Command >>
q. The actions associated with each command are described below:
rcommand 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
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
for a tuning in which every other note is 50 cents sharp:
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)
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
pcommand to modify just one pitch. This is useful to go back and change information you have entered with the
ocommands. 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:
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 myscalewhere myscale
.tunis 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.