Playing in the Cracks

EM discusses the software tools that you can use to make music with alternate tunings. We also describe specific techniques for working with Csound, Native Instruments Reaktor, and other programs, and we point you to Web sites where you can learn more.
Author:
Publish date:

Computers offer musicians such an endless smorgasbord of resources that it's easy to overlook some fascinating possibilities. One topic that doesn't get talked about much is using a computer to explore alternate tuning systems. In this column I'll discuss some of the software tools that you can use to make music in alternate tunings. I'll also explain a few of the techniques that I've developed, and I'll point you to Web sites where you can learn more.

TUNING UP

First, it's important to understand the phrase alternate tunings. Most musicians today take our 12-note-per-octave, equal-tempered (evenly divided) scale for granted. But there's nothing natural or inevitable about such a system; it's a very effective compromise tuning system, or temperament, that became popular in Europe during the 18th century. Any system other than this temperament qualifies as an alternate tuning. In other words, some or all of the notes in an alternate tuning will fall “in the cracks” between the keys on a conventional keyboard.

When people hear that description, they sometimes nod sagely and say, “Oh, you mean quarter-tones!” Actually, quarter-tone tuning, in which each equal-tempered half step is split into two equal parts, is one of the least interesting alternate tunings. Its frequency spectrum isn't inherently stepped, or quantized, at all. Rather, it's a continuous rainbow of pitches. A pitch that falls between two of the keys on the equal-tempered keyboard can be tuned to any frequency value at all, not just to an equal-tempered quarter-tone.

You can play notes that are “in the cracks” using a Pitch Bend wheel. If you're a guitarist, you can get to them by bending the strings. But those techniques can be inconvenient. What if you want to play a chord in which each note requires a different amount of Pitch Bend? You can't do it.

What makes such chords musically powerful is that their intervals have distinct colors. They can be sweet, sour, bright, or harsh, in ways that conventional 12-note equal-tempered intervals and chords can't match. Once you've heard a few of these intervals in action, you'll never perceive standard chords in the same way again. In fact, a word of warning may be in order: experimenting with alternate tunings can spoil you. You may start noticing how ugly a major triad on a piano or synthesizer can sound.

Going into a full discussion of tuning theory would take up far more space than we have available here. (Allaudin Mathieu's book Harmonic Experience provides a good overview, as does David B. Doty's Just Intonation Primer, available from the Just Intonation Network, www.justintonation.net.) Briefly, we can talk about two types of alternate tunings: equal-tempered scales and just intonation.

In an equal-tempered alternate tuning, the octave is divided into more (or fewer) than 12 steps, but the steps are still equally spaced. Tunings with 19 and 31 notes per octave are especially interesting, but it's difficult to play music in those tunings on a standard MIDI keyboard because one octave of notes will be stretched across an octave and a half or more of keys. Using MIDI sequencing is a practical option, however.

Just-intonation tunings can be played from the keyboard, because the number of scale steps per octave is up to you. What distinguishes these tunings is that the intervals are based on pure mathematical ratios. For instance, the ratio of a perfect fifth is exactly 3:2, and a major third is 5:4. So if a given note is vibrating at 100 Hz, the major triad that uses that note as a root will include a third vibrating at exactly 125 Hz and a fifth vibrating at exactly 150 Hz.

