Build an Accurate Web Audio Metronome with Tap Tempo in One HTML File

A single HTML file metronome with look-ahead Web Audio timing, tempo and time signature controls, accented downbeats, tap tempo and a pulsing beat display.

You getone complete HTML file in a single code block, then 3 short ideas to extend it.

The prompt

Prompt
You are a front-end developer who specializes in Web Audio timing. Build a single-page metronome called Pulsewright with a calm, dark practice-room theme. The core is a rock-steady click track from a look-ahead scheduler: a setInterval loop every 25 ms schedules oscillator clicks up to 120 ms ahead on the AudioContext clock. Rules:
1. Tempo runs from 30 to 240 BPM via a range slider plus -5, -1, +1 and +5 buttons. Show a large BPM number and an Italian tempo marking from Largo to Prestissimo. Changes apply on the next beat without stopping.
2. Provide time signature buttons for 2/4, 3/4, 4/4, 5/4, 6/8 and 7/8. The downbeat is a higher, louder click. Add softer secondary accents for 6/8 on beat 4 and for 7/8 grouped 2+2+3.
3. A Tap tempo button averages the last six taps and resets after a two-second pause.
4. A ring pulses on each beat, amber on the downbeat, above a row of beat dots. Sync both from a note queue read in requestAnimationFrame. Under prefers-reduced-motion, change color only, with no scaling.
5. Create the AudioContext on the first click, tap or key press. Keep the volume low and show a visible mute toggle. Keyboard: Space starts and stops, T taps, the arrow keys change tempo by 1 (5 with Shift), and M mutes.
6. Use a dark palette with amber and teal accents and 44px touch targets. The page must fit 360-1280px widths and use no external files or storage.
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: Pulsewright, a steady practice metronome with tap tempo.

Press Start or hit Space to hear crisp clicks, with a brighter accent on beat one. Drag the slider or use -5 / -1 / +1 / +5 (or the arrow keys) to change tempo while it plays. Try 6/8 and 7/8 to hear the secondary accents. Tap Tap tempo (or press T) along with a song to match its speed. Press M to mute and keep the visual pulse running.

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

Tips and common edits

Why this works

  • Naming the look-ahead scheduler (25 ms loop, 120 ms ahead on the audio clock) avoids the drift that setTimeout-only metronomes suffer.
  • A shared note queue drives the visuals, so the pulse lines up with what you hear instead of running on a separate timer.
  • Exact ranges, accent patterns and key bindings leave nothing to guess, so the first output is usable without follow-up edits.

Paste into ChatGPT, Claude or Gemini. Save the returned code as pulsewright.html and open it in any modern browser, or run it in the chat's preview or canvas. Click Start to hear it.

Common edits

  • Swap the sine clicks for short noise bursts or a woodblock-like envelope, or add a subdivision toggle for eighths and triplets.
  • Change the palette or rename the app, and widen the tempo range to 20-300 BPM for drummers.

Prompt details

By
Prompts-GPT editors
Published

Did this prompt work?

Keep exploring

More in Sound Effects & Music