Posted on by & filed under music, programming, Tech, tools.

What does it mean to make a computer sing?

Computers don’t have vocal cords; they can’t really “sing” like a human can, but they do have DACs (digital to analogue converters), which are the devices responsible for generating sound inside of a computer. Computers don’t have a shred of musicality either. It’s up to humans to make them sing, or rather, for humans tell them how to sing. We can tell a computer how to sing the same way we tell a computer to do anything… through the use of a programming language.

For over 50 years, computer musicians and composers have been using computers to create music and sounds that would be otherwise impossible to do on a traditional instrument. The tools and languages used to make this particular kind of music (known as “computer music”) have grown and matured with the technology. In this blog post, I will mention some of the popular musical programming languages and the big ideas behind them.

Blips and Bleeps: The “Hello World” of Computer Music languages

When most people think of computer music or sounds, “blips” and “bleeps” often are the first things to come to mind, sounding something like this:

Such sounds are trivial to produce for most musical programming languages. Each language discussed in this post will have an code example reproducing similar blips. How does one create these blips? Conceptually, you’d need to do the following:

  1. Create a sine wave oscillator
  2. Set the frequency of the oscillator to be a random number generator
  3. Set the range of the random number generator to be between 200-1000hz
  4. Make the frequency change every 100ms (set the rate 10hz)
  5. Scale the sine’s amplitude to 0.5 (otherwise the bleeps will be too loud!)

Let’s dive in and look and at some of the ways a computer musician would make this sound:

Max MSP and PureData

MaxMSP is one of the most popular musical programming languages. Developed by Cycling 74 as a commercial product, MaxMSP has the unusual distinction of being a visual programming environment. With an emphasis on modularity and abstraction, MaxMSP “patches” are built up from interconnected objects connected by patch cables by clicking a dragging the mouse. With MaxMSP, users can build GUI frontends to their patches which can be exported as standalone applications.

This is what our blips would look like in MaxMSP:


In our blip patch, we distinctly created an oscillator object being controlled by a random number generator being controlled by a metro trigger object. Note how the cable being patched to the DAC is different than the cables before it. In MaxMSP there is a distinction between audio and control.

PureData is the open source brother of MaxMSP. In addition to being free and open source, PD can run on Linux.

This is what our blips would look like in PD:



Csound is a direct descendant of one of the earliest musical programming languages called MUSIC N developed by Max Matthews at Bell Labs. Csound was developed by Barry Vercoe at the MIT media lab. A Csound file is comprised of two components known as the orchestra and the score. The orchestra is the place where instruments are built up, and the score tells the instruments in the orchestra what to play and when to play.

When Csound first came out, the score and the orchestra were separate files that would render audio to disk. In today’s Csound, the score and orchestra are combined together in an XML document.

This is what our blips would look in Csound:

The syntax of an orchestra is geared towards people with knowledge of how modular synthesizers work. Instruments inside of an orchestra are built up of opcodes, outputs go the left of the opcode, and input variables go to the right of it. Lines of opcodes can be read top to bottom, and together they can make a synthesizer. In our “blip” Csound example, the randomh opcode is being used to create random numbers. Its output variable is being sent to the oscillator. The output of the oscillator is then sent to the DAC.

The score of Csound is essentially a table of values. In our score, we have a single line that says “i1 0 10”. This is telling instrument 1 (our blippy instrument) to play for 10 seconds right when the program starts at 0 seconds.

Supercollider and ChucK

Unlike the languages discussed previously, SuperCollider and Chuck fall into a family of musical programming languages that bear more of a resemblance to traditional programming languages. For this reason, these two languages tend to be used more for generative and algorithmically produced music. Both languages have a strong emphasis on what is known as “live coding” or “on-the-fly” coding where code can be written and modified in real-time during a performance.

SuperCollider is a very popular language in the computer music community. It was initially a commercial piece of software for the Mac that was eventually open-sourced and ported to PC and Linux. SC comes with an IDE, however there are plugins available for Emacs and Vim. The IDE and LISP syntax make it a very ideal choice for live coding.

This is what our blips in SuperCollider would look like:

In this SC one-liner, a SinOsc function is called asking for one argument (the frequency). Inside the SinOsc function is the TRand object taking 3 arguments. TRand generates a value between 200 and 1000 every time the trigger is a non-zero value.  For a trigger, we are using the blip object, which creates a steady 10hz pulse (the impulses are spaced 100ms apart.)

ChucK is the youngest language of all the languages I’ve mentioned so far. It was written by Ge Wang at Princeton University for his PhD thesis. Like Supercollider, being able to do on-the-fly coding was an important feature for the language. The syntax of Chuck is very similar to that of C++ and is very object-oriented.

Here is what our blips would look like in ChucK:

In our blippy ChucK implementation, our sine wave oscillator is patched directly to the DAC using the => operator and we set the gain. The rest of our control is done inside of a while loop, where a random value is assigned to the sine wave’s frequency. An interesting quirk in ChucK is how values are assigned to variables. The ChucK equivalent to “int x = 10” would be “10 => int x”. This is due to the fact that in the world of digital signal processing, a signal path in a flow chart is shown going from left to right.  After the random frequency is assigned, time is explicitly told to move ahead 100 milliseconds, where the process will repeat itself again.


Honorable mention goes to the programming language Faust, developed at the GRAME institute in France. Faust is designed to easily create audio digital signal processing algorithms and effects. Faust takes Faust code and turns it into highly optimized C++ code and LLVM code, which can then be taken into all the musical languages mentioned above, and many more. With Faust you can create things like filters, reverbs, EQ, compressors, distortion units, and wah pedals; tools that musicians know how to use.

Faust is a functional programming language, which is quite ideal for many DSP algorithms. The code you write in Faust is very close to how the physical circuit would be made.  Faust code is typically very terse. Many hours can go into writing one line of Faust code (and it did for this example.)

Here is what our blips would look like in Faust:

As it turns out, the Faust implementation of our blips is a bit more challenging to understand than in previous examples and is mostly beyond the scope of this post. The important thing to look at is the bottom line with the process variable. This is the line that sends the audio to the speakers. What we are sending is the osc function (our sine wave), which is being scaled by 0.5. The random frequencies are being generated by what is known as a “sample and hold” module.


There’s more than one way to make your computer sing, and this is a good thing. The computer music community has individuals with varying programming and musical backgrounds, and one musical language is not going to work for everyone. Each language here has something interesting to offer for musical expression. Should you decide to one day make some noise, find a language here that feels familiar or comfortable to you!

Tags: audio, bleeps, bloops, computers, music, programming, Signal Processing,

Comments are closed.