The answers to the question 'How do harmonics work?' were most interesting.
OK, that's the HOW it happens. But WHY does it happen ? What is the physics here ? Why doesn't a guitar string vibrate at one frequency only?
The answers to the question 'How do harmonics work?' were most interesting.
OK, that's the HOW it happens. But WHY does it happen ? What is the physics here ? Why doesn't a guitar string vibrate at one frequency only?
It's a simple question with quite an involved answer.
First a quick primer on wavelength, frequency and pitch.
Frequency is how many times a vibration repeats in a period of time. Wavelength is the length of a single vibration, which for something like a guitar string, corresponds to the length of time it takes to repeat. You can see that if the wavelength halves, the frequency doubles.
Conveniently, the wavelength of the sound from a vibrating string is proportional to the length of the string, so we can talk about the two almost interchangeably.
Doubling the frequency (halving the wavelength) takes us up an octave.
When you hit/pluck/shake anything, it will vibrate at all kinds of frequency. Most of those frequencies will die away very quickly. Here's why.
These are conceptual pictures of a string vibrating. Think of one end as the nut of a guitar, and the other as the bridge. The bottom one is "not a resonant frequency", because the line doesn't end at the bridge. I could perhaps have drawn the last part of the wave with a steeper curve, so it reached the dot, and that would have shown what happens to waves of that frequency -- rather than work with the length of the string to reinforce itself, it works against the length of the string, gets cancelled out, and dies away.
Now look at the other waves. They sustain because they "fit" into the length of the string. They would carry on vibrating that way forever, if it weren't for the sound board, the friction of the air, and so forth, perhaps the magnetic field of a pickup, taking energy away.
I've shown the 1st, 2nd, 3rd and 4th -- but they keep going on, at various levels of loudness.
The complex waveform of a guitar note is the result of adding all those resonant frequencies together.
Here are some waveforms:
Here is a frequency analysis of single guitar note - horizontal axis is frequency, vertical axis is amplitude. Each spike is a different harmonic.
It's the precise mixture of frequencies, and how quickly each one dies away, that provides the timbre of the instrument.
A good way to get a feel for this is to play with an analogue synth (or a simulation of one). These use "additive synthesis", in which an oscillator produces a pure sin wave, and you build up a timbre by adding in "harmonics" using more oscillators, choosing the relative pitch and volume for each one.
You may have noticed that your guitar sounds "boomier" if you pluck it near the 12th fret, and more trebly when you pluck it near the bridge. That's because when you pluck near the middle of the string, you're giving lots of energy to the 1st harmonic, and very little to the other harmonics.
Now, what happens if you gently touch the midpoint of the string?
The result is that you subtract the fundamental note, and a lot of "odd" harmonics, leaving a harmonic that's an octave up, and some of the higher harmonics. The result is a sound with fewer harmonics that therefore sounds "purer".
A great way to get a feel for this is to play the open string, then listen carefully as you gently touch the midpoint, to see how you achieve the octave by subtracting part of the sound.
See also this other post
WHY do harmonics happen?
Well, they don't happen – not necessarily.
Strings can do all kinds of stuff:
All these are possible ways a snapshot of a moving string could look like. Not only that, it could also move at each point with an arbitrary velocity. The velocity could be everywhere 0 (for an infinitesimally short moment). In the first shown state, if the velocity we also zero then this would mean the string is simply in “silent mode”, i.e. no vibration at all. The second state is an overtone-free one (the lowest eigenstate of the string; if this snapshot is with zero velocity it means the string is at the upper turnaround position, i.e. it moved upwards until now and will then start moving down).
The 4th state is a confused bunch of harmonics. By this I mean, you could take a little bit of the ground state from picture 2, something of the second harmonic (an S-like shape), a little of the 3rd and so on, add them all up and get exactly picture 4. What would that sound like? Well, just the sum of all those frequencies as overtones, like in typical string vibration as we're use to hear. Except that picture 4 is not a typical string state: I wouldn't expect to ever find a real string in that state.
In contrary to state 3: that's exactly what a guitar string looks like when you've plucked it and it's just about to slip off the nail/pick. And what happens then? Well, it moves on as if there never was a pick, i.e. as if it was in the middle of its normal movement and we simply took a snapshot which happened to look like picture 3. But picture 3 is clearly not an eigenstate: just like picture 4, the only way a string could look like this is by vibrating in multiple modes at the same time. And that's why a guitar doesn't produce sine oscillations, but proper tones with harmonics.
Actually, the opposite question is more relevant
It comes down to where the nodes, or zeros are (have a look at @MatthewRead's answer over here) as with the ends of the string fixed, any wave which has an element of movement at those points will not propagate (the end point just won't move)
So what that does is limit the possible frequencies to those which have a wavelength which fits into the string a whole number of times.
From a purely theoretical point of view it has to do with two things: Excitation and non-linearity.
As suggested by leftaroundabout's diagrams, WHERE you pluck on a string, eg, will affect to a large degree whether it vibrates primarily at the "fundamental" or some harmonic. This is excitation. So someone playing a stringed instrument can get a purer, more "fundamental" sound by plucking near the middle of the string, and a "richer", more "harmonic" sound by plucking closer to the end of the string.
Non-linearity, on the other hand, has to do with the fact that, eg, the string of a stringed instrument is not perfectly flexible, must deal with the resistance of air, and a number of other factors. This means that even if somehow initially excited to precisely the fundamental frequency, the fact that, eg, the strings are stiff at the ends will cause the ends to "lag" slightly the motion of the rest of the string, so rather than vibrating in a smooth arc the string will take on a slight S shape. If you analyze the S shape mathematically and plot its frequency spectrum, there will be a strong spike at the fundamental frequency, but (due to the S shape) weaker spikes at the overtones. In addition, the "sharp" peak at the fundamental (and the overtones) will "spread" slightly due to air resistance, etc.
It's all these subtle variations that give a musical instrument its tone. A pure fundamental tone sounds "electronic" and very artificial. (But of course, too many overtones and too much "spread" results in a muddy sound.)
So far I've seen nobody addressing the "why" question of harmonics to any useful degree: everybody is either intent on explaining how a string (as a nice example of an oscillator with overtones) can support multiple harmonics, or handwaving around the issue.
The answer is "boundary conditions". An oscillator can support multiple modes, so the question is what combination of modes will actually correspond to a certain one-time or continuous or semicontinuous excitement: the excitement places the boundary conditions. If we pluck a non-sounding string, it is formed into two straight line segments (assuming that the plucking is slow in comparison with the vibration) and then let go.
So we need to find a superposition of overtones and modes that will result in exactly the shape of the string and the forces and impulse in every part of it at the time we let go and leave it to its own devices: this will determine the various ratios of modes, and they will usually decay with different time constants, too. With strings, you can give some partials an unfair advantage by touching the string in places they would not move: then other partials die out much faster, the result being a "flageolet" or pure harmonic sound.
Also plucking a string at various points will have different overtones in the result. Some like to pluck it very close to the bridge so that it's basically the pick noise travelling back and forth the string that makes up the initial sound, rather overtone-rich until the higher partials die off.
I'll assume that you wonder about the harmonic components of a sound, not the guitar harmonics played by just touching the string (which was the real question behind "How do harmonics work?", I believe).
Any periodical signal can be represented as a sum of sine waves. These sine waves are shown in a spectrum: the spikes in the spectrum graph by slim represent the amplitudes of sine waves, which frequencies are given by the x-axis of the spikes.
Sum up these sine waves and you will get your original signal back. If you have only one component (one spike) in a spectrum, the signal is just a sine with that frequency and amplitude.
With that in mind, your question may be rephrased:
"Why doesn't a guitar string vibrate at one frequency only?" -> "Why doesn't a guitar string vibrate as a sine wave?"
You could say that a guitar string vibrates at one frequency (in a non-sine waveform). But its waveform may be decomposed into a sum of sine waves of different frequencies.
Now why doesn't a guitar string vibrate as a sine? As mentioned by others, this is controlled by the constraints applied to the string. The contact with the pluck, where the string is struck, the stiffness of the string, the connections to the guitar body, the body itself, the room, your fingers...
It all has to do with overtones. In a nutshell, sound is a compression wave. (It's usually drawn as a standing wave for simplicity.) Every pitch is at a set frequency, so the high point in the wave occurs every so often.
An overtone, which is what a harmonic is, happens when you have two sound waves whose high points overlap at certain intervals. For instance, an octave above any given note is twice that note's frequency, so the high points of the upper note will overlap the high points in the lower note every other time. Similar effects occur for most overtones.
A guitar string really does only vibrate at a single frequency, which is determined by its length and its tension. The overtones line up with other frequencies, which causes any appropriately tuned strings nearby to resonate with the string if they match one of the harmonics.
This is a gross oversimplification of course. This youtube video is the best explanation of the whole process I've seen in a while.
Why doesn't a guitar string vibrate at one frequency only?
An ideal one carefully plucked at its middle would, but real-world guitar strings are not idealized strings. They are not massless, they have thickness, they're often twisted bundles of metal, inconstant tension, gauge, etc. And, probably most importantly, they're plucked somewhere close to one end of the string, which is against the natural motion an ideal string would like to take. Thus, more than one mode (frequency) of the string will be vibrating; these are the harmonics.
This diagram shows what the real motion of a plucked string (black) looks like:
The colors are the different modes (overtones or harmonics) of the string's vibration. Any of these colored "strings" is a natural motion the black string would like to take. Since the red "string" has the largest amplitude, its frequency is the most prominent heard coming from the vibrating string. All these colors, when superimposed, create the non-"pure" vibration of a plucked sting. You can see the shape of the black string isn't symmetric, is "bent," unlike the colored "strings."
Plucking at the middle of the string is one way to minimize the harmonics. If you do this, you'll hear a more pure sound. This is because it's not as against the natural motion of a string as plucking near an end of the string.
Why doesn't a guitar string vibrate at one frequency only?
Harmonics in general are produced by systems which have a non-linear response, like a string.
One way to understand harmonics is to look at mathematical operations, like Fourier transforms, or other transforms. These operations convert (transform) an integral equation of some quantity, typically amplitude vs. time, into a sum of another quantity, typically amplitude vs. frequency, where harmonic frequencies show up as major terms of the sum.
Another way is to look at how non-linearity create harmonics. This is what I'll elaborate on here. Non-linearity is not something unknown for musicians, as soon as an amplifier or a microphone is non-linear, it creates harmonic distortion, which is just parasitic harmonic frequencies added to the amplified copy of the audio input. Harmonic distortion in music is also called... instrument timbre. So many different words for one physical effect!
Linearity of the restoring force: Spring
As an example of linearity, imagine a spring. If one elongates the spring they sense a restoring force, the larger the elongation and the larger the force, maybe to the point the spring cannot be extended further. In general a helical spring develops a restoring force exactly proportional to the elongation:
Such system is said linear as regards to its response to a perturbation. For more information on the linearity of springs, and some applications, a good read is the Wikipedia article on Hooke's law.
Linearity of the restoring force: Diapason
The diapason is an interesting instrument because it oscillates mostly without harmonic. Prongs oscillation occurs in the linear domain of metal elasticity, where the restoring force is proportional to the current distance from the rest position.
This (quasi-) linear elasticity exists for metallic material but only for small displacements, which means small energy transmitted to air and limited sound intensity. If we tried to create higher sounds, we would leave the linear domain and harmonics would appear.
We'll be back to the diapason later. Let's first see a truly non-linear system: The guitar string!
Guitar: Large oscillation, mostly non linear
An oscillating system like a vibrating string has also a rest position. When moved away from this position it develops a force, in the form of a tension, tending to restore the rest state, the larger the transverse distance from the rest position, the larger the longitudinal tension.
However the guitar string doesn't work in the small linear elasticity range of the diapason, it needs to produce powerful sounds, the string is "excited" with large inputs, to which the material is not able to respond in a linear way. The tension is not proportional to the transverse distance at a given point of the string:
(Right hand graph from Henrik B Pedersen and Jeppe Langeland Knudsen, adapted)
(Note: The figure above has been updated after @user1079505 comment on wrong value for amplitude x. Wrong/original figure is here.)
The amplitude of the restoring force tends to increase in greater proportion as we approach the elasticity limit and come a bit closer to the permanent deformation/breaking point. Other factors play a role, including the response is not time independent, the response also depends on previous perturbation of the string.
The result is the restoring force is not a scaled copy of the current string distance from its rest position and, adding complexity, at a given time, the scaling factor is not the same for all segments of the string.
This non-linearity between displacement amplitude and restoring tension is the origin of the harmonics. The actual mechanism is complex, but we'll see a simple case by looking again at the diapason, which after all is not totally linear...
Back to the diapason with its small non-linearity
Saying a diapason has no harmonics was an approximation. The diapason usually develops the second harmonic, and the detail of how this happens is a good example of the extreme sensibility of physical oscillating devices to asymmetry and non-linearity which is seen in action with strings.
Basically the prongs of a tuning fork oscillate in their common plane like cantilever beams, and the center of mass, seen from the top is kept motionless due to the symmetry of the displacements. However this is not the case for its vertical position.
When the prongs oscillate, their individual center of mass moves up and down by a small distance, following a circular arc. It also occurs at 440 Hz (or whatever frequency the fork is tuned for). This displacement of the mass induces a reaction in the vertical direction, the stem goes up and down by a very small amount.
The diapason is usually held against another support, e.g. a table. When doing so, prongs vibrations are transmitted to the support acting as an amplifier.
It appears the stem is more efficient to transmit vertical vibrations, and the table surface is more easily bent vertically than moved horizontally. Due to this selective amplification by the table, the very small vertical vibration has now more relative importance.
The frequency of the transverse wave and the center of mass wave being the same, this could still goes without consequences, however what is problematic is their waveform is different, one is a distorted sinusoid. And guess the reason for this distortion... Here we are: Non-linearity!
This graph is part of a study that is good to read. It shows the two oscillations (scales are not of the same order). While the transverse wave is almost sinusoidal, the vertical wave due to the mass displacement has peaks and lows of different shapes. The cause is the vertical oscillation alternates tension and compression forces in the stem, to which metal responds in a different way, with different velocities. We are left with two waves which naturally interfere, creating the 880 Hz harmonic:
This is a simple example of harmonics created by a small non-linearity, the principle is the same for other materials and vibrating devices, including guitar strings, though more elements are involved.
Linearity: A more precise definition
Technically we say it's an homomorphism, from homos- same and -morphe shape. That's big words, in practical here is a linear transformation:
BC and B'C' are linear transformations of each other. The definition of a linear system is:
If input x produces output u, then for any number k, k.x must produce k.u. This means the output must be proportional to the input. If the input is increased by a factor k, then the output is increased by the same factor.
If input x produces u, and input y produces v, then input k1.x + k2.y must produces k1.u + k2.v (k1 and k2 being any multipliers). It means the output produced by the sum is the same to the sum of the outputs from individual inputs.
That's all. Any system which has not the two properties above produces distortion / harmonics. It can happens for amplifiers, for vibrating devices, for cosmic waves, or the electrical grid. Harmonics are usually unwanted, but they can be difficult to remove.
You asked "Why doesn't a guitar string vibrate at one frequency only?". Let's look at it from the other perspective: Every kind of musical instrument makes sounds that have overtones in them, and every pitch played on every kind of instrument has multiple frequencies in it--not just on the guitar. There is no repeating, oscillating sound made by any musical instrument that has absolutely no overtones. The only sound that can exist that has no overtones would be a completely pure sine wave. You could only create a pure sine wave with an electronic oscillator. No acoustic or electro-acoustic musical instrument can create a sound that is similar to a pure sine wave.
It would vibrate only at the fundamental frequency if you excited it exactly at the middle and there were no losses in the material.
However, if you excite it randomly, it will go to an "equilibrium" status in which only standing waves multiple of fundamental frequency survive.
That is, in an ideal scenario you could generate only the desired harmonics if you excite an ideal string in the correct points.
Building on everyone's answers so far I'll provide a concrete example that you can play with: https://www.desmos.com/calculator/ii4bptqcb0 . In all of the examples you'll want to let the t variable change by pressing the play button next to the variable.
To understand this start with the basic version and understand that k is changing the phase of the 2nd harmonic.
After that you can see that in the original example v1 ... vk is the phase corresponding to each harmonic, so they can be tweaked.
Notice that when you load the experiment that the line is simulating the moment before the player releases the string like in leftaroundabout's diagram:
And after it is realeased it looks more like the final wave in the above diagram.
Also note that setting all of the parameters to 0 also gives a good approximation of a pluck: https://www.desmos.com/calculator/p8rpxes5tw
And then let the t variable "play". Notice how close this motion is to the motion we observe in this video:
I hope these examples help you get a concrete understanding of the other solutions.