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.
You getone complete HTML file in a single code block, then 3 short ideas to extend it.
The prompt
You are a front-end developer and music teacher who builds polished browser tools.
Build "Earwise", a night-mode interval ear-training quiz. Each round plays two synthesized piano-like notes from a two-octave keyboard (C4 to C6), and the learner picks the interval from four multiple-choice answers.
Rules:
1. Sound: Web Audio API only, a triangle wave plus a soft sine overtone with exponential decay. Create the AudioContext on the first click, tap or key press, keep the volume low and show a mute toggle.
2. Modes: toggles for Rising, Falling or Together playback, and for Core 6 (M2, M3, P4, P5, M6, octave) or All 12 intervals. Use random roots, and keep both notes on the keyboard.
3. Scoring: show score, streak, best streak and accuracy. A correct answer earns 10 points plus a streak bonus. A miss or Show answer resets the streak.
4. Controls: Start/Next, Replay and Show answer buttons. Keys 1-4 answer, R replays, S reveals, and Space or N advances. Any piano key can be tapped to hear it.
5. Feedback: mark right and wrong choices, color the first note amber and the second teal on the keyboard, name both notes and the semitone count, and replay the correct interval after a miss. Never highlight keys before the learner answers.
6. Layout: fits 360-1280px, high contrast, visible focus rings, no transitions under prefers-reduced-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
- Fixing the range at C4–C6 and keeping both notes on the keyboard means every interval can be drawn and highlighted correctly.
- Hiding key highlights until after the answer keeps the quiz honest. Replaying the right interval after a miss turns errors into practice.
- Synthesized tones started on the first gesture avoid autoplay blocks and audio files, so the page works offline on the first try.
Paste the prompt into ChatGPT, Claude or Gemini. Save the code as earwise.html and open it in any modern browser, or run it in the chat's preview or canvas. Use headphones for the clearest pitch.
Common edits
- Swap Core 6 for a beginner set such as P4, P5 and octave, or add a compound-interval mode up to two octaves.
- Change the tone to a sine-only flute or a square-wave chiptune, and recolor the amber/teal highlights to match your brand.
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 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.
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 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 Pomodoro Focus Timer with Synth Chimes and Brown Noise in HTML
A single HTML file Pomodoro timer with a progress ring, four-round cycles, distinct synthesized work and break bells, and a toggleable brown-noise bed.
Build a Retro 8-Bit Sound Effect Board with Tunable Chiptune Pads in HTML
A single HTML file with Jump, Coin, Laser and Explosion pads, each with pitch, decay and noise sliders, a randomize button and a live sweep preview.