By contrast, 12-note-per-octave equal temperament is based on the 12th root of 2, which is an irrational number (it's about 1.059463). So a “perfect fifth” on a piano or a typical MIDI synth isn't perfect at all. If the fundamental is at 100 Hz, the fifth is at 149.83 Hz — just slightly flat compared with a 3:2 fifth. The major third in this temperament is noticeably sharp; what should be 125 Hz is actually 125.99 Hz.

The result: all intervals in our conventional tuning have built-in “beats” (interference patterns) between the frequencies. I've recorded a few MP3 files so you can hear the differences between equal temperament and just intonation. To learn more, a good place to start is the Just Intonation Network.

HARDWARE TUNE-UPS

Over the years, numerous MIDI synthesizers that supported user-programmable alternate tunings have come and gone. Yamaha's DX7II/TX802 line had especially useful tuning tables, because they allowed each key in the full MIDI range to be tuned to any pitch. In other words, they weren't limited to 12 repeating notes in every octave. The most tunable synths that I know of in the current market are the E-mu Proteus 2000 series, which include 12 full-range tuning tables.

The tuning tables in hardware synthesizers suffer from some limitations that make exploring tunings a bit awkward. The tables are almost always calibrated in fractions of an equal-tempered half step (usually 64, 100, or 128 increments per half step) rather than using raw frequencies. To get a pure interval, you have to apply a mathematical formula (more on that later) or use your ears. Even then, intervals that appear to be the same size based on the settings in the LCD may be slightly different because of the way the synth calculates its pitches.

Some of the newer synthesizers can change their tuning in response to MIDI microtuning messages. Most allow their tuning tables to be edited on the fly as part of their own System Exclusive implementation, so you can embed SysEx data in a sequence if you need more than one tuning in a given piece.

Even when a tuning table is active, however, all of the instruments I know of continue to set the depth of their response to MIDI Pitch Bend data in equal-tempered half steps. Setting up a Pitch Bend processor that “knows” about the current tuning is not especially difficult. You can do it yourself with a software-based modular synth, but the details are beyond the scope of this column.

SOFTWARE TO THE RESCUE

There are several software solutions with which you can explore alternate tunings. Cycling '74 Max/MSP, Native Instruments Reaktor, and Csound offer a great deal of flexibility, but they all require you to do some programming. Justonic Tuning's Pitch Palette software (www.justonic.com) offers a more user-friendly approach that will appeal to musicians whose interest is more casual.

Pitch Palette takes advantage of the fact that some synths allow their tuning tables to be edited on the fly by incoming MIDI data. You can create a just-intonation tuning in the software simply by typing the ratios in an on-screen keyboard and waiting a few milliseconds while the tuning is transmitted to the synth. You can then immediately start to play your MIDI keyboard. Pitch Palette even lets you retune the synth “on the fly” by dedicating a couple of octaves of your MIDI keyboard to tuning control. Sadly, most of the hardware synths that the software supports are no longer in production.

Justonic's Pitch Palette Home Studio Pack ($79) includes the Roland Virtual Sound Canvas (VSC-3) software, which eliminates the need for a compatible hardware synth. The Virtual Sound Canvas is not ASIO-compatible, however, so the performance latency won't allow you to enjoy playing music in any of the Pitch Palette's dozens of preset scales. Also, the VSC-3's tuning resolution, like that of many hardware synths, is not fine enough to remove all of the beating from supposedly pure intervals.

Csound is a free music-programming language with which you can do anything from alternate tunings to beat-mangling or designing your dream reverb. (See “Csound Comes of Age” in the July 2002 EM.) Unlike commercial synths, which prefer to translate MIDI note numbers directly to equal-tempered half steps, the “native language” of Csound oscillators is hertz, so creating any frequency that you need is a piece of cake. The way I prefer to create just-intonation scales in Csound involves a few simple steps:

  1. In your orchestra file, define a global variable for the base frequency of your piece (the frequency on which all of the other notes will be based).
  2. Instead of using one parameter field (p-field) in the score to specify the note's pitch, use three fields: one for the octave and one each for the numerator and denominator of the ratio you want to hear. (Ratios are the same as fractions).
  3. In the instrument, use a little multiplication and division to arrive at the correct frequency as shown in this example:

ioct pow 2, p5
inum = p6
iden = p7
ifrq = gibasefrq * ioct * inum / iden

The values inum and iden hold, respectively, the numerator and denominator of the pitch ratio. The p-field data (p5, p6, and p7) for each note is taken from the Csound score, and the global variable gibasefrq is defined at the start of the orchestra file. The library function pow raises the first parameter (2) to the power of the second parameter (p5, the octave number).

I've tried other methods, such as storing precomputed ratios in a Csound table, but I always end up wanting to hear intervals that aren't in the table. This method lets me be impulsive (or as impulsive as you can ever be in Csound, which is not very).

REAKTOR MELTDOWN

Like other commercial synthesizers, Reaktor starts with the assumption that you want to play equal-tempered half steps. Its oscillators have a P (pitch) input that conveniently accepts MIDI note numbers. My first attempt at a tunable Reaktor synth involved adding or subtracting small decimal values to or from the MIDI note number before sending it to the oscillator.

Getting the intervals perfectly in tune by ear proved to be difficult. The following formula for computing the number of equal-tempered cents in a ratio was supplied to me by David Doty of the Just Intonation Network:

log(ratio) × (1200/log(2))

The value of 1200/log(2) is about 3986.3. Armed with a decent pocket calculator, you can quickly figure out that log(3/2) × 3986.3 is about 701.95 cents. In other words, a perfect fifth is about 1.95 cents wider than an equal-tempered “perfect” fifth.

Rather than sweat over a calculator, you may find it easier to use the Reaktor oscillators that have F (frequency) inputs. Those inputs can accept either an FM modulator signal or a fixed data value in hertz. The trick is that you also have to attach a constant with a very low value (-300 works well) to the P input, as shown in Fig. 1. If you don't do that, the oscillator's F input won't be calibrated correctly.

When designing an FM instrument for just intonation, I decided to skip the normal fine-tune control for the modulator oscillators in favor of a panel switch that lets the modulator be tuned instantly to any of the basic overtones up through the 13th. The frequency sent to the oscillator is arrived at by multiplying the outputs of the Frq, Octave, and Overtone panel switches as seen in Fig. 1. The F input to the Frq switch is used when the keyboard is active; it receives a value from my bank of tuning switches. The Tun input receives a basic tuning offset value for use when the modulator is in fixed-frequency mode (ignoring the keyboard, in other words).

To play a Reaktor synth tuned to just intonation from a standard MIDI keyboard, you have to detect which pitch class (C, C#, D, and so forth) is being played, look up the correct tuning ratio for that class, and then multiply it by both the base frequency and an octave factor (some power of 2). The first stage in the process, which uses Reaktor's Modulo object to divide by 12 and output the remainder, is shown in Fig. 2. The quantizer module seen in Fig. 2 solves a potential problem: Reaktor's NotePitch object doesn't always send out integers, but the rest of my algorithm needs to receive and process integers.

That part of the process sends its output to 12 switch mechanisms. Each switch mechanism then inspects the pitch-class number and decides whether to ignore the incoming event or process it and pass it on to the output. Whichever piece of data arrives at the output is passed on to the oscillator. The setup for the C# pitch-class macro is shown in Fig. 3, and the panel switches used in my tunable synth are shown in Fig. 4.

Up to eight constants are attached to each panel switch. When the user presses a switch in the bank shown in Fig. 4, the value of one of the constants is sent to the Value object in Fig. 3 and stored there. The Modulo object in Fig. 2 sends out pitch-class messages indiscriminately to all 12 of my pitch-class macros. When the Compare object in Fig. 3 detects that an incoming message has the value of 1 (the C# pitch class), it sends a 1 from its = output to the Separator; if the incoming message has any other value, the Compare sends a 0 from this output. The Separator passes the incoming message to its Hi output if the value is greater than the value at the Thld (threshold) input, in this case 0.5. That message then triggers the Value object to send its stored data value to the Val output. The rest of the algorithm (not shown) multiplies this data by the octave value and any other needed offsets before sending it on to the oscillator in Fig. 1.

If you're not a Reaktor programmer, that may not make much sense. The essential steps to remember, which can be used just as easily in Max/MSP as in Reaktor, are as follows:

  • The pitch class of the current MIDI note is found by using modulo division on the note number.
  • The ratio value to be used for each pitch class has to be stored somewhere — either in a table or in a simple variable (such as Reaktor's Value object). You can create and store the value using whatever mechanism suits your needs, up to and including separate knobs or sliders for the numerator and denominator of each ratio to be computed.
  • The pitch-class number triggers the reading of the corresponding stored value.
  • After retrieving the correct stored value, the algorithm has to restore the octave transposition, which was stripped off when the pitch class was identified, and multiply by the base pitch of the tuning.

Reaktor owners can download my tunable version of one of the factory synths from the EM Web site. To hear the difference between equal temperament and a user-programmed tuning, just press the Equal Temp button.

WHY BOTHER?

The restless, edgy quality of Western music in the past 250 years is due not only to the turbulent culture in which composers have lived but to the tuning we have been using. With just intonation, music can be soothing and centered, yet with the aid of a computer, you still have the freedom to modulate to distant keys, because the tuning can be changed on the fly.

If you're working in a more aggressive style, try running some perfect intervals through an overdrive effect. They're unbelievably solid and rich. Alternate tunings aren't for everyone, but they can be the “secret sauce” that gives your music a flavor all its own.

Jim Aikinwrites about music technology for a variety of publications, which doesn't leave him nearly enough time to play with his still-evolving Reaktor tuning synth.

SPREAD OUT!

Figuring out where various interval ratios in just intonation are located in a scale is not always easy: Let's see, is 7/5 higher or lower than 11/8? Microsoft Excel provides a quick solution. (You should be able to do much the same thing with any other spreadsheet program.) Set up a column of numerators and a column of denominators. In the third column, called ratio, enter a formula of the form B2/A2, dividing the item in a cell in the first column by the item in the corresponding cell in the second column. Drag this formula cell all the way down the third column; in Excel, this automatically enters B3/A3, B4/A4, and so on in the relevant cells. Finally, sort the data by the ratio column, as shown in Fig. A. Problem solved.