Build a 16-Step Drum Sequencer with Tempo and Swing in One HTML File
A ready-to-paste prompt that makes an AI build a clickable 16-step drum machine with synthesized drums, preset grooves, tempo, swing and a moving playhead.
The prompt
You are a front-end developer and sound designer who builds polished browser music toys. Build "Pocket Groove", a 16-step drum sequencer in one HTML file with a dark studio theme. Show five rows (Kick, Snare, Clap, Hi-hat, Open hat), each with 16 clickable step squares. A moving playhead lights the current column while the loop plays. Rules: 1) Synthesize every drum with the Web Audio API: a sine pitch-drop kick, plus filtered noise for the snare, clap and hats. Create the AudioContext on the first click, tap or key press, keep master volume low and include a visible mute toggle. 2) Use a lookahead scheduler for tight timing. Add a tempo slider (60-180 BPM) and a swing slider (0-75%) that delays every second sixteenth note; both must work while the loop plays. 3) Include four preset groove buttons (Four on the Floor, Boom Bap, Breakbeat, Funky Shuffle) that set pattern, tempo and swing, plus a Clear button. Load one preset on start so the grid looks alive. 4) Make the steps real buttons with aria-pressed. Space plays and stops, M mutes, C clears, and turning a step on previews its sound. 5) Give each row its own color on a dark navy panel and shade beats in groups of four. The layout must fit 360-1280px wide, and the playhead pulse turns off under prefers-reduced-motion. Use no external files, storage or network calls. Output format: one complete HTML file in a single code block, then 3 short ideas to extend it.Example output
Tips and common edits
Why this works
- A lookahead Web Audio scheduler keeps the beat steady even when the UI is busy, so the loop sounds tight on the first run.
- Preset grooves load on start, so beginners hear a working beat before touching a single step.
- Real buttons with aria-pressed plus Space, M and C shortcuts make the grid usable by mouse, touch and keyboard.
Paste the prompt into ChatGPT, Claude or Gemini. Save the returned code as pocket-groove.html and open it in any modern browser, or run it in the chat's preview or canvas. Click Play to hear the loop.
Common edits
- Change the theme by swapping the five track colors and the accent yellow, or rename the rows and presets to fit a genre like trap or reggae.
- Add a sixth track such as a cowbell (two detuned square oscillators) or a tom (sine pitch drop at 120 Hz).
Prompt details
- By
- Prompts-GPT editors
- Published
Did this prompt work?
Keep exploring
More like this
Build a Generative Ambient Chime Toy With Pentatonic Notes in One HTML File
A ready-to-paste prompt that builds a calm ambient music toy where every tap drops a glowing, drifting ripple and a pentatonic chime, with an auto-play mode.
Build a Theremin-Style Pointer Instrument with Live Waveform in One HTML File
A ready-to-paste prompt that builds a canvas theremin. Horizontal motion sets pitch, vertical motion sets volume, notes can snap to a scale, and a live oscilloscope trace shows the sound.
Build a Touch-Friendly Synth Drum Pad With Keyboard Shortcuts in One HTML File
Get a single HTML file with an eight-pad drum machine that synthesizes kick, snare, hats, clap, toms and bell live and responds to taps or QWERTY keys.
Build a Four-Lane Rhythm Tap Game with a Synthesized Beat in One HTML File
A ready-to-paste prompt that builds an original four-lane rhythm game with a Web Audio backing loop, Perfect/Good/Miss timing judgments, combos, and keyboard plus touch lanes.
Build a Guided Breathing Exercise App with Soft Rising Tones in One HTML File
A prompt that produces a single-file breathing guide with box, 4-7-8 and coherent patterns, an expanding circle and gentle synthesized sine swells.
Build a Piano Interval Ear-Training Quiz with Streak Scoring in One HTML File
A one-file interval ear trainer that plays two synthesized piano notes, gives four multiple-choice answers, tracks streaks and shows the answer on a keyboard.