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.
You getone complete HTML file in a single code block, then 3 short ideas to extend it.
The prompt
Act as a senior front-end developer who specializes in the Web Audio API and touch interfaces.
Build "Nightshift Drum Pad", a dark, studio-themed finger drumming toy with eight square pads in a 4 by 2 grid: Kick, Snare, Closed Hat, Open Hat, Clap, Low Tom, High Tom and Bell. Every sound is synthesized at hit time. Use pitch-dropping sine oscillators for the kick and toms, filtered white noise for the snare, hats and clap, and two detuned square waves through a bandpass filter for the bell. No audio files.
Rules:
1. Controls: tap or click any pad, or press Q W E R for the top row and A S D F for the bottom row. Ignore key auto-repeat. Holding Shift plays an accent. M toggles mute. Pads are real buttons, so Enter works when one is focused.
2. Velocity: a tap near the pad center plays louder than a tap near the edge. A colored flash and a small meter bar inside the pad scale with that velocity.
3. Audio: create the AudioContext with an interactive latency hint on the first tap or key press. Route sound through a low master gain and a compressor. A closed hat cuts off a ringing open hat.
4. Layout: header with title and one-line instructions, a visible mute toggle and a volume slider, then the pad grid. Each pad shows its key cap. The page fits 360 to 1280 px wide and supports multi-touch.
5. Style: near-black background with one accent color per sound family and readable contrast. With prefers-reduced-motion, keep the color flash but drop the press-scale motion.
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
- Creating the AudioContext on the first gesture with an interactive latency hint avoids blocked autoplay and gives near-instant response.
- Naming the exact synthesis recipe for each drum (pitch drops, filtered noise, bandpass bells) gets convincing sounds on the first try.
- Spelling out keys, velocity, choke and reduced-motion rules leaves the model nothing to guess, so the file works when you open it.
Paste into ChatGPT, Claude or Gemini. Save the returned code as nightshift-drums.html and open it in any browser, or run it in the chat's preview or canvas. Tap a pad or press a key once to wake the audio.
Common edits
- Change the theme by swapping the pad names, accent colors and title, for example a retro 8-bit kit with square-wave drums.
- Add a simple 16-step sequencer row under the pads that loops the same synth functions at an adjustable tempo.
Prompt details
- By
- Prompts-GPT editors
- Published
Did this prompt work?
Keep exploring
More like this
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.
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 Two-Octave Synth Keyboard with ADSR, Filter and Waveform Controls
A single HTML file synth keyboard you can play with the mouse, several fingers or computer keys, with waveform, filter, ADSR, presets and live visuals.
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 Classroom Game Show Buzzer Board with Timer Sounds in HTML
A prompt that builds a single HTML quiz-night console with four colored team buzzers, correct and wrong sounds, scoring, and a ticking countdown that ends in a horn.