Neon Piano
By Neon Piano
1 views·1h ago
🎹 Neon Piano
A playable one-octave neon synth keyboard you can perform with directly — no game mode, no falling tiles, no score. Just press a key (mouse, touch, or keyboard) and a real square-wave tone rings out and sustains for as long as you hold. The full C → high C with all five sharps is laid out across one row, with a 9-octave shifter so you can roam from sub-bass to piccolo range. Cyberpunk visuals with a cyan→magenta gradient palette, CRT scanlines, and the Orbitron typeface — same family as the Neon Tiles games, designed as their landscape-orientation companion instrument.
🎮 How to Play
It plays like a real keyboard. Press = note on, release = note off.
- Mouse / Click — Click and hold a tile to sustain the note; release to stop.
- Touch — Same gesture on mobile/tablet. Each touch is independent.
- Keyboard (white keys) —
ASDFJKL;map to C D E F G A B C (one full octave, do→do). - Keyboard (black keys / sharps) —
WEYUImap to C♯ D♯ F♯ G♯ A♯, sitting visually between their flanking white keys. - Octave down —
Q(or the- OCTbutton) - Octave up —
P(or the+ OCTbutton) - Jump directly to an octave —
1through9on the number row, or click the colored number buttons. Default is octave 4 (middle C).
✨ Features
🎵 Real Sustained Synthesis, Not Sample Playback
- Built on the Web Audio API with live
OscillatorNodesquare-wave synthesis — no audio files, just math. - Each note actually consists of two oscillators: a fundamental (volume 0.10) and an octave overtone (volume 0.025), mixed to give the tone a slight 8-bit-game richness without losing its edge.
- Notes sustain indefinitely while you hold the key, with a 120 ms exponential release ramp on key-up — no sudden cutoffs, no artificial decay.
- Polyphonic: hold multiple keys at once (mouse + keyboard + touch all stack) and every note rings simultaneously.
🎹 Full Chromatic Octave, Sharps Included
- 8 white tiles arranged across the full keyboard width, labeled with their pitch (e.g.,
C4), keyboard hotkey (e.g.,A), and matching keyboard letter. - 5 black tiles overlaid above the white-tile boundaries at correct piano positions (between C–D, D–E, F–G, G–A, A–B). Geometry is computed from the actual layout math (
(90vw - 7×0.6vw gap) / 8 white keys), so the sharps land exactly on the boundary, not approximately. - Black-tile colors are computed as the average of their two flanking white keys' colors, so the cyan→magenta gradient flows smoothly across all 13 keys — not just the white ones.
🌐 9-Octave Range
- Shift the entire keyboard from octave 1 (deep sub-bass, C1 = ~33 Hz) to octave 9 (well into ultrasonic territory, C9 = ~8.4 kHz).
- The high C of any octave is the low C of the next, so you always have 8 do→do white keys regardless of where you are.
- Number buttons across the top are themselves painted along the same cyan→magenta gradient, so you can see at a glance where on the spectrum you are.
🎨 Polished Neon Visuals
- CRT scanline overlay on the whole screen — subtle horizontal lines at 1 px / 3 px spacing, giving the synth a retro arcade-cabinet feel.
- Each tile has its own neon tube look: dark interior with scanline texture in the tile's color, glowing border, and an outer halo on press.
- Active state is dramatic: the whole tile fills with its color, the label flashes white with a glowing text-shadow, and the outer halo doubles in size.
- Gradient title ("NEON PIANO") across the top in the same cyan → purple → magenta sweep used by the Neon Tiles game series.
- Octave indicator buttons highlight in their own color when selected, with a strong outer glow.
🧠 Smart Input Handling
- Audio context warmup: a 10 ms silent sample plays at first user gesture so the audio thread is spooled up before the first real note — no first-press latency.
latencyHint: 'interactive'on the AudioContext for the lowest practical latency.e.repeatfiltered on keydown so holding a key doesn't retrigger the note 30 times per second.window blurreleases everything — switching tabs or apps won't leave a note hanging.mouseleavealso counts as release so dragging off a tile won't strand a sustained note.- Octave changes release all currently-held notes cleanly before rebuilding the keyboard, so no stuck tones from before the shift.
📱 Multi-Touch + Multi-Input
- Touch events use
passive: falsewithpreventDefaultso the keyboard doesn't trigger page scroll or zoom on mobile. - Multiple touches can hold multiple keys independently — play actual chords with two thumbs or all ten fingers.
- Mouse, touch, and physical keyboard all coexist — you can hold a chord with your left hand on the keyboard and add notes with your right hand on the touchscreen.
🛠️ Tech Stack
- Pure HTML / CSS / JavaScript — zero dependencies, zer
Loading comments...
Other Codes
No other codes yet