A virtual violin that is calculated, not recorded
This free virtual violin plays a violin 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 bowed string, a violin body and a room. Because it is a model, the sound reacts to how you play the way a real violin does. A slow bow makes a soft, breathy tone, a fast bow a loud one, a bow near the bridge sounds brighter, and a note can slide smoothly into the next one, since 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 bowed string simulated?
A violin string is a long, thin string that is tuned by its tension. When you pluck it, it rings and fades. A bow does something different: it keeps feeding energy into the string. Rosin makes the hair of the bow grip the string, so the bow drags the string sideways until the tension of the string pulls it free. The string then slips back, and the bow catches it again. This stick and slip repeats hundreds of times per second. It does not make a messy noise, because the string settles into a very regular movement that Hermann von Helmholtz described in the 19th century: a sharp corner runs back and forth along the string, and the string sticks to the bow for most of each period and slips back for a short moment. The result is a sound with a lot of harmonics, which is why a violin is so rich.
The model has the same parts as the real thing. Two delay lines hold the two parts of the string, on each side of the bow. At the bridge and at the finger (or the nut for an open string) the waves are reflected, with small losses that make the high harmonics fade faster, and the place where the bow touches the string has a friction curve with a static and a dynamic friction of the rosin. This method is called digital waveguide synthesis and is based on the work of McIntyre, Schumacher and Woodhouse on bowed strings and of Julius O. Smith on waveguides. The code runs in an AudioWorklet, so it stays on time while the page is busy.
Bow speed, pressure and position
A violinist controls three things with the bow: its speed, the force on the string and the distance to the bridge. They are not independent. Schelleng showed in 1973 that for a given speed and bow position there is a window of bow forces that gives a clean tone: with too little force the string does not get gripped and the sound is thin and whistling, with too much the tone becomes raucous. Closer to the bridge the window moves up (you need more force) and gets narrower, which is why a loud, bright sound near the bridge is harder to play.
In this violin, Dynamics is the bow speed, Bow pressure chooses a force inside the playable window, and Bow position moves the bow between the fingerboard (soft, hollow) and the bridge (bright, intense). The page keeps the force inside the playable window, so a stray movement of the mouse does not make the tone collapse. Pressing harder gives a fuller and edgier sound, lighter pressure a thinner and airier one. Fast notes start with a quick, strong bow and slow notes with a gentle one: the start of the note depends on the velocity or on how fast you move the bow.
The body: why it sounds like a violin
A string alone makes almost no sound. The bridge passes its vibration to the top plate and the body, and the body radiates it as sound. The body has its own resonances, and they shape the voice of the instrument. A violin has an air resonance (the “A0” mode, the air moving in and out of the f-holes) at roughly 270 to 290 Hz, a group of strong plate and body resonances between about 400 and 600 Hz, a dense series of weaker resonances higher up, and a broad boost between about 2 and 3 kHz that violin makers call the bridge hill, which gives the sound its brilliance and its carrying power.
The page filters the string through a body that is built from damped resonances at these places. There are five variants (solo, bright, old, chamber and fiddle) with slightly shifted modes and a different bridge hill. The sound then goes through a reverb that is also calculated in code, from a small room to a cathedral, plus a few open strings that ring along softly (the sympathetic strings), just as the open strings of a real violin resonate when you play a note that is related to them.
Vibrato, legato and glissando
Three techniques make a violin sound alive, and all three are available here. Vibrato is a small, slow wobble of the pitch from rocking the finger on the string: players usually do it about five to seven times a second. In this violin it starts a little after the note begins and grows, as players do it, so short notes stay straight and long notes bloom. Depth and speed are sliders, and a MIDI mod wheel controls the depth live. A tiny random variation keeps it from sounding mechanical.
Legato means joining notes without a new bow: the bow keeps moving while the finger changes the pitch. On a MIDI keyboard, play the next note before you let go of the first one, and the two are slurred on the same string. With the mouse, slide your finger. A glissando is a continuous slide between pitches; the string simply gets shorter or longer. The Slide speed setting says how fast the pitch follows your finger, and the Magnet setting (with a scale and a key) snaps to the notes of a scale as you slide, so you can play melodies without tuning every note by ear.
How do I play it?
With mouse or touch, press on a string. The far left is the open string, and each step to the right is one semitone higher, up to two octaves on every string. The strings are laid out like a real fingerboard, so the same finger position on a different string plays a note a fifth higher or lower. With Auto bow, you set how loud and how hard you play with the area under the strings and the sliders, and the bow runs continuously while a note is held. With Manual bow, tap the fingerboard to put a finger on a note (it stays there until you move it), then stroke left and right on that string in the bow area: the speed of your hand is the speed of the bow, the height inside the lane is the pressure, and a stroke that stops makes the sound stop. On a touch screen you can set a finger with one hand and bow with the other.
With the computer keyboard, two rows of piano keys play notes from middle C, and every key finds a good string and position for its note.
Which MIDI messages does it use?
Connect a MIDI keyboard, wind controller or 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 is also a handy MIDI tester.
| Message | What it does |
| Note on, velocity | Starts a note on the best string. Velocity sets the bow speed and how quickly the note speaks. Notes that arrive within a few milliseconds of each other are treated as a chord and spread over different strings where possible. |
| Note off | Lifts the bow: the string stops after a short release. |
| Overlapping notes | With Legato on, a new note that starts while the previous one is still held slurs on the same string without a new bow. Releasing the new note returns to the held one, which gives trills. |
| CC1 (mod wheel), channel pressure | Adds vibrato; the depth follows the wheel or the pressure of your fingers. |
| CC11 (expression) | Changes the bow speed while the note sounds: swells and fades. |
| CC7 (volume) | Master volume of the violin. |
| CC64 (sustain pedal) | Keeps the bow going after you release the keys. |
| CC74 (brightness) | Moves the bow from over the fingerboard (dark) to the bridge (bright). |
| Pitch bend | Bends the sounding notes; the range is 1, 2, 4 or 12 semitones on the MIDI tab. |
| CC120, CC123 | All sound off, all notes off. |
The range of the violin is G3 (MIDI note 55) up to C7 (96). 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 seven violins
- Solo violin: warm and full, with the bow at a natural distance from the bridge, in a concert hall.
- Bright concert: a bright, carrying sound, with the bow near the bridge and a strong bridge hill.
- Old Italian: dark, woody and sweet, with long low resonances and a gentle chapel.
- Chamber music: clear and balanced in a small room, good for quiet, close playing.
- Close and intimate: as if the microphone were near the player, with more bow and rosin noise and hardly any room.
- Folk fiddle: a nasal, edgy tone, little vibrato and a lot of bow.
- Cathedral: the old violin in a huge stone space with a very long tail.
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. A bowed string needs more calculation than a sample player: up to ten notes can sound at once, and a very old phone may crackle with many notes. On a phone, turn the device to landscape and use the touch bow area; 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 (violin, sliders, scale) 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 Stradivari. It sounds like a violin, with the character of a model: bow, string and body are simplified, so it will not fool a trained ear in a side-by-side test with a great player. It has no pizzicato, no harmonics, no spiccato bouncing bow and no real double stops by one bow (chords are played as notes on separate strings). It is made to be playable, expressive and free, and to show how a violin works.
More music tools
Try the virtual piano with MIDI keyboard support, tune a real violin with the instrument tuner, keep time with the metronome, or play the virtual drum kit with e-drums or MIDI pads.