Virtual Piano

Play piano, synth, organ, and more directly in your browser. Use your mouse or computer keyboard to play notes, switch between 6 instrument sounds, and record your melodies for playback or export.

Virtual Piano

C3A
D3S
E3D
F3F
G3G
A3H
B3J
C4K
D4L
E4;
F4'
G4
A4
B4
C#3W
D#3E
F#3T
G#3Y
A#3U
C#4O
D#4P
F#4]
G#4
A#4

Recording:

Keyboard Shortcuts

White Keys (Lower Octave):

A=C3   S=D3   D=E3   F=F3   G=G3   H=A3   J=B3

White Keys (Upper Octave):

K=C4   L=D4   ;=E4   '=F4

Black Keys (Lower):

W=C#3   E=D#3   T=F#3   Y=G#3   U=A#3

Black Keys (Upper):

O=C#4   P=D#4   ]=F#4

6 Instrument Sounds

Each instrument uses Web Audio API synthesis with unique oscillator types and envelope shaping for distinct tonal character.

  • Piano uses triangle waves with harmonic overtones for a warm, natural tone
  • Synth uses sawtooth waves for a bright, cutting lead sound
  • Organ uses sine waves with harmonics for a smooth, sustained tone
  • Electric uses square waves for a punchy, retro keyboard feel
  • Strings uses sawtooth waves with slow attack for a bowed, orchestral quality
  • Bass uses triangle waves tuned for deep, resonant low-end tones

Recording and Playback

Capture your ideas as you play and listen back instantly. The recorder tracks every note with precise timing.

  • Click Record then play notes using your mouse or keyboard
  • Click Stop when finished to save your sequence
  • Use Play to hear your recording with the current instrument sound
  • Export saves your sequence as a JSON file with note names, frequencies, timing, and duration
  • Switch instruments before playback to hear your melody with a different sound

The Complete Guide to Playing Piano Online and Using Virtual Keyboards

Playing piano has never been more accessible. Whether you are a complete beginner curious about making music, a songwriter sketching out a melody, a music student practicing intervals, or a producer laying down a quick chord progression, a virtual piano in your browser puts a playable instrument at your fingertips without any downloads, plugins, or physical hardware. Our free Virtual Piano tool gives you a fully playable two-octave keyboard with six distinct instrument sounds, computer keyboard mapping, and a built-in recorder so you can capture your ideas the moment they arrive.

What Is a Virtual Piano?

A virtual piano is a software-based instrument that replicates the experience of playing a real piano or keyboard. Instead of pressing physical keys connected to hammers and strings, you interact with a visual keyboard on your screen using your mouse, trackpad, touchscreen, or computer keyboard. The sound is generated in real time using digital audio synthesis, which means every note you hear is created by your computer's audio processing engine rather than a pre-recorded sample library.

Our Virtual Piano uses the Web Audio API, which is built into every modern browser. This technology allows us to create oscillators that generate waveforms at precise frequencies, shape those waveforms with gain envelopes for realistic attack, decay, sustain, and release (ADSR), and layer harmonic overtones on top of the fundamental frequency for richer, more natural tones. The result is a responsive instrument that feels immediate and sounds musical, all running entirely in your browser with zero latency from server round-trips.

How Sound Synthesis Works in This Tool

Each of the six instrument sounds in our Virtual Piano is built from a different combination of oscillator types and envelope parameters. Understanding how these work will help you appreciate why each sound feels different and when to use each one.

An oscillator generates a repeating waveform at a specific frequency. The four basic waveform types are sine (smooth and pure), triangle (warm and mellow), sawtooth (bright and buzzy), and square (hollow and punchy). Each waveform has a distinct harmonic content that determines its tonal character. Our Piano sound uses triangle waves because they produce a warm tone similar to a real piano's fundamental. The Synth sound uses sawtooth waves because they contain all harmonics and cut through a mix effectively. The Organ sound uses sine waves because they are pure and smooth, mimicking the tone wheels of a classic organ.

