Clever Quest Lab ← Labs

Synthesizer

Play a polyphonic synth, a bass line, a drawbar organ, a plucked string or an FM synth, and watch how each sound is built.

Instrument
Octave C3–C6

Sound is off. Press Start sound or play a key.

Oscilloscope
Spectrum

Computer keys: A S D F G H J K L ; ' are white keys, W E T Y U O P black keys. Z / X shift the octave. Drag across the keys to slide.Tap or slide on the keys. Several fingers play a chord. Use − / + to change the octave.

Presets

Classic styles

Signal path – select a stage

1 Oscillators

Oscillator 1

Oscillator 2

Unison

Noise

2 Low-pass filter

3 Amp envelope (ADSR)

The graph is not to scale: short stages are widened so you can see them. Dots show the notes that are sounding.

~ LFO

4 Effects

5 Output

Output level−∞ dB
Limiter0.0 dB

The limiter turns loud peaks down so chords do not clip.

How to use it

Press Start sound, then play the piano keys with the mouse, your fingers or the computer keyboard. Choose a preset, then move one slider at a time and listen to what changes. Above the keys, the oscilloscope draws the shape of the sound wave over a few thousandths of a second, and the spectrum shows how strong each frequency is, from bass on the left to treble on the right.

The Instrument switch chooses what the keys play. Poly synth is an eight-voice synthesizer: the boxes under its presets are the signal path, and selecting a box takes you to its controls. Bass line is a one-voice bass synth with a 16-step sequencer: press Play, then edit the steps or turn Cutoff and Resonance while it runs. Organ is a drawbar organ that mixes nine sine waves for every key. Plucked string has six strings to pluck or strum. FM synth has four sine operators that modulate one another.

Controls

How it works

An oscillator repeats one wave shape many times per second. The number of repeats per second is the frequency, which we hear as pitch. Each key has a number n (A4, the A above middle C, is 69), and its frequency is

f = 440 × 2(n − 69) / 12 Hz

So A4 is 440 Hz, every key is about 6 % higher than the one before, and twelve keys up doubles the frequency.

Any repeating wave can be built from sine waves at whole-number multiples of its lowest frequency. These are its harmonics, and their strengths give the wave its tone colour. A sine has only the first harmonic. A sawtooth has every harmonic, with harmonic n at 1/n of the amplitude of the first. A square wave has only the odd harmonics, also at 1/n. A triangle has only odd harmonics at 1/n2, so it sounds soft. Noise has no pitch, because it contains all frequencies at once.

Subtractive synthesis starts with such a rich wave and removes part of it. The low-pass filter of the poly synth passes frequencies below the cutoff and weakens those above it by 12 decibels per octave. Resonance boosts a narrow band right at the cutoff, which gives the sound a nasal or whistling edge. High-pass does the opposite and removes the bass; band-pass keeps only a band around its centre frequency.

The ADSR envelope shapes the loudness of each note. Attack is the time to reach full level, decay is the time to fall to the sustain level, sustain is the level held while the key is down, and release is the time to fade out after you let go. Envelope amount lets the same envelope raise the cutoff by up to six octaves, so with the low-pass filter a note starts bright and then turns duller.

Unison plays several copies of each oscillator a few cents apart. Their waves drift in and out of step, so one key sounds like a group of players. The chorus adds two copies delayed by about 15 ms, and a slow sine wave lengthens one delay while it shortens the other, which bends their pitch slightly.

The LFO (low-frequency oscillator) is a slow sine wave that you do not hear directly. It moves the pitch (vibrato), the cutoff (a wah effect) or the volume (tremolo). The echo is a delay line that feeds part of its output back into its input. The reverb adds the sound convolved with a short burst of fading noise, which stands in for the thousands of reflections in a room.

The bass line follows the small bass-line machines of the early 1980s. One sawtooth or square oscillator feeds a steeper filter, 24 decibels per octave, made of two stages in a row. Each new note kicks the cutoff up by Env mod, and it falls back within the Decay time. With high resonance the filter boosts whichever harmonic sits at the cutoff, so the falling cutoff makes the harmonics ring out one after another. That is the squelch. Soft clipping after the filter rounds off the peaks, and Drive pushes harder into it.

An accent makes a step louder with a deeper, faster sweep. A slide ties a step to the next: the pitch glides there in about 60 ms and the envelopes do not restart. Steps are sixteenth notes, so at T beats per minute one step lasts

t = 60 / T / 4 seconds

At 120 beats per minute that is 125 ms.

The organ uses additive synthesis: it adds pure sine waves instead of filtering a rich one. Counted from the pitch of the key (the 8′ drawbar), the nine drawbars sound at 0.5, 1.5, 1, 2, 3, 4, 5, 6 and 8 times its frequency, and each drawbar step is 3 decibels. As on a tonewheel organ, the tones stay between about 32 Hz and 6 kHz: a partial outside that range sounds whole octaves higher or lower instead. The rotary speaker swings loudness, pitch and left-right position 0.8 or 6.7 times a second.

The plucked string uses the Karplus–Strong method. A burst of random noise, one period long, circles a delay line. A round trip of N samples at fs samples per second gives the pitch fs / N. On every trip a gentle low-pass filter removes some of the high frequencies, so the noise smooths into a tone that fades like a real string. The browser's audio nodes cannot form a loop shorter than 128 samples, so the page computes every note in full when it is plucked and plays it from memory.

The FM synth uses frequency modulation. A modulator is an oscillator that moves the frequency of another one, the carrier, up and down at audio speed. This adds partials at the carrier frequency plus and minus whole multiples of the modulator frequency. The modulation index is the frequency swing divided by the modulator frequency: the higher it is, the more partials are strong. The page modulates the frequency directly, with the sample-to-sample change of the modulator, so the carrier's phase shifts by index times modulator. Feedback is not a real loop: the page computes the wave of an operator that modulates itself and plays it.

Things to try

Frequently asked questions

Why is there no sound?

Browsers only let a page play audio after a click, tap or key press, so press Start sound first. Then check the master volume and your device volume. On some phones the silent switch also mutes web pages.

How many notes can I play at once?

Eight in the poly synth, or six, five or four with five, six or seven unison voices. One note more takes over a voice: one that is already fading out if there is one, otherwise the oldest note. The organ takes up to 48 notes, the plucked string 16 and the FM synth 10; the bass line plays one note at a time. Many computer keyboards also cannot register certain combinations of keys pressed together.

Can I share a bass pattern?

Yes. Copy link makes a web address that contains the pattern, the tempo and the bass settings.

What is a cent?

One hundredth of a semitone, which is the step between two neighbouring keys. An octave is 1200 cents.

Why do big chords sound squashed?

The limiter turns the level down for a moment when many voices together would go over the maximum. This prevents harsh digital clipping.

Are my sounds stored or sent anywhere?

Only the current settings, the chosen instrument and the bass pattern are saved, in the local storage of your browser. Nothing is uploaded.

More free games and simulators