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

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

One HTML file. Save it and open it in any browser.Open full screen

Example: Nightshift Drum Pad, an eight-pad synth drum kit for fingers and keyboards.

Tap the pads or press Q W E R / A S D F to play kick, snare, hats, clap, toms and bell. All sounds are built live from oscillators and noise. Tap near a pad's center for a harder hit and watch the flash and meter grow with it. Hold Shift for accents, press M to mute and use the slider to set volume. Try a closed hat (E) right after an open hat (R) to hear the choke.

Written by AI from this prompt. Your results will vary.

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 in Sound Effects & Music