Drum Machine

Make beats with a step sequencer — program kick, snare, hats and more, entirely in your browser with nothing to install.

The grid holds every figure whose length divides 32, and quietly refuses the rest

32 steps of sixteenth notes is 8 beats, which is 2 bars of four four. Anything that repeats on a length dividing 32 fits exactly and sounds the same on every pass. Nothing else does.

Figure repeats everyReturns to the top afterPasses of the grid
1 step 32 steps fits
2 steps 32 steps fits
3 steps 96 steps 3
4 steps 32 steps fits
5 steps 160 steps 5
6 steps 96 steps 3
7 steps 224 steps 7
8 steps 32 steps fits
12 steps 96 steps 3
16 steps 32 steps fits
32 steps 32 steps fits

The 6 that fit are exactly the powers of two, because 32 is one. A three-step figure — the commonest way to make a pattern pull against the beat — needs 96 steps, or 3 complete passes, before it lands back on the downbeat. Written into 32 steps it is cut off and restarts, so the pull never resolves.

The rule is the least common multiple, and for any odd length it is simply that length — an odd number shares no factor with a power of two, so a seven-step figure takes 7 passes. Six and twelve behave like three, because the factors of two they do share are all the help they get.

Which makes the grid honest about what it is: a two-bar loop in four four, not a general sequencer. That is the right choice for a tool you open for thirty seconds, and it is worth knowing before you try to build a triplet feel and cannot work out why it will not sit still.

The timing is kept by the audio clock, not by the timer

A repeating timer is not accurate enough to play music with — it drifts, and the drift accumulates. So the timer here does not play anything. It wakes every 25 ms, looks 100 ms ahead, and hands every step that falls in that window to the audio clock with an exact time attached. The timer being late does not matter, because the sound was scheduled before it mattered.

BPMA sixteenth isWake-ups per stepSteps queued at a time
60 250 ms 10.0 0.4
90 166.7 ms 6.7 0.6
120 125 ms 5.0 0.8
160 93.8 ms 3.8 1.1
200 75 ms 3.0 1.3
240 62.5 ms 2.5 1.6
300 50 ms 2.0 2.0

The margin holds across the whole range. At the top setting of 300 a sixteenth is 50 ms, still two wake-ups per step. The scheme would only start missing steps once a sixteenth got shorter than the 25 ms wake-up, which happens at 600 — 2 times as fast as the control can be set.

At slow tempos the 100 ms window holds less than a whole step, so most wake-ups find nothing due and queue nothing at all. That is fine. What has to be true is the other direction — that no step can slip past between wake-ups — and that is the wake-up column. One full pass of the grid runs 8 seconds at 60 down to 1.6 at 300.

How to use

  1. Set the tempo and pattern length.
  2. Click steps to place hits.
  3. Start with kick and snare before adding anything else.
  4. Leave space — most beginner patterns are too busy.

Frequently asked questions

What is a step sequencer?

A grid where each row is a sound and each column a slice of time, usually a sixteenth note. Clicking a cell places a hit there. It came from hardware drum machines of the late 1970s and 1980s, and the layout has barely changed because it works.

Where do I start with a basic beat?

Kick on beats one and three, snare on two and four, hats on every eighth. That is the backbone of an enormous amount of popular music, and almost every other pattern is a variation on it. Getting it solid before adding anything is the fastest route to something that sounds like music.

Why do my patterns sound mechanical?

Because everything lands exactly on the grid at identical volume. Real playing varies both. Adding swing shifts the off-beats slightly late, and varying velocity — hitting some notes harder — restores the accent pattern a human would produce naturally.

What is swing?

Delaying every other subdivision so the rhythm feels loping rather than straight. It is fundamental to jazz, shuffle, hip hop and house, and the amount is a continuous dial rather than on or off. A little swing on hats transforms a stiff pattern.

Why is my beat too busy?

Because adding is easier than removing, and most beginners fill every step. Space is what gives a beat groove — the classic patterns are notably sparse, and removing hits usually improves a pattern more than adding them does.

Does anything get uploaded?

No. The sequencer runs entirely in your browser using the Web Audio API, so nothing you make is transmitted and no account is needed.

🔒 This tool runs entirely in your browser. Nothing you enter is uploaded, logged, or stored.