The ADSR envelope controls how the volume of each note changes over time. Attack is how quickly the note reaches full volume after you press a key. Decay is how quickly it drops from peak to the sustain level. Sustain is the steady volume while you hold the key. Release is how quickly the sound fades after you let go. Piano has a quick attack and moderate release, giving that characteristic percussive strike followed by a gentle fade. Strings have a slow attack that builds gradually, creating that swelling bowed effect. Organ has almost instant attack and very short release, so the sound starts and stops crisply with each keypress.

Using Computer Keyboard Mapping

One of the most powerful features of our Virtual Piano is the ability to play notes using your computer keyboard. The mapping follows the standard layout used by most virtual instruments: the home row (A through J) plays the white keys of the lower octave (C3 through B3), while the row above (W, E, T, Y, U) plays the corresponding black keys. The right side of the keyboard (K, L, semicolon, apostrophe) extends into the upper octave, with O, P, and bracket for the upper black keys.

This layout lets you play with both hands, just like a real piano. Your left hand covers the lower octave while your right hand reaches the upper octave. With practice, you can play simple melodies, chords, and even two-handed patterns using nothing but your laptop keyboard. The key labels on each piano key show you exactly which computer key corresponds to which note, and you can toggle these labels on and off as you become more comfortable with the layout.

Recording Your Melodies

The built-in recorder captures every note you play along with precise timing and duration information. This means when you play back your recording, it reproduces your performance exactly as you played it, including the gaps between notes and how long you held each one. You can switch to a different instrument sound before playing back your recording to hear your melody rendered with a completely different tonal character.

The Export feature saves your recording as a JSON file that contains the instrument type, note names, frequencies, start times, and durations for every note in your sequence. This data can be used as a reference for transcription, imported into other tools, or stored as a record of your musical ideas. Many songwriters find that capturing a quick melody the moment it appears in their mind is more valuable than any amount of careful composition later.

Virtual Piano for Beginners

If you have never played a keyboard instrument before, a virtual piano is one of the best places to start. There is no cost, no setup, and no commitment. You can explore the relationship between notes, hear how intervals sound, and start building muscle memory for basic patterns without leaving your browser.

Start by pressing single notes and listening to how they sound. Notice that the white keys form a scale (C, D, E, F, G, A, B) while the black keys add the sharps and flats in between. Try playing three notes together to form a chord: press C, E, and G simultaneously for a C major chord. Then try C, E-flat (the black key between D and E), and G for a C minor chord. Hearing the emotional difference between major and minor chords is one of the most fundamental lessons in music theory, and a virtual piano makes it instantly accessible.

Once you are comfortable with individual notes and basic chords, try playing simple melodies. Start with songs you already know by ear and find the notes on the keyboard one at a time. Mary Had a Little Lamb (E, D, C, D, E, E, E) is a classic starting point because it uses only three adjacent white keys. As your confidence grows, explore more complex melodies and experiment with playing chords in your left hand while your right hand plays the melody.

Virtual Piano for Songwriters and Producers

For songwriters, a virtual piano serves as a rapid idea-capture tool. When a melody or chord progression comes to mind, you can play it out immediately without powering up a DAW or finding a physical keyboard. The recording feature lets you save the idea with a single click, preserving the timing and feel of your original performance. Many hit songs started as quick voice memos or keyboard sketches, and having a playable instrument always available in your browser removes the friction between inspiration and capture.

Producers can use the different instrument sounds to test how a melody or bass line works across different timbres. A chord progression that sounds standard on piano might feel completely different when played with the synth or strings sound. Switching between instruments during the writing process can reveal new creative directions and help you make arrangement decisions before you even open your DAW.

Understanding Musical Notes and Frequencies

Every note on the piano corresponds to a specific frequency measured in Hertz (Hz). A4, the note used for tuning, vibrates at 440 Hz. Each octave doubles the frequency, so A3 is 220 Hz and A5 is 880 Hz. The twelve notes within an octave are spaced using equal temperament tuning, which means each semitone is exactly the twelfth root of two (approximately 1.0595) times the frequency of the note below it.

Our Virtual Piano covers two octaves from C3 (130.81 Hz) to B4 (493.88 Hz). This range includes middle C (C4, 261.63 Hz), which is the central reference point on a standard 88-key piano. This two-octave range is ideal for playing melodies, simple chord voicings, and bass lines. It covers the most commonly used range for vocal melodies and provides enough space to explore harmonic relationships between notes.

