Ch. 4 – Transformation and Process

Topics:   Musical patterns and meaning, minimalism, Steve Reich, Mod functions, musical canon, J.S. Bach, Arvo Pärt, viewing musical material, software development process, computer-aided music composition.

Being able to write down and represent music is an important skill that we have examined in some detail in the previous chapters. In this chapter we focus on another important skill, transforming music to create variations and developing it into longer and more interesting compositions.  More broadly this chapter explores foundational programming skills required to manipulate data.

Create Steve Reich’s piece, “Piano Phase”

This code sample (Ch. 4, p. 94) creates Steve Reich’s “Piano Phase”, a minimalist piece for two pianos involving tempo differences and repetition.  The speed difference is quite small, 0.5 beats-per-minute (quarter-notes per minute), so the phase shift is quite gradual, but nevertheless the result is dramatic.

This example begins to demonstrate the connection between musical process and computer process, and how the latter (through, in this case, Python and the music library) becomes a tool to capture, explore, and experiment with musical composition.  We will see more below.

For now, here is a variation on the above utilizing more Mod functions.

Create a simple musical canon, “Row Your Boat”

This code sample (Ch. 4, p. 99) demonstrates how to create a musical canon. It also demonstrates how, through programming, your computer is transformed into a musical instrument that exceeds the capabilities of a single human performer on a traditional instrument. This computer music instrument can render a quite complicated piece of music. Also, unlike other playback environments (e.g., your digital music player), these pieces can be easily modified by making changes in the code. This is very enabling – imagine being able, through the press of a button, to change musical parameters of a piece (i.e., when a certain voice starts, or which sounds to use to play a particular melody or chords).  We will see this later.

Create J.S. Bach’s Canon No. 1 on the Goldberg Ground (BWV 1087)

In 1741, Johann Sebastian Bach (1685 – 1750) wrote the Goldberg Variations (BWV 988) for harpsichord. This work consists of an aria and a set of 30 variations, and is an amazing example of the transformation of a theme to create variations.  Then, in 1974 an unknown manuscript was discovered, written in Bach’s hand, containing 14 canons on the first eight notes of the Goldberg aria. These canon variations were previously unknown (except for canons 11 and 13).

The following program (Ch. 4, p. 106) demonstrates how to use Mod functions to create the first of these 14 canons. It is built from a theme consisting of eight notes and reversed version (retrograde) played simultaneously.

Create J.S. Bach’s “Trias Harmonica” canon (BWV 1072)

J.S. Bach created many beautiful canons. This code sample (Ch 4, p. 108) creates the Trias Harmonica canon (BWV 1072). Like all canons, the Trias Harmonica involves repetition and layering of melodic phrases; it consists of two parts with four separate voices each – a total of 8 overlaid phrases.

This canon was particularly significant to Bach. The name trias (“τριάς”, or triad) refers to the triunity of the divine in the Christian tradition, i.e., “three in one and one in three” (Bach was a devout Lutheran). The Trias Harmonica canon interweaves a major triad (C4, E4, G4 – representing the divine) with the minor triad (D4, F4, A4 – representing man). Also, it uses a dotted quarter note (i.e., 1.5) as the duration for the major triad, and an eighth note (i.e., 0.5) for the minor triad, emphasizing the 1/3 relationship between the trinity and man.

Create Arvo Part’s “Cantus in Memoriam Benjamin Britten” (1977)

This code sample (Ch. 4, p. 110) creates Arvo Pärt’s “Cantus in Memoriam Benjamin Britten”.  This is a minimalistically-composed, yet very powerful piece for string orchestra and bell, based on Pärt’s tintinnabuli style. It was written to mourn the passing of Benjamin Britten, an English composer, whom Pärt considered a kindred spirit. Pärt, being in Estonia at the time (on the wrong side of the Iron Curtain), never met Britten, who died in England in 1976.

This version of the piece is slightly simplified compared to the original score. It introduces a single voice descending in stepwise motion the A aeolian (natural minor) scale. This voice is repeated at half tempo several times, creating beautiful harmonic combinations stemming from all permutations of aeolian-scale notes.

Although Pärt’s score lists all the notes spelled out, here we construct the piece using Bach’s canon approach. In other words, we state the theme and apply canonic rules (copying, shifting in time, and elongation) to generate the final piece. This implementation allows us to better appreciate Arvo Pärt’s compositional style (as reflected in this piece); also it may provide inspiration for things to try in your own music composition explorations.

Create variations automatically from a theme

For centuries musicians have taken existing music and created their own variations of them. Since the 1950s, researchers have been exploring how to utilize computers in this activity. The following program (Ch. 4, p. 121) demonstrates how various Mod functions may be used to harness the computer’s ability to create novel music from existing material. Although somewhat simplistic, this program demonstrates how to begin developing computer-aided composition tools to help with writer’s block, or to inspire new melodic or harmonic explorations.

Here, we start with a theme provided by a human composer. Each musical variation algorithmically develops the material from the original theme. The goal here is not to create a near-perfect musical piece – that would be difficult to do with what we know so far. Instead, we aim for a piece with reasonable musicality – a piece that can be used to explore musical possibilities, and get new ideas. To do so, we try to make the variations subtle enough, so that the relationship with the original is evident, but also novel enough that they are interesting and surprising.