Linked List Music
Richard Davis, Blog

Home About Events Listening Blog FR


I'm a nerd. One of the things I'm a nerd about is music; another is computer science. Only very rarely do the two meet, as they did in a recent piece I wrote. In this post I'll talk a little bit about a piece I wrote based on the concept of a linked list.


I got to play this piece myself, which posed a lot of interesting challenges. Here's a video of the concert; give it a listen and then keep reading!

Program Note

The linked list aspect of the piece may be hard to hear at first, especially when you don't know what scale you're listening at. I'll reproduce the entire program note here, to hopefully shed some light on the concept.

This work takes its name from the poem which is the subject of the seventh and final movement: "ōdī et amō," the eighty-fifth of the Carmina by Classical Latin poet Gaius Valerius Catullus. The title of this poem translates to "I hate and I love," two emotions which inform the titles and characters of the fourth and fifth movements of the cycle. These three movements form the center of a cycle of character pieces, which each include topics such as running, dancing, trying, and singing.

Structurally, the piece is inspired by a data structure commonly used in computer science, called a linked list, which functions to store lists of objects in a computer's memory. A linked list is composed of a sequence of nodes that each contain two elements: the item at this position in the list, and a pointer to the next node in the list. The movements of this piece are like these nodes; each has two parts that correspond to the components of a node of a linked list. The first, comprising the majority of the duration of the movement, is the "item" at this point in the list, or a passage of music based on a single idea. The second comes at the end of each piece and represents the "pointer" to the next node in the list; this is a brief, often surprising reference to the content of the following movement.

The movements of this piece (or the nodes in this linked list) are roughly sorted in ascending order in terms of lyricality. Beginning at an instrumental extreme, each successive movement is more lyrical than the last, reaching the limit of how lyrical the viola can be, and finally going beyond it in the last movement.

This is generally how I explain the concept to music people. It may need one slight addendum for my tech friends: a movement of a multi-movement piece can be thought of roughly like a song on an album, only you generally don't shuffle movements of a piece, you play them all back-to-back in the original order.


In order to concretely understand how this piece is structured like a linked list, we must first understand the nature of the "item," or the main idea of each movement. From there, the "pointers" naturally fall into place.

The first movement, titled "currō" ("I run"), is characterized by fast-moving notes exclusively on the A string. The last note, however, is a two-note chord played on both the A and D strings, which is something of a slight surprise. This last note is the pointer to the next movement.

The second movement, titled "saltō" ("I dance"), therefore features almost entirely by two-note chords. (This movement refers to dances primarily in terms of rhythm; some listeners may recognize a Siciliana pattern.) These eventually break out into fast runs, which represent the pointer to the next movement.

The third movement, humorously titled "cōnor" ("I try") because it is quite hard to play, focuses on these fast runs. They eventually slow into something more melodic, finally reaching a glissando, or a smooth slide between notes, near the end of the piece. This glissando is the pointer to the fourth movement.

And in turn, the fourth movement, titled "ōdī" ("I hate") is based primarily on glissandi. This does not, however, account for all of the surprising (and hopefully, shocking and revolting) character of this movement. I also include some passages that refer to the texture first movement, in order to lend a turbulent and contrasting (but no less hateful) character to the movement. At the climax, the music reaches and plays around with a new repeated-note figure, which serves as the pointer to the following movement.

The fifth movement, titled "amō" ("I love") is constructed almost entirely on this repeated-note figure, save for a contrasting middle section of the most vulnerable sustained notes possible. The pointer in this movement is the most subtle of them all, in that it melodically resembles the opening of the follow movement. This change in material is signaled by the first and only two notes in the movement that are neither repeated nor sustained.

The sixth movement, titled "canō" ("I sing"), begins with, and is largely based on the melodic idea that ended the previous movement. The main character of this movement is, as its title suggests, maximally lyrical. And at the end, when the viola no longer suffices, I sing to make up the difference. This singing is the most obvious pointer to the next movement.

The seventh and final movement, titled "ōdī et amō," ("I hate and I love"), is, needless to say, a little out of place for a solo viola piece: I sing the Catullus poem while playing drones on the viola. There is no following movement, so this one ends with a "null" pointer, or a pointer to nothing, represented (with a good deal of artistic license) by the passage with the viola alone at the end.


I had a lot of fun writing this piece! I hope you had just as much fun listening to it as I did writing it, and I hope that reading this helped it make some more sense. If you like, give it another listen and follow along with the notes above!

Anecdotally, after I performed this in concert (where I read the program note before I started), after which a computer science student came to tell me that he could hear the structure, especially with the singing pointer. I enjoyed writing this enough that I think I may soon do more CS-inspired pieces. I could do something similar for other data structures like trees, or sorting algorithms, etc. I think it'll be fun!