A virtual guitar that is calculated, not recorded
This free virtual guitar plays a guitar that is simulated in your browser. There are no recordings and no sample library: every sound is calculated while you play, from a model of a plucked string, a guitar body or an amplifier, and a room. Because it is a model, the sound reacts to how you play. A string picked near the bridge is thin and bright, near the neck it is round and hollow. A soft touch is mellow and a hard one bites. A note can slide, bend or hop to another fret without a new pick, because nothing is switched between samples. It uses the Web Audio API to make the sound and the Web MIDI API to read a MIDI keyboard, so nothing is installed and nothing is uploaded.
How is a plucked string simulated?
When you pluck a string, a wave runs along it, bounces back at the nut or the finger and at the bridge, and keeps going until it has lost its energy. A computer can do the same with a delay line: a short memory in which a wave travels around in a loop. The length of the loop sets the pitch, and a small filter in the loop takes away a little energy on every round, and more of the high frequencies than of the low ones. That is why a real string starts bright and gets softer, and why the high harmonics fade first. The idea goes back to the Karplus-Strong algorithm of 1983 and was worked out into digital waveguide synthesis by Julius O. Smith, David Jaffe and others.
This guitar adds the details that make it sound like a string and not like a buzzer. The loop uses a fractional delay, so the pitch can be any value and can glide smoothly for slides, bends and vibrato. The loop filter is calculated from two decay times, one for the fundamental and one for the high partials, which is how each of the six strings gets its own length of sustain. A pair of all-pass filters makes the high partials a little sharp, as they are on a real string because it is stiff (this is called inharmonicity, and it is stronger on thin plain steel strings than on nylon or wound strings). Every string is also made of two vibration planes with a slightly different pitch, so the note has the slow, gentle beating of a real string. The code runs in an AudioWorklet, so it stays on time while the page is busy.
Picks, fingers and where you pick
The pluck is a short pulse put into the loop. With a hard pick it is sharp and narrow, with a fingertip it is wide and soft; the Pick hardness slider moves between the two, and a few milliseconds of noise give the click of a pick or a nail. The pulse also goes through a comb filter whose delay is the distance between the pick and the bridge, because a string that is plucked at a point cannot move there: harmonics that have a node at that point are not excited. In the strum zone the horizontal position of your finger is the pick position, from near the neck (soft and round) to near the bridge (bright and thin). Electric guitars have a second comb of the same kind, from the place of the pickup.
The body: why it sounds like an acoustic guitar
A string alone makes almost no sound. The bridge passes its vibration to the top plate, and the body radiates it. The body has resonances that colour every note: an air resonance (the sound hole acting like the neck of a bottle) near 100 Hz in a dreadnought, the first top plate mode near 200 Hz, and a long series of weaker plate and back modes up to about 1.5 kHz, with a gentle presence and a steep fall above a few kilohertz. The page puts the string through a body built from damped resonances at these places. There are four bodies: a big dreadnought, a small parlor guitar (everything higher and thinner), a classical guitar (soft and round) and a jumbo (deep, with a long ring).
The electric guitar, the amp and the cabinet
The four electric sounds skip the body. The string signal passes a pickup (with its comb), then an amplifier. The preamp is a waveshaper that rounds off the peaks of the waveform, with a slight asymmetry that adds even harmonics, as a tube stage does. At low gain it only adds sparkle and at high gain it saturates and sustains. After it come the bass, mid and treble controls and a presence control, then a speaker cabinet: an impulse response that is built in code with the low cut, the cone resonance and the steep roll-off of a guitar speaker, in an open-back 2×12, a closed 4×12 or a small 1×12. Chorus and delay come last, followed by the room. The amp is a simple model made for playing, not a measured copy of a famous amplifier.
Slides, bends, vibrato, hammer-ons and pull-offs
These are what make a guitar line sound like a guitar, and all of them are available. A slide is a drag along the string: the pitch follows your finger fret by fret, and the Slide speed setting sets how quickly, from steps to a smooth glide. A bend pushes the string sideways so it gets tighter: drag up on a held string and the pitch rises by up to the bend range you choose (one to four semitones). Vibrato is a quick, small bend up and down; wobble your finger, or use the Vibrato sliders and the mod wheel, which fade in after the note starts, as a player does.
A hammer-on sounds a higher note on the same string by pressing a finger down on a fret while the string rings, without picking again. The string is not plucked, so the new note is quieter and rounder. In this instrument, the highest finger on a string sets its pitch, like the real thing: put a second finger on the same string above the first one and the pitch jumps with a small, soft re-excitation. A pull-off is the opposite: lift the upper finger while a lower finger is down, and the string sounds the lower note, with a little pluck from the finger that leaves. With a MIDI keyboard, turn on Legato and overlap two notes that are a few semitones apart to get the same effect, and release the upper one to pull off, which gives trills.
Strumming and chords
A chord is a shape for the left hand: which fret to press on each string, with some strings left out. The page has the common open chord shapes (C, A, G, E, D and their minors and sevenths), and for all others it moves the E-shape and A-shape barre chords up the neck to the right place. There are 12 roots and 12 chord types, 144 chords in all, from major, minor and sevenths to sus, diminished, augmented, sixths and add9. Choose a key to get its seven chords as buttons, as in a chord chart (I, ii, iii, IV, V, vi and vii°, or i to VII in a minor key). Pressing a chord shows its shape on the fretboard and strums it, if Strum on chord press is on.
The strum zone plays the shape string by string as your finger crosses the strings, so a slow swipe is a slow arpeggio and a fast one a hard strum, and each string is picked at the speed you cross it. A new note on a string stops the old note on that same string, as it does on a real guitar, so a second strum cleans up the first. The capo raises all the open strings and the chord shapes follow it, so you can play the easy shapes in a hard key. Other tunings (drop D, DADGAD, open G, open D, half or whole step down) change the open strings; the chord shapes are fret patterns for standard tuning, so in another tuning the same shape sounds as a different chord.
Which MIDI messages does it use?
Connect a MIDI keyboard, a guitar-to-MIDI pickup or a digital piano by USB, press Connect MIDI and allow the access. Notes, controllers and the pitch bend wheel then work as in the table. The MIDI monitor tab lists every message that arrives, with time, channel and values, which also makes it a handy MIDI tester.
| Message | What it does |
| Note on, velocity | Picks a string on the best fret for that note. Velocity sets how hard the string is picked. Notes that arrive within a few milliseconds of each other are treated as a chord and spread over different strings. |
| Note off | Lets go of the string: it dies away over the “ring after release” time. |
| Overlapping notes | With Legato on, a new note that is 1 to 5 semitones higher than the note that is still held hammers on to the same string. Releasing it pulls off back to the held note. |
| Pitch bend | Bends all sounding notes; the range is 1, 2, 4 or 12 semitones on the MIDI tab. |
| CC1 (mod wheel), channel pressure | Vibrato on held notes. |
| CC64 (sustain pedal) | Keeps notes ringing after you release the keys. |
| CC67 (soft pedal) | Palm mute while pressed. |
| CC7, CC11, CC74 | Volume, expression and tone (brightness). |
| Program change | Selects one of the eight sounds (0 to 7). |
| CC120, CC123 | All sound off, all notes off. |
The range of the guitar in standard tuning is E2 (MIDI note 40) up to D6 (86) with 22 frets. Notes outside that range are ignored, and the page shows a short message. The channel setting lets you listen to one MIDI channel only, which helps with keyboards that send on several channels.
The eight sounds
- Steel-string acoustic: a big dreadnought with a full low end and bright sparkle, in a studio. Made for strumming.
- Parlor guitar: a small body that is thinner, quicker and sweeter, like an old blues guitar.
- Classical nylon: soft, round nylon strings played with the fingertips, in a warm hall.
- Clean electric: single-coil sparkle through a clean combo, glassy, open and dynamic.
- Jazz box: a warm neck pickup with the tone rolled off, in a small clean amp.
- Crunch rhythm: a cranked tube-style amp on the edge of breaking up, for tight, chunky chords.
- Singing lead: a saturated lead tone that sustains, with a repeat and a big room behind it.
- Ambient clean: shimmering clean tone with chorus, long repeats and a huge hall.
Latency, CPU and phones
The delay between a key or a touch and the sound is the sum of your MIDI keyboard, the browser and your audio device. With wired headphones or speakers it is usually short enough to play comfortably; the Engine box at the top of the page shows the browser’s own output latency. Bluetooth headphones add 100 to 300 ms, so use a cable if you play from a keyboard. Six strings with a chord, an amp and a reverb need more calculation than a sample player: up to fourteen strings can sound at once, and a very old phone may crackle on a long strum with the high-gain sounds. On a phone, turn the device to landscape for a wider fretboard; Chrome on Android also supports USB MIDI keyboards with an OTG adapter, while Safari on iPhone and iPad has no Web MIDI.
Privacy
Everything runs on your device. The page does not upload your playing and does not record anything. It stores your settings (sound, sliders, tuning, chord) in this browser only, and your MIDI messages are only used to play sound.
Honest limits
This is a physical model, not a recording of a Martin or a Stratocaster. It sounds like a guitar, with the character of a model: the string, the body and the amp are simplified, so it will not fool a trained ear in a side-by-side test with a real instrument. One string can only sound one note at a time, as on a real guitar, so a lead line and a chord that share a string cut each other off. There are no natural harmonics, no tapping, no whammy bar and no amp feedback. A mouse presses one place at a time, so chords come from the chord buttons and the strum zone, and a touch screen cannot feel the string. It is made to be playable, expressive and free, and to show how a guitar works.
More music tools
Tune your real guitar with the guitar tuner, practise with the chord backing track and the metronome, or play the virtual piano, the virtual drum kit and the virtual violin.