Virtual Piano
Interactive piano keyboard with numbered notation (1-7), melody playback, recording, and Web Audio synthesis.
Type or paste numbers (e.g. 1155665 4433221 or with spaces/dashes 1 1 5 5 6 6 5 - 4 4 3 3 2 2 1) to auto-play melodies.
Click any song to load into the player and start playing:
1234567= Do Re Mi Fa Sol La Ti (Middle C4-B4)8,9,0or1*,+1= High Octave (C5, D5...)1.,5.or-1= Low Octave (C3, G3...)-or space = Sustained beat or pause#1,#4= Sharp accidentals (black keys)
About the Virtual Piano & Musical Synthesis
The HayaBoost Virtual Piano is a full-featured, zero-latency Web Audio instrument and numbered musical notation (Jianpu / 简谱) workstation designed for musicians, students, educators, and developers. It features 37 chromatic keys spanning three full octaves (C3 to C6 / MIDI notes 48 to 84), multiple synthesized instrument models, real-time waveform visualization, interactive keybinding mapping, and an automatic number melody sequencer.
How Web Audio Synthesis Works
Unlike conventional web pianos that rely on heavy, pre-recorded audio sample files (which suffer from slow download times and click artifacts), this virtual piano synthesizes sound waves in real time via the browser's native Web Audio API (AudioContext):
- Grand Piano: Combines a primary sine wave oscillator with secondary triangle and sawtooth harmonics, shaped through an exponential decay gain envelope (ADSR) to mimic the percussive hammer strike and resonant acoustic decay of physical piano strings.
- Electric Piano (Rhodes Style): Employs dual harmonic oscillators with a subtle low-pass biquad filter and bell-like attack transient, recreating vintage analog tine resonance.
- Music Box / Celesta: Uses high-frequency pure sine tones with rapid decay and resonant overtones, creating a bright metallic chime.
- 8-Bit Retro Synth: Utilizes clean square waves with fast release curves reminiscent of classic 1980s gaming sound chips (such as the NES 2A03 and Game Boy PAPU).
The Mathematical Physics of Equal Temperament Tuning
Modern Western music utilizes the 12-tone Equal Temperament (12-TET) tuning system. In this system, the frequency ratio between each adjacent semitone is exactly the twelfth root of two: \( \sqrt[12]{2} \approx 1.059463 \).
Using standard concert pitch where the tuning reference note A4 is calibrated to \( 440\,\text{Hz} \), the fundamental frequency \( f \) of any MIDI key number \( n \) is computed dynamically using the formula:
f(n) = 440 × 2(n - 69) / 12
For instance, Middle C (C4, MIDI key 60) evaluates to \( 440 \times 2^{-9/12} \approx 261.63\,\text{Hz} \), while High C (C5, MIDI key 72) equals \( 523.25\,\text{Hz} \), precisely double the frequency of Middle C.
Numbered Musical Notation (Jianpu / 简谱) Quick Guide
Numbered musical notation is one of the most widely used musical transcription systems across Asia and music education. Instead of five-line staves, pitches in a major scale are represented by Arabic numerals 1 through 7:
| Numeral | Solfège | Key (C Major) | Default Keyboard Key |
|---|---|---|---|
| 1 | Do | C4 (Middle C) | 1 |
| 2 | Re | D4 | 2 |
| 3 | Mi | E4 | 3 |
| 4 | Fa | F4 | 4 |
| 5 | Sol | G4 | 5 |
| 6 | La | A4 | 6 |
| 7 | Ti | B4 | 7 |
- Higher Octave: Indicated by a dot above the digit (e.g.,
1̇) or numerals8,9,0(or prefix+1). Play with 8, 9, 0 or Q-]. - Lower Octave: Indicated by a dot below the digit (e.g.,
1̣,5̣) or suffix dot (e.g.,5.). Play with Z-M. - Sustained Beats: Represented by hyphens (
-) or spaces, extending the duration of the preceding note. - Accidentals (Sharps): Notated with
#(e.g.,#1,#4), triggering the corresponding black piano key.
Frequently Asked Questions (FAQ)
Can I play this virtual piano using my computer keyboard?
Yes! The default layout maps computer keys 1 through 7 directly to Middle Octave notes (C4-B4). You can also use keys 8, 9, 0 for higher notes, or bottom row keys Z through M for the low octave. Hold or toggle Spacebar for the sustain pedal.
Does this tool require external MIDI hardware or audio plugins?
No external hardware, plugins, or software downloads are required. The piano runs 100% inside your web browser using client-side JavaScript and the Web Audio API standard. It is compatible with all modern desktop and mobile browsers.
How do I create and play custom melodies?
Paste or type your number melody into the "Number Melody Player" text area (for example: 1 1 5 5 6 6 5 - 4 4 3 3 2 2 1), adjust the tempo BPM slider to your desired speed, and click "Play Melody". You can also copy pre-loaded tunes directly from the preset melody library.
Why do I hear no sound on initial page load?
Modern web browsers (including Google Chrome, Apple Safari, and Microsoft Edge) implement strict autoplay security policies that require an explicit user gesture (such as clicking a key or button) before an AudioContext is permitted to output sound.