The Science Behind Different Instrument Sounds

What makes a piano sound like a piano and a synth sound like a synth? The answer lies in the harmonic content and the amplitude envelope. A real piano string vibrates not just at its fundamental frequency but also at integer multiples of that frequency called harmonics or overtones. The second harmonic is twice the fundamental, the third is three times, and so on. The relative loudness of each harmonic determines the tonal quality, or timbre, of the sound.

Our Piano and Organ sounds include additional oscillators tuned to the second and third harmonics to create a richer, more complex tone. The Synth and Electric sounds use single oscillators with waveforms that naturally contain many harmonics (sawtooth and square waves, respectively). The Strings sound combines a slow attack envelope with harmonic layering to simulate the gradual onset of a bowed string instrument. The Bass sound uses a triangle wave without additional harmonics for a clean, focused low-frequency tone.

Benefits of Practicing on a Virtual Piano

While a virtual piano cannot fully replace a weighted keyboard for serious piano study, it offers several unique advantages. Portability is the most obvious benefit: you can practice anywhere you have a laptop or tablet with a browser. There is no need to carry equipment, find a practice room, or disturb others with loud playing. Simply open the tool and start playing.

Ear training is another area where a virtual piano excels. You can quickly play intervals, chords, and scales to test your ability to identify them by sound. Play a note, sing what you think the next interval will be, then check by pressing the key. This kind of immediate feedback loop is invaluable for developing relative pitch. Music teachers often recommend that students supplement their physical practice with digital tools for ear training exercises.

Composition and arrangement benefit from the instant availability of multiple sounds. Hearing your melody on piano and then immediately switching to strings or synth helps you evaluate how the music will work across different instrumentation. This is especially useful when writing for ensembles, bands, or productions that involve multiple instrument parts.

Using the Virtual Piano With Other Tools

Our Virtual Piano works well alongside the other tools on this site. Use the BPM Tap Tool to establish your tempo, then record a melody at that speed. Use the Chord Wheel to find chords in your key, then play them on the piano to hear how they sound. Use the Transposition Tool to move your chord progression to a different key, then try the new chords on the keyboard. The Rhyme Finder can help you match lyrics to the melodies you create. Together, these tools form a complete browser-based songwriting workspace.

Frequently Asked Questions

Is the Virtual Piano completely free?
Yes. The Virtual Piano is free to use with no account, subscription, or download required. It runs entirely in your browser using the Web Audio API, which is a standard feature of all modern browsers. There are no usage limits or hidden costs.

Can I play chords on the virtual keyboard?
Yes. You can press multiple keys simultaneously on your computer keyboard or click multiple piano keys to play chords. The audio engine handles polyphony, so all notes will sound together clearly. Try pressing A, D, and G on your keyboard at the same time to hear a C major chord.

Why is there a slight delay when I first press a key?
The very first note you play may have a tiny delay because the browser needs to initialize the audio context. Modern browsers require a user interaction (like a click or keypress) before they allow audio playback. After the first note, all subsequent notes should play instantly with no perceptible latency.

Can I use this tool on mobile devices?
Yes. The piano keys respond to touch events, so you can tap them on a phone or tablet. For the best experience on mobile, rotate your device to landscape orientation to give the keyboard more horizontal space. Computer keyboard shortcuts are only available on devices with physical keyboards.

What format are the exported recordings?
Recordings are exported as JSON files containing the instrument name and an array of note events. Each event includes the note name (like C4 or F#3), the frequency in Hertz, the start time in milliseconds relative to the recording start, and the duration in milliseconds. This format is easy to read, parse, and use in other applications.

Can I change the sound after recording?
Yes. When you play back a recording, it uses whichever instrument sound is currently selected. So you can record a melody using the Piano sound, then switch to Synth and play it back to hear the same notes with a completely different timbre. This is a great way to experiment with arrangement ideas.

How many octaves does the keyboard cover?
The keyboard covers two octaves, from C3 (130.81 Hz) to B4 (493.88 Hz). This includes middle C (C4) and provides enough range for most melodies, simple chord voicings, and bass lines. The range was chosen to balance playability with screen space, especially on smaller displays.

From the Blog

View All