Tables & Waves

Automata Study: Phasing Voices

This exploration of automated musical processes creates musical data in real time. It is another little musical automata system. As with all experiments posted in this series, the final musical results are not intended to be a finished piece, rather simple sketches with a high degree of interpretability. As such, it includes a minimal amount of sound design and overall composition in the hope that this will let the algorithm and/or code be comprehensible.

In this experiment I have set up a generative system in which two musical voices play phasing melodic lines. Here is an example of the process running:

Basic Overview

Ableton Live (the application on the right side) sends timing info to a little JavaScript program, which then responds with MIDI note data for three voices. Live is using four tracks:

  1. Melodic Lines 1 and 2: (tracks 2 and 3) software synths that play fixed melodies using Euclidean rhythms that change over time
  2. Rhythm/Drum Kit: (track 1) a software drum machine that plays a partial fixed rhythm (kick voice) and variable rhythms based on what the melodic lines are playing (snare and hihat voices)
  3. Max for Live Timing Track: (track 4) a kind of "dummy" track that hosts a Max for Live device that communicates transport timing information to a JavaScript program

On the left side of the screen recording is a command line terminal logging macro events as they occur. This little program that plays the two FM synths and the drum machine in Live is JavaScript code that runs at the command line using Node.js. The program started when I typed node main.js phasing then the return key into the terminal prompt.

When the program starts the melodic voices print out a description of their sequences. See the code repository's README linked above for details. The melodic voices use Euclidean rhythms that will usually have different sequence lengths and Euclidean step divisors. The program will let the melodic lines phase against each other until they resync their first sequence steps. At that point the sequences's macro event referenced above has completed and the program resets its state by randomizing the melodic seqeunces and the process starts over.

The melodic voices also report back to a sequencer object that coordinates their activity. This sequencer will use info from the melodic voices to play the drum voice.

Musical Description

This is a very basic example of phasing melodic lines, a common compositional strategy that was popularized by composers like Steve Reich in works like Music for 18 Musicians. Two sequences that have different lengths play against each other. Each sequence remains the same until they both line up with each other and start their first notes at the same time. At this point the sequences are changed.

When the sequence lengths are different, the shorter melodic line will restart before the other one. When one melody restarts before the other melody, they are out of phase until they reach their least common multiple (based on each sequence step length) and become realigned with each other. The effect is a mixture of stability and instability where the former comes from stable individual lines while the latter comes from the interplay between two sequences as a composite sequence.

In this implementation I have chosen to reset/randomize the rhythmic component for each melodic line at the moment the two voices realign. These events can be seen in the video above when new sequence information prints to the terminal screen.

Code Description

A coordinating sequencer object is responsible for managing the three voices. It holdes onto the voice objects and passes timing ticks/steps to the melodic voices, which in turn check to see whether the current step should play a note. The melodic voices also report information back to the sequencer object, such as whether or not the current global sequence step is the last step in a cycle of their own sequences. This is the mechanism that is used to keep track of whether or not the melodic lines' phases are back in sync.

Additionally, the melodic voices will report to the main sequencer when they have played a note. This information is then be used to determine whether or not to play rhythmic drum hits on certain steps.

In this simple automata study, the voices do not communicate directly with each other, only with the coordinating sequencer.