< Back to Previous Page  TOC  Next Section > 
Chapter 3: The Frequency DomainSection 3.2: Phasors


In Chapter 1 we talked about the basic atoms of sound—the sine wave, and about the function that describes the sound generated by a vibrating tuning fork. In this chapter we’re talking a lot about the frequency domain. If you remember, our basic units, sine waves, only had two parameters: amplitude and frequency. It turns out that these dull little sine waves are going to give us the fundamental tool for the analysis and description of sound, and especially for the digital manipulation of sound. That’s the frequency domain: a place where lots of little sine waves are our best friends. But before we go too far, it’s important to fully understand what a sine wave is, and it’s also wonderful to know that we can make these simple little curves ridiculously complicated, too. And it’s useful to have another model for generating these functions. That model is called a phasor. Description of a PhasorThink of a bicycle wheel suspended at its hub. We’re going to paint one of the spokes bright red, and at the end of the spoke we’ll put a red arrow. We now put some axes around the wheel—the xaxis going horizontally through the hub, and the yaxis going vertically. We’re interested in the height of the arrowhead relative to the xaxis as the wheel—our phasor—spins around counterclockwise. 

As time goes on, the phasor goes round and round. At each instant, we measure the height of the dot over the xaxis. Let’s consider a small example first. Suppose the wheel is spinning at a rate of one revolution per second. This is its frequency (and remember, this means that the period is 1 second/revolution). This is the same as saying that the phasor spins at a rate of 360 degrees per second, or better yet, 2\2 radians per second (if we’re going to be mathematicians, then we have to measure angles in terms of radians). So 2 radians per second is the angular velocity of the phasor. This means that after 0.25 second the phasor has gone /2 radians (90 degrees), and after 0.5 second it’s gone radians or 180 degrees, and so on. So, we can describe the amount of angle that the phasor has gone around at time t as a function, which we call (t). Now, let’s look at the function given by the height of the arrow as time goes on. The first thing that we need to remember is a little trigonometry. The sine and cosine of an angle are measured using a right triangle. For our right triangle, the sine of , written sin() is given by the equation: This means that: We’ll make use of this in a minute, because in this example a is the height of our triangle. Similarly, the cosine, written cos(), is: This means that: This will come in handy later, too. Now back to our phasor. We’re interested in measuring the height at time t, which we’ll denote as h(t). At time t, the phasor’s arrow is making an angle of (t) with the xaxis. Our basic phasor has a radius of 1, so we get the following relationship: We also get this nice graph of a function, which is our favorite old sine curve. 





Then we get this nice curve, which is another kind of sinusoid (bigger!). Now let’s start messing with the frequency, which is the rate of revolution of the phasor. Let’s ramp it up a notch and instead start spinning at a rate of five revolutions per second. Now: This is easy to see since after 1 second we will have gone five revolutions, which is a total of 10 radians. Let’s suppose that the radius of the phasor is 3. Again, at each moment we measure the height of our arrow (which we call h(t)), and we get: Now we get this sinusoid: In general, if our phasor is moving at a frequency of revolutions per second and has radius A, then plotting the height of the phasor is the same as graphing this sinusoid: Now we’re almost done, but there is one last thing we could vary: we could change the place where we start our phasor spinning. For example, we could start the phasor moving at a rate of five revolutions per second with a radius of 3, but start the phasor at an angle of /4 radians, instead. Now, what kind of function would this be? Well, at time t = 0 we want to be taking the measurement when the phasor is at an angle of /4, but other than that, all is as before. So the function we are graphing is the same as the one above, but with a phase shift of /4. The corresponding sinusoid is:
Our most general sinusoid of amplitude A, frequency , and phase shift has the form: A particularly interesting example is what happens when we take the phase shift equal to 90 degrees, or /2 radians. Let’s make it nice and simple, with equal to one revolution per second and amplitude equal to 1 as well. Then we get our basic sinusoid, but shifted ahead /2. Does this look familiar? This is the graph of the cosine function! You can do some checking on your own and see that this is also the graph that you would get if you plotted the displacement of the arrow from the yaxis. So now we know that a cosine is a phaseshifted sine! Adding PhasorsFourier’s theorem tells us that any periodic function can be expressed as a sum (possibly with an infinite number of terms!) of sinusoids. (We’ll discuss Fourier’s theorem more in depth later.) Remember, a periodic function is any function that looks like the infinite repetition of some fixed pattern. The length of that basic pattern is called the period of the function. We’ve seen a lot of examples of these in Chapter 1. In particular, if the function has period T, then this sum looks like: If T is the period of our periodic function, then we now know that its frequency is 1/T—this is also called the fundamental (frequency) of the periodic function, and we see that all other frequencies that occur (called the partials) are simply integer multiples of the fundamental. If you read other books on acoustics and DSP, you will find that partials are sometimes called overtones (from an old German word, "übertonen") and harmonics. There’s often confusion about whether the first overtone is the second partial, and so on. So, to be specific, and also to be more in keeping with modern terminology, we’re always going to call the first partial the one with the frequency of the fundamental. Example: Suppose we have a triangle wave that repeats once every 1/100 second. Then the corresponding fundamental frequency is 100 Hz (it repeats 100 times per second). Triangle waves only contain partials at odd multiples of the fundamental. (The even multiples have no energy—in fact, this is generally true of wave shapes that have the "odd" symmetry, like the triangle wave.) Click on Applet 3.2 and see a triangle wave built by adding one partial after another. 





