next up previous contents
Next: SMF Mode Up: Intonation Software Previous: The Score Description Language

MIDI Tuning Technique

A MIDI Note On message does not specify a frequency. Rather it specifies a pitch in a 128 element pitch set whose elements are identified by integers in the range 0...127. All MIDI synthesizers provide the relative tuning $\ensuremath{\ensuremath{\underline{\tau}}_{{}}\!\left(n\right)} = n/12$ with a range of reference frequencies such that n=69 (the pitch normally associated with A4) is tuned to around 440 Hz.

In addition to this default tuning, many synthesizers can map the MIDI pitch set to frequency ratios defined by the user. These can usually be defined via front panel controls or System Exclusive messages. Unfortunately, although there is a proposed MIDI Tuning Standard, all manufacturers implement these tuning capabilities using different System Exclusive message formats.

A design goal of Helm was to be synthesizer independent. As such, the System Exclusive tuning technique was not a viable option. In addition, the System Exclusive technique can only be used to realize pieces with less than 128 distinctly tuned pitches. In practice, this would probably be sufficient, but it is best not to have such limitations.

Instead of the System Exclusive technique, a technique was used whereby the default tuning ($\ensuremath{\ensuremath{\underline{\tau}}_{{}}\!\left(n\right)} = n/12$) is dynamically adjusted via Pitch Bend messages. A Pitch Bend message sends a new pitch bend state to a single channel. A pitch bend state is an integer in the range $-8192\ldots 8191$. At time t, the tuning of a pitch n on channel c is

\begin{displaymath}
\ensuremath{\ensuremath{\underline{\tau}}_{{}}\!\left(n\right)} = n/12 + a\left(\frac{P(c,t)}{8192}\right) \end{displaymath}

where P(c,t) is the pitch bend state of channel c at time t and [-a,a) is the pitch bend range.

The pitch bend range, as defined by a, is adjustable via a standard System Exclusive message. We use a=1/6, which is the default on most synthesizers anyway. (For reference, \ensuremath{\ensuremath{\underline{\tau}}_{{}}\!\left(\mbox{M2}\right)} = 1/6 in 12TET.)

Thus if we wish to play a pitch with frequency ratio r, we find the pitch n whose unadjusted tuning (n/12) is closest to \ensuremath{\underline{r}} and then we find the pitch bend value p that most closely adjusts this tuning towards \ensuremath{\underline{r}}. More formally,

\begin{displaymath}
n = \mbox{rnd}(12\ensuremath{\underline{r}}) \end{displaymath}

\begin{displaymath}
p = \mbox{rnd}\left(8192\:\frac{\ensuremath{\underline{r}} -...
 ...\right) = \mbox{rnd}(49152(\ensuremath{\underline{r}} - n/12)) \end{displaymath}

where $\mbox{rnd}(x)$ is any rounding operation, such as

\begin{displaymath}
\mbox{rnd}(x) = \lfloor x+1/2 \rfloor. \end{displaymath}

Once we find n and p, we send out a pitch bend of p followed by a note on of n on the same channel.

This uses only about a quarter of possible pitch bend range since $\ensuremath{\underline{r}} - n/12$ is limited to [-1/24,1/24). This ``headroom'' was left so that future versions of the program could incorporate melismatic intonation, the adjustment of the intonation of a note while it is playing. Melismatic adjustments could exceed the pitch bend range if headroom is not provided.

With a=1/6, pitch bends can adjust tuning in increments of about 0.02 mil. For all practical purposes, this provides continuous resolution, because this is a very small frequency ratio. In practice, tuning resolution is limited not by the finite precision of pitch bend but by synthesizer implementation, which often throws away some of the lower bits of pitch bend.

In this sense, Helm is somewhat synthesizer dependent since it relies on precise pitch bend response. Although MIDI puts an upper limit on this precision by limiting pitch bend messages to 14 bits, it does not put a lower limit on it. For instance, some synthesizers are known to discard the entire lower 7 bits of pitch bend. This leads to unsatisfactory resolution for use with Helm. This work used the Creative AWE32 and E-mu Morpheus synthesizers, both of which had adequate pitch bend resolution. Although the Morpheus was not tested, the AWE32 was found to have a resolution of about 0.3 mil.

In order to use the pitch bend tuning technique, simultaneous notes that require distinct pitch bends must be played on different channels. This limits the polyphony to 16 notes in the worst case. Larger polyphony can be accommodated if some of the simultaneously sounding notes are separated by a doubling since these notes can be played on the same channel.

Certain multitimbral situations can be tricky to realize using this technique. These are situations in which the sum of the polyphony of each timbre is greater than 16. For example, consider a piece that has a 9-note chord in one timbre followed by a 9-note chord in another. The instantaneous polyphony of this piece is only 9, but the sum of the polyphonies of each timbre is 18. In situations like this, program (timbre) changes as well as pitch bend changes must be sent between notes of the piece. This can clog the MIDI stream, and some devices may not switch programs quickly enough to make such adjustments feasible. If the sum of the polyphonies of each timbre is 16 or less, timbres can be statically assigned to channels and there is no problem.


next up previous contents
Next: SMF Mode Up: Intonation Software Previous: The Score Description Language
Ben Denckla
8/29/1997