Changing BPM during playback stops the current run and releases its audio context, preventing already scheduled events at the old tempo from mixing with a new schedule.

The Online Drum Machine does this by design. Enter a valid whole-number tempo from 40 through 240, then press Play again; the new run starts cleanly at step one. The grid stays available, so you can adjust the beat without rebuilding it first.

That restart requirement is why changing BPM stops playback when you use an online drum machine with a look-ahead scheduler. The tool cannot replace already queued drum hits in place, so it closes the old run before beginning another one.

why does changing bpm stop playback when i use online drum machine
Why Does a BPM Change Stop Online Drum Machine Playback?

What happens when the tempo value changes

A Play press starts a browser-based scheduler. Every 25 milliseconds, a lightweight timer checks the loop and places upcoming events as far as 100 milliseconds ahead on the AudioContext timeline. This keeps ordinary JavaScript timing jitter from becoming the audible beat clock.

When the tempo field is edited during playback, the tool takes a full stop path: it clears the scheduling timer, stops and disconnects scheduled sound sources, empties its source list, and closes the current AudioContext. A fresh Play press is therefore required. This also prevents a short passage scheduled at the old BPM from being mixed with events scheduled at the new BPM.

Pattern editing is different. You can still toggle kick, snare, and hi-hat cells while the loop is running, and the scheduler reads those changes in its upcoming scheduling window. Tempo is the deliberate exception because it changes the timing of every future event rather than only which instrument plays on a step.

Action Playback result Required response
Edit BPM while stopped The value is accepted only when it is a whole number from 40 through 240. Press Play to start at step one.
Edit BPM while playing The current run stops and its audio context is released. Press Play to start a clean run.
Toggle a grid cell The pattern edit is read by the upcoming scheduling window. Playback can continue.
Press Stop Playback resources are released. Press Play when ready.
Choose Clear pattern All 48 cells are turned off. Press Play to start at step one.

Change BPM and restart the loop

Use this workflow whenever you need a different tempo:

  1. Enter the desired tempo as a whole decimal number from 40 through 240. For example, use 100 rather than 100.5; fractional values, signs, exponent notation, unit text, empty input, and out-of-range values produce a recoverable error.
  2. If the loop was playing, let it stop after the edit. The stop is the intended reset point: the previous run has released its audio resources instead of continuing with a mixed schedule.
  3. Press Play. This user action creates the browser audio context and starts the synthesized beat at step one.
  4. Check the moving outline and listen for the new pulse. Your grid pattern remains in place; changing the tempo does not perform the separate Clear pattern action.
  5. To try another tempo, repeat the same sequence: edit the BPM value, wait for playback to stop, and press Play again. Each accepted tempo change begins a fresh 16-step loop rather than continuing the old one.

The sequence is short because this tool is focused: Play, Stop, tempo entry, and grid toggles are the supported controls. There is no separate “apply while playing” or tempo-ramping mode.

BPM and the 16-step timing grid

BPM has a specific meaning here: quarter notes per minute, matching the tempo definition documented by the W3C MusicXML sound element. The grid is always four quarter-note beats divided into sixteen equal sixteenth-note steps, so each grid step lasts one quarter of a quarter note.

The timing relationship is:

Step duration (seconds) = 60 ÷ BPM ÷ 4

At the default 120 BPM, a worked example is 60 ÷ 120 ÷ 4 = 0.125 seconds per step. The full bar is therefore 0.125 × 16 = 2 seconds. That connects the tempo setting to the 16-cell grid; changing BPM alters the spacing and bar length without changing the number of cells.

The 40–240 range is a deliberate usability and scheduling guard, not a claim about the limits of musical tempo.

Why a clean restart protects timing

The Web Audio API lets scheduled sources begin at precise positions on an AudioContext timeline. This tool uses that mechanism rather than triggering each hit only when a browser timer callback fires. The timer checks every 25 milliseconds, but an event can be placed up to 100 milliseconds ahead with its exact intended start time.

If the scheduler tried to preserve old events while a new BPM took effect, those pending sounds would retain timestamps from the previous tempo. The stop-and-rebuild approach makes the change unambiguous: no pending hit from the old schedule is allowed to survive into the new run.

This improves ordinary browser timing, but it is not a guarantee of identical rendering on every device. Heavy browser throttling, suspended tabs, device changes, high system load, and operating-system audio latency can still affect what you hear. The tool is not a digital audio workstation, an AudioWorklet engine, or a guarantee of sample-accurate synchronization across devices.

What to check if playback does not return

If Play does not resume after a tempo edit, work through these checks:

  • Confirm the field contains a whole number from 40 through 240. Empty input, decimal fractions, signs, exponent notation, unit text, and values outside the range are rejected with a recoverable error.
  • Press Play again rather than waiting for the old run to resume. Tempo editing intentionally never resumes it automatically.
  • Keep device volume moderate before starting playback, especially with headphones, because synthesized transients can sound louder on some output systems.
  • If the browser reports an audio initialization or event-scheduling failure, read the recoverable message and try Play again; the tool does not retain a false playing state.
  • Bring the tab to the foreground while testing. The focused tool does not guarantee playback in a suspended or heavily throttled background tab.

Do not clear the pattern as a troubleshooting step unless you intend to turn all 48 cells off. Clear pattern is a reset control, not a fix for tempo handling. Since audio is created locally through Web Audio, no sample download or upload is needed, and the failure is not caused by a missing audio file.

What the restart workflow can and cannot do

This behavior applies to a focused straight-16-step sequencer. The kick is synthesized with a short enveloped sine oscillator, while snare and hi-hat use locally generated noise, filters, and gain envelopes. That keeps the workflow self-contained, but the voices are intentionally simple rather than recordings of physical drums. Their exact tone can vary slightly with browser audio implementation, output hardware, sample rate, and generated noise.

The limitation is important: this version does not support swing, triplets, velocity, accents, per-track volume, effects, recording, export, MIDI synchronization, arbitrary time signatures, or guaranteed background playback. It is intended for sketching sixteenth-note ideas, learning step sequencing, or testing a basic pulse. If you need live tempo automation, production arrangement, rendered stems, exact inter-device synchronization, or latency calibration, transfer the pattern concept to a dedicated music application.

If you're weighing options, When Should I Generate White Noise? Start Low, Stop Early covers this in detail.