Music, Composition and the Computer

The marriage of music, composition and the computer may seem like an unlikely partnership, bringing together the arts, mathematics and the sciences in what many would see as an unholy trinity. It is not however as unnatural as you might first think. Many great scientists have also been exceptional artists and vice versa, the most famous of whom is unquestionably Leonard Da Vinci.

Music and technology have in fact had an intimate relationship throughout time with technological advances aiding music in many diverse ways. Take the printing press as an example, the ability to shape iron over a flame, or the phonograph.

What makes older technologies significantly different from the use of computers in music making is their effect on the compositional process rather than on the instrument building or performance processes. Computers have the ability to radically change the way in which we compose and the compositional processes that we use due to thier ability to be programmed and to execute operations quickly.

This is the opening of some Masters thesis found around the place : )

"The twentieth century has been marked by significant technological innovation, particularly with the advent of the computer, whose influence has spread beyond the confines of the office to include activities such as sport, entertainment, and the arts. In these roles, the digital computer is often used to provide a means for modelling the complexity of real world patterns and associations. Machine abstractions of the world are becoming increasingly common, providing humanity with artificial representations of real world events and phenomena within digital micro-domains. The potential for designing machine abstractions of artistic structures has driven many artists to explore digital micro-domains as a means to create digital tools designed to investigate structural formalisms." (Sorensen 1998).

It is these structural formalisms that computer music composition utilises.

Read this article on "Why employ computer programming for music making" by Chris Dobrian.

Anyway enough of this tripe, show me the code!

Make it go Bing!

For those who can't wait to see code and hear results, here is a trivial jMusic class.

import jm.JMC;
import jm.util.Play;

public final class Bing implements JMC {
    public static void main(String[] args) {
        Play.midi(new Note(C4, QN));

Here is a less terse example that writes out a MIDI file. (Green type is simply comments, not the code itself.)

//give this class access to the jMusic classes

import jm.JMC;


import jm.util.*;


* This is the simplest jMusic program of all.

* The eqivalent to a programming language's 'Hello World'


public final class Bing implements JMC{

public static void main(String[] args){

//create a middle C minim (half note)

Note n = new Note(C4, MINIM);

//create a phrase

Phrase phr = new Phrase();

//put the note inside the phrase


//pack the phrase into a part

Part p = new Part();


//pack the part into a score titled 'Bing'

Score s = new Score("Bing");


//write the score as a MIDI file to disk




To run this program copy and paste the code into a text editor, save it as and compile and run it with your Java tools.

A more compact version of this jMusic class that also renders the score as an audio file is shown below.

import jm.JMC;
import jm.util.*;
  public final class SonOfBing implements JMC{
public static void main(String[] args){
Score score = new Score(new Part(new Phrase(new Note(C4, MINIM))));
Instrument inst = new SawtoothInst(44100);, inst);

jMusic Tutorial Index