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.
You getone complete HTML file in a single code block, then 3 short ideas to extend it.
The prompt
Act as a senior creative developer who builds playful audio toys for the web.
Build "Aether Wand", a theremin-style instrument played on a wide canvas. Horizontal pointer position sets pitch across three octaves, from A2 (110 Hz) to A5 (880 Hz), on a logarithmic scale. Vertical position sets volume: loud at the top, silent at the bottom. Below the canvas, draw a live oscilloscope trace from an AnalyserNode so players can see how pitch, loudness and waveform change the shape of sound.
Rules:
- Sound plays while the mouse or finger is pressed. Keyboard users move a cursor with the arrow keys and toggle sound with Space. Create the AudioContext on the first press, glide frequency smoothly, keep master volume low, and show a visible mute toggle.
- Add toggle buttons for waveform (sine, triangle, sawtooth, square) and pitch mode (free glide, chromatic snap, A minor pentatonic snap). Draw the allowed notes as vertical guide lines with note labels along the bottom.
- Show a live readout of note name, cents offset, frequency and volume, plus a one-line caption explaining the current waveform.
- Use a dark navy palette with mint and amber accents, system fonts, readable contrast and visible focus rings.
- Stabilize the trace on rising zero crossings. Draw a glowing cursor trail, but turn it off under prefers-reduced-motion. Resize the canvases crisply from 360px wide upward.
- No external libraries, fonts, files, storage or network calls.
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
- Fixed pitch range, log mapping and named snap scales leave the model nothing to guess, so pitch feels musical the first time.
- Placing the analyser before the master gain keeps the scope working while muted, and the zero-crossing trigger stops the trace from jittering.
- Requiring an AudioContext on first press, a mute toggle and keyboard controls avoids silent-page bugs and makes the toy accessible.
Paste into ChatGPT, Claude or Gemini. Save the returned code as aether-wand.html and open it in any modern browser, or run it in the chat's preview or canvas. Headphones help you hear the waveform differences.
Common edits
- Change the scale: replace the pentatonic degrees with major (0,2,4,5,7,9,11) or blues (0,3,5,6,7,10), or widen the range to four octaves.
- Add a vibrato LFO or a lowpass filter controlled by a second finger or a slider for richer, more theremin-like tones.
Keep exploring
More like this
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 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 Sound-Wave Explorer with Live Oscilloscope in a Single HTML File
You get a one-file interactive sound lab where students hear and see sine, square, triangle and sawtooth waves while changing frequency and amplitude.
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 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 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.