Simon Holliday

Subsequence

Subsequence is a generative MIDI sequencer and algorithmic composition engine for Python. It acts as a boundless software alternative to hardware sequencers - a flexible framework that generates pure MIDI to drive your studio gear - with a custom timing technique precise enough to rival dedicated hardware.

I started writing Subsequence because I couldn't achieve the generative ideas I wanted within standard DAWs, which often emphasize static piano rolls over unfolding processes. Simultaneously, audio programming environments like SuperCollider felt too dense for times when I just wanted to sequence my existing hardware synths and drum machines without engineering the audio itself, but without the track and polyphony limits of physical hardware.

I built it to provide a vast palette of algorithmic building blocks alongside a stateful engine that lets patterns interact, morph, and evolve over time.

Unlike hardware sequencers that loop a fixed pattern forever, or live-coding environments that are typically stateless, Subsequence is designed around stateful evolution. It rebuilds every pattern fresh before each cycle with full context: the current chord, the section of the composition, the cycle count, and shared data from other patterns. A pattern can look back at the previous bar, know where it is in the composition, and make musical decisions dynamically.

The result is music that naturally develops over time, rather than just repeating.

An Algorithmic Palette

Every generative system needs controlled unpredictability. Subsequence provides a deep algorithmic palette borrowing ideas from mathematics, physics, and biology - concepts originally developed to model weather, simulate chemical reactions, or generate film textures. You can use the Euclidean rhythm generator and Bresenham distribution for complex polyrhythms; 1D and 2D cellular automata for self-organising evolution; L-systems and self-avoiding walks for melodic contours; and Markov chains for weighted probability paths. For truly organic variation, it leverages reaction-diffusion models, Fibonacci spacing, Lorenz attractors for chaotic drift, and Thue-Morse sequences.

Crucially, Subsequence is not merely additive. It allows for the dynamic shaping of performance: you can inject probability-weighted "ghost fills" or apply position-aware subtractive "thinning" as tension builds. Through implementations of Perlin and pink noise, parameter modulation - like velocity and filter sweeps - mimics the natural, correlated dynamic variations found in human performance. Everything is governed by a seed, allowing for fully repeatable, tweakable exploration.

Form and Evolution

Generative music often struggles with large-scale structure, getting stuck in infinite loops. Subsequence introduces the concept of Implicit Compositional Structure. You define the overarching sections (for example Intro, Verse, Chorus, Outro in a 'traditional' piece) and the engine gracefully moves through them - either linearly or via a probabilistic transition graph.

To ensure patterns evolve continuously even within those sections, Subsequence employs The Conductor. This global system provides LFOs and automation lines that unfold across any timeframe. Patterns read these overarching signals to shape density, shift harmonies, or modulate velocities over long timeframes, giving the piece a cohesive narrative arc.

Musical Cognition

Algorithms should sound like musicians, not random number generators. At its core, a weighted chord graph navigates harmonic transitions with adjustable gravity. Layer on the Narmour Implication-Realization model - a theory of music cognition where small melodic steps imply continuation and large leaps imply reversal - and the result is melodies and progressions that feel grounded, intentional, and deeply satisfying: not merely "no wrong notes," but music with real narrative flow.

Connecting the Physical Studio

Because Subsequence is written in pure Python, it effortlessly bridges the digital data layer and the physical studio. There is no domain-specific language to learn; your music is versionable, shareable, and lives in standard `.py` files. You can schedule any Python function on a beat cycle, pulling in external APIs, hardware sensor readings, or telemetry - routing live real-world data directly into your patterns to drive composition.

Built for serious studio use, it integrates seamlessly with Ableton Link to sync with other devices. Once an idea clicks, you can record the live generative session straight to a multi-channel MIDI file, bringing it back into your DAW for final arrangement and polishing. The core engine utilizes a highly optimized hybrid sleep-and-spin timing strategy, achieving pulse jitter of under 5 microseconds on Linux with zero long-term drift. It is efficient enough to run entirely headless on a Raspberry Pi.

Explore the Source

Subsequence has grown from a personal exploration into a complete open-source system for algorithmic composition. It is completely free and available for producers, developers, and musicians.