Virtual Piano
Play two octaves of equal-temperament piano from the keyboard or the pointer, each note one oscillator with an attack, decay, sustain and release.
What this page makes
Twenty-five keys from C4 to C6, tuned to A4 = 440 Hz, each note an oscillator and a gain envelope in the tab.
How to use it
Click a key, or press A W S E D F T G Y H U J K for C4 to C5. Choose a wave first if you want a different timbre. Every other key is reached with the pointer.
Worked example: the A4 key with the triangle wave becomes one note at 440.00 Hz with an 8 ms attack, 120 ms decay, 0.35 sustain and 250 ms release.
Method
Each key is one OscillatorNode at 440·2^((m−69)/12) hertz, through a GainNode whose attack, decay, sustain and release are linear ramps. Eight voices sound at once; a ninth press stops the oldest. There is no sample library and no MIDI input.
What it refuses
A note outside the drawn C4–C6 range is refused rather than transposed, and the page refuses to accept MIDI input: it has no MIDI API and does not claim one.
Where it runs
Every note is synthesised in this tab: no sample is loaded, no key press is stored and nothing is sent anywhere. The browser requirement is stated on the page: Playback needs the Web Audio API (AudioContext and OscillatorNode). No sample, MIDI device or plugin is involved.
The rest of the family
The other audio and recurrence pages are listed under Calculators: tone and binaural generation, the virtual piano, pitch shifting, looping and reversal, the stated noise filter chain, mid/side cancellation, microphone recording and the closed-form recurrence solver.
Twenty-five keys from C4 to C6, tuned to A4 = 440 Hz, each note an oscillator and a gain envelope in the tab.
Each key is one OscillatorNode at 440·2^((m−69)/12) hertz, through a GainNode whose attack, decay, sustain and release are linear ramps. Eight voices sound at once; a ninth press stops the oldest. There is no sample library and no MIDI input. Every note is synthesised in this tab: no sample is loaded, no key press is stored and nothing is sent anywhere.
Worked example: the A4 key with the triangle wave becomes one note at 440.00 Hz with an 8 ms attack, 120 ms decay, 0.35 sustain and 250 ms release.
Every note frequency is printed from the equal-temperament formula, so the tuning can be checked against a reference.
How to use the virtual piano
Click a key, or press A W S E D F T G Y H U J K for C4 to C5. Choose a wave first if you want a different timbre. Every other key is reached with the pointer.
Every note is synthesised in this tab: no sample is loaded, no key press is stored and nothing is sent anywhere.
- Domain: C4–C6, equal temperament at A4 = 440 Hz, four wave types, eight simultaneous voices.
What the page proves
Twenty-five keys from C4 to C6, tuned to A4 = 440 Hz, each note an oscillator and a gain envelope in the tab.
Each key is one OscillatorNode at 440·2^((m−69)/12) hertz, through a GainNode whose attack, decay, sustain and release are linear ramps. Eight voices sound at once; a ninth press stops the oldest. There is no sample library and no MIDI input.
- Browser requirement: Playback needs the Web Audio API (AudioContext and OscillatorNode). No sample, MIDI device or plugin is involved.
- The page states its domain: C4–C6, equal temperament at A4 = 440 Hz, four wave types, eight simultaneous voices.
What it refuses, and what it leaves out
A note outside the drawn C4–C6 range is refused rather than transposed, and the page refuses to accept MIDI input: it has no MIDI API and does not claim one.
- Not the right page for: a piano performance, which needs velocity and pedalling
- Not the right page for: MIDI input, which this page does not accept
- Not the right page for: recording, which it does not do
- Reported as a named state: a ninth simultaneous key stops the oldest voice
- Reported as a named state: audio starts on the first press, never at load
- Reported as a named state: computer keys are ignored while a text field has focus
What to Expect
Best for
- checking a melody by ear
- a quick pitch reference
- demonstrating equal temperament
Not ideal for
- a piano performance, which needs velocity and pedalling
- MIDI input, which this page does not accept
- recording, which it does not do
What this tool keeps
- the note names, frequencies and the wave you chose
What may need cleanup
- nothing: each note stops itself
Common errors
- a ninth simultaneous key stops the oldest voice
- audio starts on the first press, never at load
- computer keys are ignored while a text field has focus
Example use cases
- play a scale from C4
- compare the four wave types on one note
- check a headphone's left and right with low and high keys
Sample input
the A4 key with the triangle wave
Sample output
one note at 440.00 Hz with an 8 ms attack, 120 ms decay, 0.35 sustain and 250 ms release
Who this is for
- musicians checking a pitch
- anyone demonstrating a scale
Frequently asked questions
Is my data sent anywhere?
Every note is synthesised in this tab: no sample is loaded, no key press is stored and nothing is sent anywhere.
Which browser API does this page need?
Playback needs the Web Audio API (AudioContext and OscillatorNode). No sample, MIDI device or plugin is involved.
What can I download?
There is no download: the page is an instrument, and every note is stopped when it ends.
Does it accept MIDI?
No. The page listens to the pointer and to thirteen computer keys, and it has no MIDI API. A MIDI keyboard is not seen.
Why do notes stop when I press many keys?
Eight voices sound at once. A ninth press stops the oldest, which keeps the graph bounded and is stated on the page.
Is this a sampled piano?
No. Every note is an oscillator with a gain envelope, so it is a synthesised tone rather than a recording of a piano.
Build custom tools for your store
Join the SDK program to create useful ecommerce utilities for your store.