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

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

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

Example: Earwise, a night-mode piano interval ear trainer.

Press Start to hear two notes, then choose one of four intervals by clicking or pressing 1–4. Correct answers build a streak bonus. After each answer the keyboard lights the first note amber and the second teal. Press R to replay, S to reveal, and Space to go on. Try Falling or Together mode, switch to All 12 intervals, or tap any key to explore.

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

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