{"inline_daily":{"virtual-piano":{"octave_down":"One octave down","octave_up":"One octave up","range":"From {{low}} ({{lowHz}} Hz) to {{high}} ({{highHz}} Hz)","sustain":"Sustain pedal","stop":"Stop all","keyboard_label":"Piano keyboard","key_label":"{{note}}, {{hz}} Hz","last_note":"Last note: {{note}}, {{hz}} Hz","hint_play":"Press a key to play: sound starts with your first gesture.","show_keys":"Show computer keys","keys_layout_real":"Letters from your own keyboard, read by the browser. Keys are matched by position.","keys_layout_qwerty":"QWERTY letters shown: keys are matched by position, so other layouts use the same physical keys.","volume":"Volume","a4_label":"Reference A","a4_hint":"440 Hz by default (indicative value, not verified), adjustable from 400 to 480 Hz; applies to the next notes.","midi_connect":"Connect a MIDI keyboard","midi_on":"Web MIDI on. Inputs found: {{n}}.","midi_unsupported":"This browser has no Web MIDI, which is the case of Safari on Mac and iPhone. Try Chrome, Edge or Firefox.","midi_denied":"MIDI access denied or unavailable. Allow it in the site settings, then try again.","midi_hint":"The browser asks for your permission. Notes and the sustain pedal (controller 64) of the MIDI keyboard are used.","synth_note":"Sound synthesized in the browser (six partials that fade out), not a sampled piano: the tone is simplified.","note":{"c":"C","cs":"C♯","d":"D","ds":"D♯","e":"E","f":"F","fs":"F♯","g":"G","gs":"G♯","a":"A","as":"A♯","b":"B"}}},"docs_daily":{"tools":{"virtual-piano":{"content":{"title":"Virtual piano: note frequencies, computer keyboard and MIDI","intro":"Each semitone multiplies the frequency by the twelfth root of 2, about 1.0595: from an A at 440 Hz, the C 9 semitones below is 440 × 2^(−9/12) ≈ 261.63 Hz. The sound is synthesized in the browser, with no piano recording.","details":"

Tuning and frequencies

The tool uses equal temperament: f = A × 2n/12, where n is the number of semitones between the note and the reference A, 440 Hz by default (indicative value, not verified) and adjustable from 400 to 480 Hz. Example: the C 9 semitones below the A is 440 × 2−9/12 = 261.63 Hz and the C an octave higher is 523.25 Hz; with the A at 442 Hz, that same C becomes 262.81 Hz. Each key announces its frequency, which avoids any ambiguity about octave numbering.

Synthesized sound

Each note adds six sine partials, from the fundamental to the sixth harmonic, slightly sharper than exact multiples, as on a real string. Upper partials fade faster than the fundamental, and low notes last longer than high ones: the decay time constant is 2.5 s for the C at 261.63 Hz and at most 6 s in the bass. This is not a sampled piano, so the tone stays simplified. Every note stops on its own at the end of its decay; the sustain pedal holds released notes until it is lifted.

Computer keyboard and MIDI

Keys are matched by physical position (KeyboardEvent.code): the Z, S, X, D… row plays the left octave and the Q, 2, W, 3… row the next one, whatever the layout; on a French AZERTY keyboard, the key marked W plays the note of Z. Browsers that can read the layout show your real letters, others show QWERTY letters. A MIDI keyboard connects through Web MIDI, available in Chrome, Edge and Firefox but not in Safari, on Mac or iPhone; the sustain pedal (controller 64, down from value 64) is supported.

Sources and dates: W3C, UI Events KeyboardEvent code Values (22/04/2025); MDN browser-compat-data, MIDIAccess; MDN, Web MIDI API; MIDI Association, Control Change messages (checked 29/10/2026)

"},"faqs":[{"question":"How do I play the piano with my computer keyboard?","answer":"The bottom row (Z, S, X, D, C, V…) plays the left octave and the top row (Q, 2, W, 3, E…) the next one; the keys in between give the black keys. Keys are matched by position, so on a French AZERTY keyboard the note of Z is played with the key marked W and the note of Q with the key marked A."},{"question":"Can I connect a MIDI keyboard to the virtual piano?","answer":"Yes, in Chrome, Edge or Firefox: click \"Connect a MIDI keyboard\" and accept the browser's permission request. Safari offers no Web MIDI, on Mac or iPhone. The keyboard's sustain pedal (controller 64) is supported."},{"question":"What is the frequency of the C below A 440 Hz?","answer":"The C 9 semitones below the 440 Hz A is 440 × 2^(−9/12) ≈ 261.63 Hz, and the C one octave higher is 523.25 Hz. With the A set to 442 Hz, that same C becomes 262.81 Hz."},{"question":"Why doesn't it sound exactly like a real piano?","answer":"The browser computes the sound from six pure tones that fade out; no piano recording is loaded. It is light and instant, but the hammer noise and the soundboard resonance are not reproduced."}]}}}}