b2KIT

Virtual Piano Keyboard

Play a virtual piano in your browser using keyboard shortcuts or mouse clicks with Web Audio synthesis.

Tested tool guide Tested browser tools Checked August 16, 2026

What Virtual Piano Keyboard does, with a checked example

This tool renders a piano keyboard in the page and plays it two ways: click a key with the mouse, or press computer keys, each bound to a note. Sound is synthesized live with the Web Audio API, so there are no audio files to load and no instrument needed. The surprise most users hit: the computer-keyboard mapping is laid out by QWERTY position, not by pitch. Black keys sit a row above the white keys instead of between them, and the note that plays for a given key follows the on-screen legend, not musical intuition. A first click is also required before the browser will make any sound.

Worked example

A concrete input and expected output from the current implementation.

Input

Click the on-screen key for A4, the tuning A above middle C, and hold it.

Expected output

A 440 Hz tone that sustains while the key is held and stops the moment it is released.

Note frequencies follow equal temperament: f = 440 x 2^((n - 69)/12) Hz, where n is the MIDI note number. A4 is MIDI note 69, so its frequency is 440 x 2^0 = 440 Hz, the international concert pitch (A4 = 440 Hz), and each octave up doubles the frequency.

How the result is produced

1

Keyboard and click mapping

Each on-screen key is bound to one pitch, and a block of computer keys is bound to the same pitches so you can play without the mouse. The conventional layout runs a chromatic sequence along two letter rows: white keys on one row, black keys on the row above, repeating per octave. The tool shows the assignment as a legend, usually overlaid on the on-screen piano, so check it before trusting muscle memory.

2

Web Audio synthesis

The tool creates an AudioContext and, for each pressed note, starts an oscillator at that note's frequency with a short attack and release envelope so the tone does not click. Multiple oscillators run at once, so chords and octaves sound together, and nothing is downloaded. Browsers start the context suspended, and the first user gesture on the page resumes it, which is why the first click is required.

Good uses

  • Practice a melody or scale silently with headphones when no instrument or MIDI keyboard is at hand, using the computer keys for the notes.
  • Work out a tune by ear: hunt for the notes on the on-screen piano, then replay the sequence to check the melody.
  • Audition chord voicings and progressions before committing them in a DAW or sheet music, since holding several keys at once plays the whole chord.

Limits and checks

  • The timbre is synthesized, not a recorded piano: a plain oscillator sounds organ-like rather than like sampled piano strings, so expect an electronic tone, not a grand piano.
  • There is no touch sensitivity. Pressing harder does not play louder, every note sounds at the same level, and crescendos, accents, and quiet passages are impossible.
  • Notes stop the instant you release the key. There is no sustain pedal, so a chord stays sounding only while every key in it is held down.

Common questions

Why is there no sound when I press keys?

Browsers suspend audio until the page receives a user gesture, so click anywhere once and try again. If it is still silent, check that the tab is not muted and the browser volume is up, verify your speakers or headphones actually work, and confirm the keys you press are inside the mapped range, since unmapped keys do nothing.

Can I record what I play?

The tool plays notes live but is designed for playback, not capture, so treat it as an instrument rather than a recorder. To keep a melody, write down the notes as you find them or record the tab's audio with your operating system's screen or sound capture. Exporting MIDI is not part of what it does.

References and verification

The example and behavioral notes were checked against the browser implementation. Standards and primary references below define the relevant format, formula, or platform behavior.

Related Tools