A labs.llc instrument

Eight voices.
Sixteen steps.

A drum machine that makes its own sound. Every voice on this page is built out of oscillators and noise at the moment it plays: the kick is a sine swept down in pitch under a fast decay, the snare is a noise band over a body tone, the hats are the same noise filtered and given two different decays, and the clap is a short train of bursts. There is no sample library here, nothing is downloaded, and nothing you play is uploaded.

The sequencer does not play on a timer. It writes each step into the audio clock’s future, a fraction of a second ahead, and the timer that keeps it ahead runs in a Worker — because a phone that has been left alone throttles the page’s own timers, and a machine that stops keeping time when you look away is not a machine.

8Synthesised voices

16Steps in the grid

8Pattern slots

0Samples downloaded

The machine

Sixteen steps, and what sits on them.

Press a cell once to put a hit on that step, again to accent it, a third time to clear it. An accented hit is played louder than a plain one and nothing else about it changes. Choose a voice by its name at the head of its row — or with the number keys 1 to 8 — and the panel underneath gives you that voice’s level, its tuning and the length of its decay.

The grid does not open empty, and what is on it is a setting rather than anything the machine worked out: a kick on each of the four quarters with the first one accented, and a closed hat on every eighth. It is the plainest thing sixteen steps can hold, it is the same on every visit, and Clear grid takes it away. A link with a pattern in it replaces it before you ever see it.

The machine

Stopped.

Space plays · 18 pick a voice · arrows move · Enter sets a step

112 BPM
0%
16 steps
85%

Swing delays every odd sixteenth by a percentage of one step: at 0% the grid is even, and at 33% a pair of sixteenths falls into a triplet shuffle. The range here stops at 60%, past which the late step would land on the one after it.

The grid is built by this page’s own script. With JavaScript off there is nothing here to play.

The kits

Five sets of numbers, one set of voices.

A kit here is not a sampled machine and is not an emulation of one. It is a table of levels, tunings and decay lengths for the same eight synthesised voices, and choosing one writes those numbers into the controls above, where you can move any of them afterwards. The names describe what the numbers do to the sound and nothing else.

The kits

Patterns

Eight slots, and a link.

A slot holds the whole machine: every cell, the tempo, the swing, the pattern length, the kit and each voice’s three numbers. Slots live in this browser’s own storage and go no further — clearing the browser’s site data clears them, and they are not on any other machine you use. The link is the way to move a pattern: it carries the pattern inside its own address, so anyone who opens it gets the pattern and nothing is stored anywhere to make that work.

The slots

Nothing has been copied yet.

Record

Capture what you are hearing.

The recorder taps the machine’s output bus and hands it to the browser’s own encoder. Which format you get is the browser’s decision, not this page’s: most write WebM with Opus inside it, Safari writes MP4 with AAC. The page asks the recorder what it actually produced when the take ends, names the file after that, and prints it below — so the extension is never a guess.

The recorder

Not recording.

Recording starts the machine if it is stopped, and the take ends when you press the button again.

About

How each voice is built.

The eight voices

The kick is one sine oscillator whose frequency is swept from roughly 160Hz down to 48Hz in the first fifty milliseconds, under an amplitude envelope that opens in four milliseconds and decays exponentially; a very short band of noise sits on the front of it for the beater. The snare is two things at once: a band of noise around 1.8kHz for the wires and two triangle tones at 185 and 331Hz for the drum under them, falling a little as they go, and decaying rather more than twice as fast as the noise does. The closed hat and the open hat are the same high-passed noise with different decay lengths, and a closed hat cuts an open one that is still ringing, exactly as one physical hi-hat cannot be open and shut at once. The clap is four bursts of band-passed noise eleven milliseconds apart, the last of which is given a tail — the spacing is what makes it a clap rather than a short snare. The two toms are pitch-swept sines like the kick but far less steep, and the rim / bell is two square oscillators a fifth or so apart through a narrow band-pass with a very short decay.

Level, tune and decay are the three numbers you can move on each of them. Tune multiplies every frequency in the voice, decay multiplies every time constant, and level is the gain into the mix. Nothing is quantised to a preset: the sliders are the parameters the synthesiser is actually reading.

The clock

Nothing is played by the timer. On each wake the scheduler looks at the audio clock, works out which steps fall inside the next tenth of a second or so, and writes them at sample-accurate times; the timer only has to wake often enough to stay in front. That timer runs in a Worker as well as on the page, because a browser throttles a background tab’s timers — on a phone, to about one a second — and Worker timers are exempt. Both pumps call the same function, whichever arrives first does the work, and if the page is stalled for longer than the horizon the counters advance without playing the backlog, so the machine picks up on the beat it would have reached rather than firing everything it missed at once.

Stopping

Stop cuts the sound. Clearing the scheduler only stops more steps being written — a tenth of a second of them is already in the audio clock’s future and a long decay may still be running — so the output is ducked over eight milliseconds, then every voice’s bus is replaced, which disconnects everything currently sounding and everything already scheduled in one move. The duck exists because cutting a gain to zero in a single sample is a click, and the output re-opens on the next note rather than on a timer.

What this is not

It is not a sampler and there is no sample library behind it: if a sound is not in the list above, this machine cannot make it. It is not an emulation of any particular hardware, and the kits are named for what their numbers do rather than after any machine this is not. It is one pattern of up to sixteen steps — there is no song arrangement, no chaining of patterns, no per-step probability and no MIDI. It plays at the latency your browser and device give it, which on a phone can be enough to feel when you tap along.

Where anything you make goes

Nowhere. Patterns are held in this browser’s local storage under keys beginning labs.drums.; a shared link carries the pattern in the fragment, which browsers do not send to servers; a recording is a file the browser hands to you. This page loads no audio and posts none. The scripts it adds are js/kit.js, js/clock.js and js/machine.js, and you are welcome to read all three.