Raspberry Pi computer as a live sound synthesis platform

The Raspberry Pi is a revolutionary piece of computer hardware with applications in many areas of industry, technology, education and the arts. It is a miniature computer with the width and length of a credit and less than one inch in height. It is a fully functional computer, with an Ethernet interface, USB ports, an HDMI video port and a GPIO interface for controlling physical devices. The Pi runs the Linux operating system, which can run a full graphical interface desktop environment, or can be stripped down to run “headless” with no such mouse/keyboard/monitor input. Perhaps the striking aspect of the Pi is its price, which ranges between $35 and $40. I began investigation using the Pi as a computer for live sound processing and composition using the first iteration of the unit, but quickly ran into resource constraints on CPU, memory and USB bandwidth and capability, as well as challenges finding a suitable Linux distribution and kernel build. Knowing that the technology would advance rapidly, I stuck with my research and efforts and was rewarded when the Raspberry Pi foundation released the Model 2 and 3, which included major improvement and upgrades in CPU, memory and device bandwidth. I am an enthusiastic user of the SuperCollider sound synthesis engine and composition environment. However, getting SuperCollider to run on the Raspberry Pi was not a trivial exercise. Furthermore, I have an extensive technical background in Linux and do not expect everyone to have such a background, so I am writing this article to assist composers and artists in using this technology stack to create innovative ways of performing music and sonic art.



Live sound synthesis requires a considerable amount of processor resources. Non-essential system processes should be stopped or disabled. Likewise, code should be written in as efficient a manner as possible.

Software dependencies

The Pi requires particular Linux capabilities, most notably a pre-emptible or “realtime” kernel, as well as other pieces of software to run the SuperCollider engine.

Hardware dependencies

An external USB sound interface is required. Furthermore, we will need one that works on Linux. There are a wide variety of commercial sound interfaces that will work, but there are many that won’t. For communication with a headless Pi, the user will need a wired Ethernet connection or a Wifi connection.

Steep technology learning curve

The Pi runs a special build of the Linux operating system. While many current Linux distributions for the Pi include a fully featured graphical desktop environment, users will need some understanding of command line operation, at least in the first iterations of my configuration. In addition, live performance of compositions or installations should run with the graphical interface disabled for so that CPU, memory and bus resources can be dedicated to processing audio synthesis without the need to run a graphical desktop.

Some possibilities for use

My main motivation was that I just wanted to run a computer music performance where I didn’t need to peck away at a laptop connected with wires, cables, etc. Also, I am a performer and would want to focus on my instrument without interacting with a computer.

The artist does not want to spend money on an expensive sound synthesis platform (one beginning with M and ending in X comes to mind). The software stack for this project is free (as in beer and “dom”) and open source from end to end.

A sound installation playing in an Art Gallery or other space not traditionally used as a performance venue.

A composition to be played in different locations where the composer is not present to control it and does not want to either write detailed instructions or employ their personal laptop or other expensive device at the performance space.

A performance space where speakers are too far apart to be controlled by a single mixer.

Performances where the composer does not need or want direct control over the performance.

Performances needing an innovative way to interact with the computer interface.

Hardware requirements

Raspberry 2 or 3

If Raspberry Pi 2, USB Wifi interface is required for operation on a wireless network.

If Raspberry Pi 3, the Wifi interface is built into the Pi and might offer better network performance for interactive performance environments.

MicroSD card

At least 32GB, but 64GB is preferable. Should be a Class 10 device to ensure that data can be read from disk at an acceptable speed for live sound processing. The MicroSD card is the “hard disk” that contains the operating system, synthesis software and user-written code driving the synthesis engine.

USB Sound Interface

Must be compatible with Linux. Use Google to find a well-supported interface. I am using a Scarlett FocusRite 2i4, but that costs about $180– several times more than the actual computer itself. I am experimenting with very inexpensive USB sound interfaces (in the neighborhood of $5 to $8), as I don’t need extensive onboard controls or inputs in my current work.

Powered speakers

Powered speakers do not require an amplifier and can be connected directly to the sound interface. I am using a pair of Pyle PPHP837UB 600 watt speakers.

Sound cables

Usually RCA or 1/4 inch jack

Software requirements

Linux distribution with a pre-emptible Linux kernel

The Pi must be running a specialized “pre-emptible” (aka realtime) Linux kernel. This is not just a requirement for speed– the software just won’t run on a kernel without this capability built in. My website has many suggestions, but I plan on distributing my working configuration as a downloadable image.

