>HEADLESS·MONKEY·ATTACK<

band photo

RTcmix

An introduction to RTcmix

RTcmix is the music programming language I use for all the synthesis in Headless Monkey Attack. The official RTcmix site has everything you need to download and use the language, including the rtcmix~ object that I use, as well as tutorials and comprehensive documentation.

For those who are curious, I offer this brief example of how I use the language. The background image on this site consists of the following code:

AMINST(st, dur4*8, dynPPPP*envTri, cpspch(09.10), 0.5+forwardR*6.5, 0.8, envFlat, waveSine, waveSine)    // INST 1S <--
AMINST(st, dur4*8, dynPPPP*envTri, cpspch(09.06), 0.5+forwardR*6.5, 0.6, envFlat, waveSine, waveSine)    // INST 1A <--
AMINST(st, dur4*8, dynPPPP*envTri, cpspch(08.06), 0.5+forwardR*6.5, 0.4, envFlat, waveSine, waveSine)    // INST 1T <--
AMINST(st, dur4*8, dynPPPP*envTri, cpspch(08.01), 0.5+forwardR*6.5, 0.2, envFlat, waveSine, waveSine)    // INST 1B <--

This is basically the same line of code repeated four times with different values. If each line does not fit inside the width of the box, it will wrap to the next line(s), causing the appearance of more than four lines of code, but really there are only four lines. ] Each line generates the sound of one note, using AM (amplitude modulation) synthesis, which can create a "wobbly" sound It kind of goes "wa-wa-wa...etc." An LFO (low frequency oscillator) can be used to similar effect. ] The code to invoke AM synthesis in RTcmix begins with AMINST( and ends with ). Everything between the parentheses specifies the details of the sound, as expressed by comma-separated parameters. (If you have some experience with computer music, you can read the full AMINST documentation.)

The first parameter determines when the sound begins:

AMINST(st, dur4*8, dynPPPP*envTri, cpspch(09.10), 0.5+forwardR*6.5, 0.8, envFlat, waveSine, waveSine)

This parameter could be a number (in seconds). For example, a value of 10 here would mean that this sound would begin 10 seconds after the beginning of the score. However, this parameter can also be a variable with a value to be determined later. I use st as a variable with a value that increments throughout the track, allowing sounds to be chained together.

The second parameter determines the duration of the sound:

AMINST(st, dur4*8, dynPPPP*envTri, cpspch(09.10), 0.5+forwardR*6.5, 0.8, envFlat, waveSine, waveSine)

This parameter could also be expressed as a number, but instead I refer to the variable dur4, which has the rhythmic value of a quarter note By expressing the duration of a quarter note as a variable, I can make arbitrary tempo changes globally. ], so multiplying this by eight means that the sound lasts for eight beats.

The third parameter determines the amplitude (volume) of the sound:

AMINST(st, dur4*8, dynPPPP*envTri, cpspch(09.10), 0.5+forwardR*6.5, 0.8, envFlat, waveSine, waveSine)

Here I use the variable dynPPPP, which is a very soft dynamic level. This is related to a variable named masterVol, allowing me to make global changes in volume. ] This is multiplied by an "envelope," which is a table of values. In this case, envTri is a "triangular" envelope, starting at 0, increasing to 1, and decreasing to 0. This means that the sound fades in gradually to a very soft volume and then fades out again.

The fourth parameter determines the carrier frequency of the sound:

AMINST(st, dur4*8, dynPPPP*envTri, cpspch(09.10), 0.5+forwardR*6.5, 0.8, envFlat, waveSine, waveSine)

In the context of how I use AM synthesis, the carrier frequency corresponds to the note "played" by this "instrument." The number 09.10 represents the B-flat that is almost two octaves above middle C. This value is wrapped in a function that converts the note to a frequency: cpspch()

The fifth parameter determines the modulation frequency of the sound:

AMINST(st, dur4*8, dynPPPP*envTri, cpspch(09.10), 0.5+forwardR*6.5, 0.8, envFlat, waveSine, waveSine)

A low frequency here causes the volume to waver, creating the "wa-wa" effect. The variable forwardR takes the position of the right tether from my controller to change the modulation frequency during the performance. When I pull the right tether toward me, the value of forwardR decreases toward a lowest possible value of 0.0; as I extend the tether away from me, the value increases up to 1.0. As a result, the modulation frequency, expressed as 0.5+forwardR*6.5, can vary from 0.5 to 7.0. In other words, when I pull the tether toward me, the sound goes "wa ... wa ... " very slowly, and when I push it away, it goes "wa-wa-wa-wa" faster.

The sixth parameter determines how the sound is panned:

AMINST(st, dur4*8, dynPPPP*envTri, cpspch(09.10), 0.5+forwardR*6.5, 0.8, envFlat, waveSine, waveSine)

A value of 0.0 here puts all of the sound in the left speaker, while a value of 1.0 puts all of the sound in the right speaker. The value of 0.8 means that the sound is mostly in the right channel but also audible in the left channel.

The seventh parameter determines the amplitude of the modulator:

AMINST(st, dur4*8, dynPPPP*envTri, cpspch(09.10), 0.5+forwardR*6.5, 0.8, envFlat, waveSine, waveSine)

Given how I use AM synthesis, the modulator amplitude doesn't really mean anything, so I use envFlat, which is a table of nothing but the number 1 repeated a bunch of times.

The eighth parameter refers to the "wavetable" of the carrier:

AMINST(st, dur4*8, dynPPPP*envTri, cpspch(09.10), 0.5+forwardR*6.5, 0.8, envFlat, waveSine, waveSine)

A wavetable is a table that determines the "waveform" used in the synthesis; this controls the "timbre" (or "color") of the sound. Here I use the simplest sound (a sine wave), which consists of a single frequency.

The last parameter refers to the wavetable of the modulator:

AMINST(st, dur4*8, dynPPPP*envTri, cpspch(09.10), 0.5+forwardR*6.5, 0.8, envFlat, waveSine, waveSine)

This wavetable, at a low frequency of AM synthesis, determines how smoothly the sound gets louder and softer. I use waveSine again to make smooth changes in volume.

The other three lines of code above do the same thing, but on different notes and in different pan positions.

^