Project: isobar

A Python library to express and manipulate musical patterns.

title: isobar
platform: Python
license: MIT
created: 2011/09

isobar is a Python framework for expressing and constructing musical patterns, designed for use in algorithmic composition. It allows for concise construction, manipulation and transposition of sequences, supporting scalar operations on lazy patterns. These can then be output via MIDI or (soon) OSC.

It is inspired by SuperCollider's excellent pattern library, which allows patterns to be combined like building blocks to create easily extensible compositions.

Download

Get the source from github:

	git clone git@github.com:ideoforms/isobar.git

Examples of common operations are included within the distribution.

Usage

from isobar import *
from isobar.io.midiout import *

# create a repeating sequence with scalar transposition:
# [ 48, 50, 57, 60 ] ...
seqA = PSeq([ 0, 2, 7, 3 ]) + 48

# apply pattern-wise transposition
# [ 48, 62, 57, 72 ] ...
seqA = seqA + PSeq([ 0, 12 ])

# create a geometric chromatic series, repeated back and forth
seqB = PSeries(0, 1, 12) + 72
seqB = PPingPong(seqB)

# create an velocity series, with emphasis every 4th note,
# plus a random walk to create gradual dynamic changes
amp = PSeq([ 60, 40, 30, 40 ]) + PBrown(0, 1, -20, 20)

# a Timeline schedules events at a given BPM, sent over a specified output
timeline = Timeline(120)

midiout = MidiOut()
timeline.output(midiout)

# assign each of our Patterns to particular properties
timeline.sched({ 'note': seqA, 'dur': 1 })
timeline.sched({ 'note': seqB, 'dur': 0.25, 'amp': amp })

timeline.run()