Play the note A on a flute, a clarinet and a violin, all at the same pitch and the same loudness, and you still never mistake one for another. Pitch says how high. Loudness says how strong. The thing left over, the character of the sound, is called timbre. It looks like a mystery, but a big part of it is a recipe you can mix with your fingers.
A pure tone is a sine wave: one smooth, repeating wiggle, like a tuning fork. A real instrument almost never makes one. When a string or an air column vibrates, it vibrates in many patterns at once. The slowest pattern sets the pitch we hear and is called the fundamental. The others vibrate at exactly 2, 3, 4 and more times that frequency. These are the harmonics.
A note with a fundamental of 220 Hz also contains 440 Hz, 660 Hz, 880 Hz and so on. Your ear hears one note, not many, because the harmonics fit together so neatly. What changes from instrument to instrument is how loud each harmonic is.
Below, twelve bars stand for the first twelve harmonics. Drag across them to raise or lower each one. The top picture shows the wave you get when all of them are added together; the faint lines are the individual harmonics. Press Play to hear it at 220 Hz (the A below middle C), and keep dragging while it sounds.
Harmonic 1 is the fundamental.
Try the presets. The pure sine is just the fundamental: smooth and a little bland, a bit like a tuning fork or a very soft flute note. Switch to odd only and the wave turns into a flat-topped square. It sounds hollow and reedy, because only harmonics 1, 3, 5, 7 and so on are present, each one weaker in proportion to its number (one third, one fifth, one seventh). The all harmonics preset keeps every harmonic at a strength of one over its number. The wave becomes a sawtooth, a ramp that drops sharply, and the sound turns bright and buzzy.
Those are exact results from the maths of waves, first worked out by Joseph Fourier in the early 1800s: any steady repeating wave can be built from sine waves. In the 1860s Hermann von Helmholtz used the idea to argue that the ear splits a sound into these pure parts, and that the strengths of the parts largely decide timbre.
A clarinet is close to a cylindrical tube that is closed at the reed end and open at the bell. Such a tube mostly reinforces the odd harmonics, so the odd-only preset sounds a little like it. It also explains a quirk of the instrument: when a player opens the register key, the clarinet jumps up a twelfth (an octave plus a fifth, the third harmonic) rather than an octave, as a flute or recorder does. Real clarinets are not perfect cylinders and the balance shifts across the range, so the match is a rough one, not a perfect one.
Harmonic strengths are not the full story. The start of a note, its attack, lasts only a few hundredths of a second and carries a lot of the identity: a bow catching a string sounds different from a breath starting an air column. Vibrato, tiny noises such as breath or bow scrape, and the way the recipe changes as a note swells all matter. Studies of listeners have found that if you cut off the attack of a recorded instrument, people find it harder to tell which instrument they are hearing. Our recipe above is a frozen slice, which is why even the best preset sounds more like a synthesiser than a clarinet.
Still, the idea holds in nearly every musical setting. An organ builder adds ranks of pipes at different harmonics to shape a stop. A synthesiser adds or filters harmonics to make a patch. A singer changes the shape of the mouth and throat, which boosts some harmonics and dims others, to turn an "oo" into an "ee" on the same pitch.
Set a pure sine playing, then slowly pull the fifth harmonic up and watch five small ripples appear along each cycle. Next switch on the even harmonics (2, 4, 6) as well as the fundamental. The pitch seems to stay at 220 Hz, but the sound now has a different edge. Same pitch, same loudness, a different character: that is timbre, and it is just a bar chart.