News Archive

Public beta release of Isobar, a Python library for algorithmic composition

Underlying Variable 4 is a suite of Python code, with components to deal with various different tasks – interfacing with the weather station, navigating the global score, broadcasting data, and so on. There’s one part in particular that we’ve found useful in general usage: the pattern generation code, which can be used to describe, manipulate and generate sequences of musical events.

We’ve finally cleaned this up for public release, and have christened it Isobar, from the notation used in meteorological pressure systems. In this context, it’s a way of notating music, in a concise and flexible manner.


Isobar is a pure Python library which makes it easy to express musical patterns, and output them through MIDI or (soon) OSC devices. It’s inspired by SuperCollider’s excellent pattern library, which allows patterns to be combined like building blocks to create easily extensible compositions.

To get it: download Isobar from GitHub.

Please note that this is a beta release, meaning that all features and syntax are subject to change.


To give a taste of Isobar’s approach and capabilities, let’s look at some example code

from isobar import *

seq = PSeq([ 0, 1, 2, 3 ])
seq = PStutter(seq, 2)
seq = seq + PSeq([ 0, 12 ])

for n in xrange(8):

> 0
> 12
> 1
> 13
> 2

The above creates a simple looping sequence (PSeq) based on increasing integers (or, if used as MIDI outputs, chromatic notes). Each value is repeated once (PStutter), and alternating notes are transposed an octave up. This is then used to output a sequence of numbers.

Note that patterns can simply be added together to transpose values. Many other operators can be applied in similar ways: for example, doing seq * 2 will double every value of a pattern, using lazy evaluation for no additional processor usage.

from isobar import *
from import *

scale = Scale([ 0, 2, 3, 7, 9, 11 ])
degree = PBrown(0, 2, -8, 8, repeats = False)

notes = PDegree(degree, scale) + 60

midi = MidiOut()
timeline = Timeline(160)

timeline.sched({ ‘note’: notes, ‘dur’: 0.25, ‘gate’: 0.9 })

This example binds a pattern to a MIDI device, and uses a random walk (PBrown) to play values from a particular Scale. A Timeline object is used to schedule MIDI events at a given BPM, and plays them through the default MidiOut device.

By assigning this pattern to the ‘notes’ value, its output is used to generate a series of pitches. We could assign a separate pattern to the ‘amp’ value, to control the velocity of each note.

Many more examples are available in the isobar distribution on GitHub, with an up-to-date index of pattern objects in the README. We’ll be continuing to work on Isobar extensively over the next few months; see the TODO file for forthcoming developments.

About Variable 4

Variable 4 is an outdoor sound installation that translates live weather conditions into an ever-changing piece of music, using weather sensors and custom software to generate and recombine thousands of musical fragments. Read more about the piece...