Jack audio engine for Linux (http://www.jackaudio.org/)

Following detailed instructions I provide, it is possible to use the standard packages provided by the installed Linux distribution without needing to build a special version.

SuperCollider engine (http://supercollider.github.io/)

SuperCollider is the main engine, executing code as a live, running composition.

SuperCollider (SC) is free and Open Source. There is no cost to download or use it and the user may run as many copies as needed without limitation.

A special build of SuperCollider must be installed. I hope to be able to provide an installation package so that users need not build their own, which can be rather complex.

Set Theory Java library

Mission and Motivation

I’ve been working on a large-scale software project that models many ideas from Musical Set Theory. This body of music theory has been proven to model an large segment of 20-century music and has had a profound influence on musical thinking in the last 50 years. Theorists and composers working in this field include Milton Babbitt, Robert Morris, Daniel Starr, Allen Forte, David Lewin, John Rahn, Richard Hermann, David Headlam and Donald Martino. In addition to its value in analyzing and understanding the canon of 20th-century music, it has been proven to offer composers powerful new ways of organizing and expanding their musical ideas.

Using modern software engineering strategies and paradigms, I believe that the body of software I have been composing offers theorists and composers powerful and extensible means for working with a large segment of the objects and operations of Musical Set theory. For convenience, I will refer to the entire library, or collection of classes, as the Musical Set Theory Library, abbreviated as MSTL. I think it best to jump in and look at some of the objects and classes (used here as the technical term in software engineering for modelling an abstract idea, as opposed to the common definition of an instructional unit in an educational institution). I will provide only brief descriptions of the ideas from PC Set Theory, assuming the readers familiarity with the concepts or leaving them to discover them as desired using the additional reading resources provided.

Basic Elements of MSTL

Pitch Class Set :: The Pitch Class Set (PCSet) is class of note groups without regard to vertical or horizontal ordering or spacing. In mathematical terms, one could regard it as a Set, defined only by interval relationships within the 12-note chromatic scale. PCSets are grouped into a Set Class, which is a group of PCSets that can be mapped into each other under transposition and inversion. Members of the PCSet are limited to the integers from 0 to 12, representing each note of the chromatic scale. There is no concept of octave placement, such that there is only one “C” or “D flat”, etc. A common example would be the Major chord, where two instances, for example the C Major chord and D-flat Major chord, share no common notes, but consist of the same “sound” and are members of the same “class”. Furthermore, the  Major chord can be shown to transform into a minor chord in the Inversion (I) operation. This relationship is easily audible in Common Practice Western music without the trappings of mathematical operations. Another set of notes, such as the set [C, F, G] cannot be mapped into a major chord using transposition or inversion and as a result, is a different Set Class. The PCSet extends this concept to any subset of the chromaticsclae, such as the octatonic or pentatonic scale or the collection consisting of the group [D, D#, E, F#]. Neither of these three collections is equivalent to the other, but subsets of each can be found in the other. A robust model of the PCSet will allow us to create instances of them and transpose, invert and analyze their relationship to other PCSets using a well-defined and rigorous interface.

Pitch Set (PSet) :: The PSet is a more specific form of the PCSet. It consists of a set of pitches fixed in register or vertical space, but with no regard to horizontal or temporal ordering. In the PSet universe, a C in one octave would not be considered equal equivalent to a C in another octave. A common definition and useful model would be a “closed-voicing, root position Major chord”, which retains its identity if transposed, but loses its identity if inverted in the classical sense of rotating the vertical ordering of the notes (root position, 1st inversion, etc), or if expanded to an open voicing. Using a well-defined interface, we can transpose, invert and perform other operations on them. In addition, we can inspect their nature as PCSets (see above). For example, it would be quite simple to determine of a PCSet was a Major chord regardless of its transposition or vertical distribution.

Pitch Class Sequence (PCSeq) :: The PCSeq is similar to the definition of PCSet; however, the concept of order is injected, such that an element of a PCSeq can be considered to come before of after another element in a PCSeq. In this class, we add operations on order such as R() (retrograde) and interpolation (injecting another PCSeq at a specific location into another PCSeq). Again, a well-designed interface will allow one to reduce a PCSeq into a PSet or PCSet.

Pitch Sequence (PSeq) :: The PSeq is similar to the definition of PSet; however, the concept of order is injected, such that an element of a PSeq can be considered to come before of after another element in a PSeq. In this class, we add operations on order such as R() (retrograde) and interpolation (injecting a PSeq at a specific location into another Pseq). Again, a well-designed interface will allow one to create PCSet or PSet from a PSeq using a single operation.

Technical Implementation

The basic objects of PC Set Theory are implemented as classes using the Java programming language. Java is a powerful Object Oriented language with wide support in many fields of technology including mathematics, web applications, networking, science and graphical imaging. In addition, it is available for nearly every platform including Mac, Windows and Linux. Libraries such as MSTL are instantly portable across all platforms with no modification or repackaging required. Using an Object-Oriented interface is essential for modeling objects and concepts of PC Set Theory. The weaknesses of a functional or procedural approach surface immediately when attempting to manipulate and extend Pitch Class Set objects. Without an object to contain the properties and operations, the user will very soon be bogged down in a tangle of function calls and conversion routines to perform the simplest of operations. To illustrate this point, I will show how we can create a new PSeq created from the first 5 elements of the retrograde of a transposed inversion of another set using two lines of Java. The fragment includes the creation of the original set, so the actual transformation is done on a single line (the third line simply prints the result and could be combined on the same line, but separated for clarity). The original set is simply a permuted diatonic scale beginning on middle C: C D G E A B F C’. One need not know the details of Java to appreciate the simplicity of this approach. I’ve published the Javadocs for anyone interested in using the library. If you use Maven, the library is published into the Central Snapshots repo at these coordinates:


If you’re not using Maven, you can just grab the latest version from the Central Repo.


PitchSequence mySeq = new PitchSequence (“60 62 67 64 69 71 65 72”);

PitchSequence  newSet = mySeq .T(1).I().R().subSequence( 0, 4 );

System.out.println( newSet.toString() );

[0, 7, 1, 3]

As illustrated, operations can be chained together in a single operation. To illustrate further the power of this programming model, let’s calculate the Normal Form of the transformation above, again, using two lines of code.

Ex. 2

PitchSequence mySeq = new PitchSequence (“60 62 67 64 69 71 65 72”);

PitchClassSet normalFormSet = new PitchClassSet( mySeq .T(1).I().R().subSequence( 0, 4 ).getMembers() ).getNormalForm();

System.out.println( normalFormSet .toString() );


[0, 1, 3, 7]

In our last example, we will show two lines of code that prove that the all-interval tetrachord [0137] (I call it the Phrygian-Lydian Tetrachord) is equivalent (under T[n] or I) to a transposed inversion [3,4,7,9] of the other all-interval tetrachord [0146] under M[5].

Ex. 3

def allIntSet = new PitchClassSet( [0,1,3,7] )

def otherAllIntSet = new PitchClassSet( [3,4,7,9] )

print ( allIntSet.M(5).equivalent( otherAllIntSet ) )


While one may not want to chain an excessive number of operations in a single line, the examples above illustrate the advantages using an Object-Oriented approach to modeling objects from Pitch Set Theory. Important to note is that each successive operation in the list ( T[1], I, R, subSequence(0,4) ) returns an instance of a PitchSequence. Each instance knows how to perform the operations on itself and pass the results to the next operation.

Use Cases

Among the elements of an object-oriented paradigm are data abstraction and data hiding. An effect of this model is the capability and motivation to isolate classes to performing a limited number of core functions. Higher-level operations should be moved into another framework and often there is often a temptation in composing software to assign too much functionality to one class or a group of classes. For example, there is no method within the library to print a string representation of a PCSet. Instead, a PCSet offers a “toString()” method to return the String representation, yielding a string such as “PCSet: [0123AB]”. The actual printing of the String is left to the enclosing application. The PCSet just offers a method for getting the String representation without actually printing the contents to some output device. The use cases below illustrate how the limited scope of the MSTL classes allow users to create their own ways of extending and embedding them to their own use. They illustrate only a small number of possible uses.

Command Line Applications :: Groovy

Command line applications provide the easiest entry point into the MSTL. While the Java programming language has been proven valuable for creating the basic set of objects and operations, it can be challenging for creating applications for general use. For this purpose, a Domain Specific Language (DSL) such as Groovy can be of great utility. Groovy is built on top of, and is in fact a full implementation of Java. For example, the examples from the previous section can be copied into and run directly from Groovy. One main advantage on top of Java is its scripting interface, where programs can be executed immediately without the burden of compiling and running an executable file or creating an entry point (Java’s main(String[] args) ). Groovy also offers several programming extensions, such as powerful List operations, some of which can be cumbersome in Java. Using Groovy, we can quickly experiment with programs and operations of any complexity. In Groovy, the user can link to MSTL in one of two lines of code, even grabbing a version of MSTL from the Maven Central Repository on an internet-connected computer.  It can then fully access all of its objects and operations. I’ve linked to several Groovy scripts in the appendix of this article. While command-line applications offer an powerful and intuitive interface into MSTL, displaying and viewing the output can be cumbersome for large output, especially if used as a composition tool, where the output asks be converted into musical notation at some point.

Web Applications :: Grails

Web applications can deliver services to a wide number of users without the need to install specialized software. Users can access an applications services from anywhere in the world using just a web browser. They can be difficult to design and implement; however, there are many popular frameworks designed to streamline their creation. Grails is a popular web application framework based on Groovy programming language. Since several Groovy programs have already been written and published to support MSTL, it makes sense to reuse them within a Groovy-Grails framework. I am designing a Grails application as an interface to MSTL. It will eventually offer users the ability to analyze set relationships and to create composition designs online. In conjunction with the file format described below, a web application could produce output that could be imported into other composition and notation tools.

Web Service :: Grails

A Web Service could serve as a simpler and more platform-neutral interface to MSTL than a full web application requiring a browser and interactive output. One could think of a web service as simply asking MSTL a question and getting a response rather than a formal conversation. A web service interface would allow platform or application-neutral communication. Using a common software synthesis and composition application such as SuperCollider or Max/MSP, it would not be difficult to interface with an MSTL web service to perform Set operations over the internet. An example could be phrased as a question or query in the form of “Given the PCSet [01247B], give me the complement of the T[5]I transformation of that Set”. The Web Service would reply with the Set [2789B0], without the trapping of formatting the data as HTML to be rendered in the browser. The consuming application (SuperCollider, Max, etc) would then interpret that data as needed. Common data formats in web services include XML and JSON (Javascript Object Notation).

File Formats :: Plugins

Working with specific file formats could prove to be a powerful way of using MSTL. Most music notation and composition applications have the ability to read and write various file formats. Creating file format interfaces to MSTL would allow users to both read information from a file for analysis as well as write data to a file for importing into a notation application. For example, the popular music notation program Sibelius can both read and write files in the MusicXML format. MusicXML is a well-defined and established format for sharing musical data between applications. Using a MusicXML adapter to import and export musical data, users could read data into MSTL from their notation program to possibly analyze and extend their own music. Likewise, a MusicXML adapter interface to MSTL could transform the output  of an MSTL program into a MusicXML file that could be read into a notation program. This could serve as a step to solving a common problem with composition programs, where data is output in a format unfriendly to musical interpretation, such a stream of numerical data. Other possibilities include writing Csound score files. Through a complementary library to MSTL, somewhat simple musical data can be exported in a Lilypond format. Lilypond is a powerful open-source music notation software package. Like MSTL, Lilypond does one thing and does it well. It reads input files in a well-defined format and outputs graphics files of music notation based on input file data. There is no embedded user interface for modifying and creating music notation.

3D printing

I recently bought a 3D printer from Amazon. It was branded as a “G-Star Dual Extruder”, and is mostly a Replicator 2 clone. The price and features were right for me. It arrived much faster than I thought and I was very excited to get it working. The documentation was not extensive, but clear. It seemed to be geared towards someone with some technical experience. My first prints were some simple objects from ThingiVerse. I was amazed. My first prints looked much better than the pictures in ThingiVerse. They were cleaner and had less artifacts and other junk. I printed out the “Julia Vase”, which is a vase based on a fractal pattern. It was clean and crisp. There were some support artifacts inside, but they were easily cleaned up. Later, I printed some dodecahedrons. These were challenging, as they had many horizontal beams. They printed nice and clean, but were not perfect not perfect. This is probably less a problem with the printer than with the design of the object. The most striking print was the “Sierpinski Triangle”, which is a fascinating 3D fractal pattern based on a pyramid. I printed 3 of them, and they were stunning. The prints were so sharp– literally– that I had to sand them down. I have them sitting on my desk, one in blue, black and white.

I started printing some original objects for a small business project I’m working on. They’re fairly simple solid objects. Again, I was amazed with the quality of the prints.

I highly recommend the G-Star printer. I see that it’s no longer available on Amazon, but I’ve heard some rumor that it will re-emerge, re-branded under HatchBox, who sells printer filament on Amazon. In short, go buy one when you see them available. I’ve had an excellent experience with them.