And that is where we left off. So what are these complex waves and what kind of sine waves are they made up of? Who thought up all this stuff and how can I calculate these musical waves? Yeah, right, you want to know how to calculate these musical waves. What would be the formula for “Day in the Life,” and which term is John and which is Paul? Well, we will use some math so you are convinced that this stuff really works. There are some more things named after dead white people and reference to calculators and graph paper. But amongst all the obfuscation, will be some pearls of wisdom and some steps along our journey. There’s a bit of a jungle we have to hack through, so let’s get moving. Grab your machete and prepare for thick math vines ahead. Just hope we don’t encounter any head hunters.
There are a lot of interesting waveforms floating around in the air and the airwaves. These are called “complex waves” by mathematicians and physicists. There are square waves familiar to computer designers and sawtooth waves familiar to oscilloscope designers and triangle waves well known to trianglers (that is people that fish with three poles) ... alright, I made that last one up, but there really are triangle waves.
And if these waves seem complex, well, you ain’t seen nothin’ yet. Here is a sample of the wave from a selection of music.
What all these different examples of waveforms have in common is that they are all made up of a combination of sine waves. The sine wave is the only wave not made up of a combination of other waves. That is why it is called “fundamental.”
Before we dig into these complex waves, there is one additional measurement I want to describe. Remember when I talked about "frequency" which was measured in “cycles per second?” Well this new measurement is just another way to measure frequency. You flip the fraction over and measure “seconds per cycle.” When you flip a fraction upside down by interchanging the numerator and the denominator, this is called the reciprocal and the reciprocal of the frequency is called the “period” of the wave and it is also called the wavelength. The idea of wavelength comes from a view of the wave propagating or moving through a medium such as in the air for sound waves and music. Wavelength depends on period and the speed of sound. It is important when you are designing speaker cabinets.
The waves you’ve seen in the pictures are either plots of a wave from the mathematical formulas or viewing of actual waves on an instrument called an oscilloscope. These “pictures” of actual waves clearly show the repeating structure of the waves and it is easy to pick a point on the wave and note the distance (which is actually a measure of time) before that point is repeated. We usually start with the point where the wave is at zero. Since the wave is represented as an alternating voltage, it goes from zero to some positive value, back to zero, then to some negative value, and back to the starting point at zero.
This is very much like the swing that starts out swinging down and out, reaches the bottom of the arc and then climbs up the opposite side until it stops. It then reverses direction falling back to the bottom and then back up to the point where it started. If you want to be accurate, the zero point is the bottom of the arc. After the swing gives up all its energy to friction and wind resistance, it will end up at the bottom -- and that’s zero.
If you examine carefully all the waves in the two pictures above, you can see there is a fundamental wavelength or period. It is very obvious that there is this main or underlying period or frequency. That is the fundamental frequency. For example, on a piano, A above middle C has a fundamental frequency of 440 Hz.
Now comes the marvelous part. You can show that all complex waveforms are a combination of that fundamental frequency and other sine waves that are a multiple of that fundamental frequency. That is, frequencies twice the fundamental and three times the fundamental and four times ... These multiple frequencies are called “harmonics” or “overtones.”
From a musical perspective, we’re talking about a single note on the musical scale. If there are multiple notes, like in a chord, then there are some very interesting phenomenon called “beats.” But let’s keep it simple and just talk about one note like when you pluck a single string on a guitar or violin. For example, A above middle C is made up of 440 Hz, plus 880 Hz, plus 1760 Hz plus ... you get the idea.
This breaking down of a complex wave into its component parts, the fundamental sine wave and the harmonic sine waves is done mathematically using something called Fourier Analysis.
In mathematics, Fourier analysis is a subject area which grew from the study of Fourier series. The subject began with the study of the way general functions may be represented by sums of simpler trigonometric functions. Fourier analysis is named after Joseph Fourier (1768-1830), who showed that representing a function by a trigonometric series greatly simplifies the study of heat propagation.
I fondly recall when I first learned of Fourier’s work. I was in EE103, taught by Dr. Melvin Capehart (1935 - ). I had learned about these concepts in Navy electronics school, but technicians just get it described to them, and they don’t get the underlying mathematics because it requires Calculus. So this was when I was first introduced to the magic of the Fourier series and Fourier analysis (as well as Taylor Series used by the Taylor guitar ;-) ... just a little math/musician humor). Later, in more advanced electronics engineering courses, the topic came up several times. It is powerful and fundamental stuff and I really dig it. If you would like to dig some too, here is an excellent online course by Dr. Osgood at Stanford. Give it a try. You might like it. It's free.
If that is a little too intense for you, don’t worry, we only need a little bit of these ideas to arrive at our intended destination. Now back to some serious math. Recall, I stated in the first installment of this journey, if you are going to compare two different sine waves, you need to also worry about “phase.”
If you’ve ever been to the automobile drag races, you may have seen one car given a head start. That’s a form of handicapping. If two cars from different racing classes compete, the car from the lower performance class gets a head start. Usually the faster car catches up and wins anyway. But, with these waveforms, they all go the same speed: the speed of sound (or speed of propagation down a wire). So if one wave gets a head start, it keeps that advanced position. Here is a picture of two waves that are the same frequency, but different phases.
If the two waves are different frequencies, but are harmonics (that is frequencies that are multiples), then they will have a repetitive phase relationship. That is, they will cycle through combinations and return to the same point. That point is in sync with the fundamental or lowest frequency wave.
A bunch of gobble-d-gook that just says that phase relationships of harmonic waves are constant.
We have to make our math a little more complex to deal with phase. One way to do that is to introduce the cosine function. It is identical to the sine function except it is 90º out of phase. So now our formula becomes y = A cos(x) + B sin(x). Using different values for A and B, including negative values, you can get any phase relation from -180º to 0º to +180º, and that is all there is. (There are many other useful forms or equations to model or describe phase, but this is a simple one.)
I’m going to start with a very simple complex wave. It is called the square wave and it is common in computer circuits. It is also very similar to the output of a fuzz box connected to a guitar, and I’ll get back to that idea in a future installment.
Here is a picture of a square wave:
And the formula:
(Remember, I said in the first installment that the sin(2x) is twice the frequency of the "sin(x).")
Some observations. 1) A square wave is made up of a combination of a fundamental sine wave plus the odd numbered harmonics of that fundamental frequency. 2) The amplitude of each harmonic is reduced by one over the harmonic number and is, therefore, decreasing with harmonic number. 3) There are an infinite number of terms represented by the infinite number of odd integers. 4) Number 3 is not significant from an engineering point of view due to number 2. In engineering, we call that “close enough for government work!” In other words, you only need the first few terms to get a result that is accurate enough.
How many terms are needed depends on situations, but we usually specify five to ten terms to get a very accurate answer, and where the human ear is involved, the value added by the seventh harmonic is probably not even noticeable. But exactly how many harmonics are required in order to faithfully reproduce the sound to the human ear and mind is a matter of some controversy -- that's EXACTLY how many are required. No-one thinks you need more than ten harmonics, and most people believe it takes less than ten -- even with the best speakers and amplifiers made.
/joke.Two super heroes are chained to the wall at the end of a long hall. A beautiful women is standing at the far end of the hall. The villain's voice comes from a loudspeaker over their heads and explains that the beautiful girl will walk half the distance from where she is toward the two heroes. Then she will walk half the remaining distance. And this will continue. The first hero, a mathematician very familiar with infinitesimals, says, "Oh no, she'll never get to us." The second hero, an engineer, responds, "But she'll get close enough!"/ejoke.
The formulas for other complex waves often include the “A cos(x)+B sin(x)” form I mentioned earlier to indicate phase. The square wave is pretty simple since all the component waves are in phase. That's why I chose it as an example.
It is possible, using Fourier analysis, to write the formula for any complex wave, but no-one is writing the formula for the sound of a Cello playing “B-flat above middle C.” I suppose it could be done, but that is not the point. Further, even digital representations of music don’t do the analysis, they just represent the waveform with a bunch of numbers similar to how digital cameras capture color images as a bunch of numbers describing discrete points called “pixels.” When we get to digitization of sound waves, we won't care about Fourier and his stuff. We'll just take snapshots of the instantaneous signal value and assign that a numerical value. However, Fourier and his stuff will be invaluable as we analyze whether that snapshot captures all the essence of the music.
What is important is the fact that we have to capture, at least, some of the harmonic overtones to capture full fidelity. The human voice only goes to about 3,000 Hz, but you had better capture higher frequencies, or else Ella Fitzgerald is not going to sound natural and true, and she won't get any r.e.s.p.e.c.t. That's the point of learning all this Fourier stuff, to understand what frequencies are there and what frequencies you have to capture and reproduce to make a good quality, high fidelity recording -- whether analog or digital.
That's why we went so deep into the math jungle. We need some tools to help us later understand the "high" in "high fidelity," (although there are some other highs in music which Fourier doesn't address). Fourier will provide those tools to determine whether the digital music representation is as good as the original and how it could be improved, if not. We're slowly getting to that conclusion, but it'll take a few more episodes.
Also note that, Fourier may require an infinite range of frequencies, but we may not need them all. We will have to talk about some other engineering and human physiology to fully understand what is needed.
Anyway, for now, we know that all complex waves, including music, are made up of combinations of sine waves, and that the lowest frequency called the “fundamental” is the primary wavelength (or frequency) we see in the oscilloscope or a plot of the wave. Further, we know all the other sine waves are multiples of this fundamental frequency. Finally we know some waves may require an infinite series of sine waves with higher and higher frequencies, but these highest frequencies contribute less and less to the total wave, and so they can be ignored -- or can they?
Aha, the plot thickens. Since music is for the enjoyment of people, not dogs (sorry Dr.), we are really only interested in frequencies within the range of human hearing. Or are we? What about “transient response?” Oh, this plot is really getting thick. So, like any good serial, I’ll leave you at this point until next time. Tune in tomorrow to see how our hero escapes from certain death. For now ... roll credits.
Originally written on Feb. 16, 2012 during a visit to my Dad's home in Hillsboro, Oregon and posted on Facebook. During my two week visit with my dad, I wrote an article a day. I started with a long series on the Science of Photography which had thirteen individual articles. I then started this series on the Science of Music. It isn't finished and I have a lot more to say. I hope to add to this series in the future.