Sardine turns Python into a time-aware live coding instrument by making function evaluation immediate and hot-reloadable
Sardine is a Python framework that transforms a standard Python interpreter into a musical performance environment. Unlike batch-mode scripts, Sardine runs a scheduler that fires events at precise beat-aligned times. Code submitted to the running interpreter takes effect immediately — patterns update, notes fire, and MIDI/OSC messages route without restarting. This ‘live coding’ model treats the text editor as a musical instrument: the performer edits patterns on-the-fly while the clock keeps running. Sardine requires Python 3.10+ and connects to SuperCollider (for audio samples/synthesis), MIDI devices, or OSC-capable hardware.
Examples
Pa * d(‘bd cp hh’) launches a looping drum pattern. Editing the string and re-evaluating changes the beat immediately, without stopping playback.
Assessment
Describe what happens to a running Sardine pattern when you evaluate new code that redefines it. How does this differ from running a Python script normally?