How should we define an arithmetic of arrows? It sounds funny, but in fact it’s a pretty natural generalization of what we already know about adding regular old numbers. When we add a negative number, we go backward, and when we add a positive number, we go forward. Our regular old numbers can be thought of as arrows on a number line. Adding any two numbers, then, simply means taking the two corresponding arrows and placing them one after the other, tip to tail. The sum is then the arrow from the origin pointing to the place where "adding" the two arrows landed you. Really, what we are doing here is thinking of numbers as vectors. They have a magnitude (length) and a direction (in this case, positive or negative, or better yet 0 radians or radians). Now, to add phasors, we need to enlarge our worldview and allow our arrows to get not just 2 directions, but instead a whole 2 radians worth of directions! In other words, we allow our arrows to point anywhere in the plane. We add, then, just as before: place the arrows tip to tail, and draw an arrow from the origin to the final destination. So, to recap: to add phasors, at each instant as our phasors are spinning around, we add the two arrows. In this way, we get a new arrow spinning around (the sum) at some frequency—a new phasor. Now it’s easy to see that the sum of two phasors of the same frequency yields a new phasor of the same frequency. We can also see that the sum of a cosine and sine of the same frequency is simply a phaseshifted sine of the same frequency with a new amplitude given by the square root of the sum of squares of the two original phasors. That’s the Pythagorean theorem! Sampling and Fourier ExpansionThe decomposition of a complex waveform into its component phasors (which is pretty much the same as saying the decomposition of an acoustic waveform into its component partials) is called Fourier expansion. In practice, the main thing that happens is that analog waveforms are sampled, creating a timedomain representation inside the computer. These samples are then converted (using what is called a fast Fourier transform, or FFT) into what are called Fourier coefficients. Figure 3.17 shows a common way to show timbral information, especially the way that harmonics add up to produce a waveform. However, it can be slightly confusing. By running an FFT on a small timeslice of the sound, the FFT algorithm gives us the energy in various frequency bins. (A bin is a discrete slice, or band, of the frequency spectrum. Bins are explained more fully in Section 3.4.) The xaxis (bottom axis) shows the bin numbers, and the yaxis shows the strength (energy) of each partial. The slightly strange thing to keep in mind about these bins is that they are not based on the frequency of the sound itself, but on the sampling rate. In other words, the bins evenly divide the sampling frequency (linearly, not exponentially, which can be a problem, as we’ll explain later). Also, this plot shows just a short fraction of time of the sound: to make it timevariant, we need a waterfall 3D plot, which shows frequency and amplitude information over a span of time. Although theoretically we could use the FFT data shown in Figure 3.17 in its raw form to make a lovely, synthetic gamelan sound, the complexity and idiosyncracies of the FFT itself make this a bit difficult (unless we simply use the data from the original, but that’s cheating). Figure 3.18 shows a better graphical representation of sound in the frequency domain. Time is running from front to back, height is energy, and the xaxis is frequency. This picture also takes the essentially linear FFT and shows us an exponential image of it, so that most of the "action" happens in the lower 2k, which is correct. (Remember that the FFT divides the frequency spectrum into linear, equal divisions, which is not really how we perceive sound—it’s often better to graph this exponentially so that there’s not as much wasted space "up top.") The waterfall plot in Figure 3.18 is stereo, and each channel of sound has its own slightly different timbre. Here’s a fact that will help a great deal: if the highest frequency is B times the fundamental, then you only need 2B + 1 samples to determine the Fourier coefficients. (It’s easy to see that you should need at least 2B, since you are trying to get 2B pieces of information (B amplitudes and B^{2} phase shifts).) 
< Back to Previous Page  Next Section > 
©Burk/Polansky/Repetto/Roberts/Rockmore. All rights reserved.