A breakbeat sampler for the terminal, with live coding in Lua
For the past few weeks I've been building SamplerL, a sampler and step sequencer that lives entirely in the terminal. The idea: slice a break (the classic amen), write the pattern as text, and hear it change on the next bar without stopping the audio.
Status: SamplerL is under active development and will keep improving. Expect rough edges, changing APIs, and new features. It was built with the help of Claude Code, which contributed to the construction of the project under my direction.
How it works
Load a WAV, the program detects the hits and slices it for you (or you slice it on a grid). Then you program in Lua:
bpm(170)
local amen = sample("amen.wav"):slice(16)
track("drums", amen):steps("0 . 4 . 2 . 4 r2 | 0 . 4 . 2 . 4' ^3")Each number is a slice, . is a rest, ' reverses it, ^3 pitches it up three semitones, r2 retriggers it as a stutter. Save with Ctrl-S and the change lands on the next bar. If your code errors, the previous version keeps playing, so a typo mid-performance doesn't kill the music.
What it has
- Slice detection by spectral flux, per-slice labels (
kick,snare), and per-slice effects inside a single track. - Free-length sequencer (polyrhythms), swing, humanize, Euclidean generators, and seeded randomness.
- Effects with automation (
ramp,lfo): filter, bitcrusher, distortion, compressor, delay, reverb, and EQ. - Pitch shifting with and without changing duration, polyphonic instruments, granular synthesis, and freeze.
- Frequency-clash analysis between tracks, with cut suggestions that you decide whether to apply.
- MIDI in and out, a play mode on the keyboard, and WAV export.
- A TUI with an editor, autocomplete, tracker, and mixer; the editor can run in its own window.
Design decisions
The audio thread never allocates, never takes a mutex, and never does I/O, and tests verify it. Changes are applied as atomic batches on the bar boundary. Audio is deterministic, so tests compare output bit for bit. It runs on x86_64 and ARM64 (I use it on Gentoo and Asahi Linux).
Why I built it
I wanted the immediacy of a tracker and the control of a programming language, without leaving the keyboard or the terminal. It's free software and still very much alive: ideas, bug reports, and criticism are welcome.
Development and AI assistance
SamplerL is a work in progress. I plan to keep improving it: more instruments, more effects, better tooling, and polish based on real use and feedback. Large parts of the code were written with Claude Code (Anthropic's coding agent), working from my design decisions, prompts, and testing. I review the results and run the test suite, but I'm being upfront that this is an AI-assisted project.