For several different reasons, sinusoids pop up ubiquitously in both theoretical and practical situations having to do with sound. For one thing, sinusoids occur naturally in a variety of ways, and if one happens to couple physically with the air and is of audible frequency and amplitude, we'll hear it. Second, sinusoids behave in simple and predictable ways when the elementary operations (amplification. mixing, delay; section 1.5) are applied to them. Third, one can add up sinusoids to make arbitrary signals or digital recordings (with some provisos having to do with convergence); this ability is extraordinarily useful for analyzing and synthesizing sounds.
Here is a picture that might help visualize the mathematics of sinusoids. Imagine a point on the rim of a spinning bicycle wheel:
The progress in space of the point has horizontal () and vertical ()
components. If we forget the vertical component and graph just the horizontal
component over time we get a sinusoid. If the point is initially at an
angle from the
axis, we get the familiar formula:
Now for the three elementary operations. First, amplification, say by a linear
gain , replaces above with
Applying a delay to a sinusoid equal to (or, if a recording, a time shift
forward or backward by a positive or negative number equivalent to a time
) has the effect of replacing with in the formula:
The effect of mixing two sinusoids (the third elementary operation) is more complicated. We'll start by supposing the two have equal frequencies (but not necessarily the same amplitudes or initial phases). Here is a picture:
The parallelogram represents the initial situation at time zero; the entire
thing rotates about the origin as indicated by the arrows, without changing
size or shape. If the initial phases of the two are and , the
angle between them is either plus or minus
and, by the law
of cosines, we get
The resulting initial phase depends in a complicated way on all of , , , and --the easiest way to compute it would be to convert everything to rectangular coordinates and back, but we will put that off for another day.
If the two frequencies are not equal--call them and --we can still apply the same reasoning, at least qualitatively. At time we still get a parallelogram, but now the two summands are rotating about the origin at different rates, so that the difference between the two phases, initially , is itself increasing or decreasing by a rate equal to the difference of the two component frequencies, that is, . As a result, exactly times every unit of time, the parallelogram runs through its entire range of shapes and the resultant amplitude runs back and forth between its minimum and maximum possible values, and .
If and differ by less than about 30 Hz., you can hear these changes in amplitude. This effect is called beating. At greater frequency separations you are likely to hear two separate tones, unless indeed they act as we'll describe in the next section:
So far we have tacitly assumed that our ears can actually hear sinusoids as separate sounds, and that, presented with two or more sinusoids, we would be likely to perceive them as separate sounds. The truth is somewhat stranger: under the right conditions, our ears appear to have evolved to be able to distinguish periodic signals from each other, even if several of them with different periodicities are mixed together. (This is a good adaptation because it allows us to perceive the voices of other humans, which are approximately periodic most of the time, but rarely if ever sinusoidal.)
A signal is called
periodic when, for some nonzero time duration , we have
If a function repeats after time units, it also repeats after , , ..., time units.. The smallest value of at which the signal repeats is called the signal's period.
A sinusoid whose frequency is has period . But an infinitude of other sinusoids repeat after time units. A sinusoid of frequency has period , and so repeats twice in a time interval lasting . In general a sinusoid whose frequency is any integer multiple of repeats (perhaps for the th time) after an elapsed time of . More generally, any signal obtained by amplifying and mixing sinusoids of frequencies that are all multiples of will repeat after units of time, and therefore have a period of (if not some smaller submultiple of ).
Under reasonable conditions ( at least about 30; sinusoids at lower
multiples of having enough relative amplitude compared to the whole; no
signal frequency other than having an amplitude greater than the sum of all
the others; at least some energy in odd-numbered multiples of ; etc.) we
would hear such a mixture as a single tone whose pitch corresponds to , which
is then called the
fundamental frequency of the mixture. The mixture will have the general
Such a sum of harmonically sinusoids is known as a Fourier series, and although we won't prove it here, it's known that any ``reasonable" periodic signal, (having a certain continuity property in time that any real signal should have) can be expressed as a Fourier series. Its digital recording can as well. This means that, in principle at least, you can synthesize any periodic signal if you can synthesize sinusoids.
The whole mixture is sometimes called a complex periodic tone, and the individual sinusoids that make it up are called harmonics. If all goes well, the perceived pitch of a complex periodic tone is that of its first harmonic, corresponding to the frequency , which you can compute as in section 1.3.
It sometimes happens that a mixture of sinusoids that aren't collectively
periodic somehow are perceived by the ear as a single entity (a tone) anyhow.
Such a mixture could be written as:
Suppose two sinusoids have the same amplitude and frequency , but
different initial phases, and . Our formula for the
amplitude of the sum (from section 2.1)
So not only is the amplitude increased (or decreased) by twice the cosine of half the phase difference; we also see that the initial phase of the resulting sinusoid (which would have been complicated to calculate in general) is the average of the two initial phases and .
As long as the amplitudes of the two sinusoids are the same, we can use the
same picture to find the result of adding (mixing) two sinusoids of different
frequencies and . To reduce clutter we'll leave out the initial phases
to get the following formula:
Although the nominal (peak) amplitude of a sinusoid is a perfectly good measure of its overall strength, most signals in real life aren't sinusoids, and their peak amplitudes don't necessarily give a realistic measure of their strength. Also, you could wish to have a measure of strength that was additive, in the sense that, at least in good conditions, when you add two signals their measured strengths are added as well. The nearest thing we have to such a measure is the average power, which we will first motivate from physical considerations, then define, then show that it (at least sometimes) works the way we would wish.
The simplest way to motivate the definition of power is by considering a
real-world analog, electrical signal. The amplitude (a function of time) is in
this instance the time-varying voltage, customarily given the variable name
. We now suppose the signal is connected to a load of some sort, which has
an electrical resistance , measured in ohms. Power is voltage times
current. To find the current we apply Ohm's law to get:
Although we aren't ready to discuss real sounds in the air yet (we will be able to put that off until chapter 5 or perhaps even 6), the same reasoning will apply. The amplitude is the (space-dependent) pressure. One can measure the power flowing through a specified area as follows: the pressure exerts a force on the area; as a result some air flows through the area, and the force times the velocity gives energy per second, which is the physical definition of power. The speed at which the air flows is proportional to the pressure (it's pressure divided by impedance)--a concept that generalizes resistance to describe ``reluctance to move" in whatever medium we're talking about.) Power is then amplitude squared divided by impedance.
For digital recordings, we don't have a notion of physical impedance and so we
just arbitrarily set it to one, giving
So far we've only described instantaneous power, which is a time-varying function. The measure we're interested in is a signal's or recording's average power, which is simply the average, over some suitable period of time or range of samples, of the instantaneous power.
What is the average power of a sinusoid? Well, its square is
What happens when we add two sinusoids? Well, case one, they have the same
frequency, and their amplitudes are and . Let denote the amplitude
of the resulting sinusoid (which will also have the same frequency). As we
saw above, the three are related by the law of cosines:
Once again, we can deal with sinusoids of differing frequencies and by just letting the phase difference precess in time at a frequency . In this case the cosine term really does average out to zero no matter what the initial phases were. The power of the sum of the two sinusoids is the sum of the powers of the two summands.
In fact, the cosine term can be considered as the two sinusoids beating. If we want to measure the power accurately we must wait at least a few beats--the closer the two sinusoids are in frequency, the longer it will take our measurement to converge on the correct answer.
To calculate the average power of uniform white noise of amplitude we have
to do a quick integral; we get
It might seem that it is almost always true that adding two signals, with average power and , respectively, gives a signal of average power ; but beware the following counterexample: if you add a signal to itself you will double all its values and so the average power will be multiplied by 4, not 2. If you add a signal to its additive inverse (which has the same power as the original), the power of the sum will be zero. Also, if two sinusoids have the same frequency the average power of their sum will depend on the phase difference. There is a term for the situation in which you can simply add the average power of two signals to get the average power of the sum: such signals are said to be uncorrelated.
In general, scaling a signal (that is, multiplying all its values) by a factor of scales the average power by a factor , whereas accumulating unrelated signals should be expected only to multiply the power by on average.
In the previous chapter, we developed the notion of decibels for comparing the
amplitudes of sinusoids. At that point we had no precise way to describe the
amplitudes of signals in general, but now we do: by
measuring their average power. If two signals have average power and
, their level difference in decibels is:
1. Two sinusoids with the the same frequency (440 Hz., say), and with peak amplitudes 2 and 3 are added (or mixed, in other words). What are the minimum and maximum possible peak amplitude of the resulting sinusoid?
2. Two sinusoids with different frequencies, whose average powers are 3 and 4 respectively, are added. What is the average power of the resulting signal?
3. Two sinusoids, of period 4 and 6 milliseconds, respectively, are added. What is the period of the resulting waveform?
4. Two sinusoids are added (once again)... One has a frequency of 1 kHz . The resulting signal ``beats" 5 times per second. What are the possible frequencies of the other sinusoid?
5. A signal - any signal - is amplified, multiplying it by three. By how many decibels is the level raised?
6. What is the pitch, in octaves, of the second harmonic of a complex harmonic tone, relative to the first harmonic?
Project: comb filtering. In this project you will use the phase-dependent effect of combining two sinusoids to build the simplest type of digital filter, called a comb filter.
To start with, make a single sinusoid of frequency 100 Hz (using the sinusoid object in the course library for Pd). You can check the level of its output using the ``meter" object; it should be about 97 dB.
Now put the sinusoid into a ``vdelay" (variable delay) object, and connect the delay output as well as the original sinusoid output to the meter. When the delay is zero you should see something 6 decibels higher, about 103.
Now measure and graph the amplitudes you measure, changing the delay in ten steps from 0 to 0.005 seconds. (Hint: to make the graph readable, don't make the vertical axis linear in decibels; instead, perhaps make equal spaces for 0, 94, 97, 100, and 103). But if you really want a nice-looking graph and don't mind 5 extra minutes of effort, convert from decibels to power.
Now do the same thing (on the same graph with a different color or line style) with the sinusoid at 200 Hz. instead of 100 Hz. Do you see a relationship between the two?
Now put six sinusoids at 100, 200, 300, 400, 500, 600 Hz. into a ``switch" object (that's primarily for convenience; connecting the six to the switch will add them.) Connect the switch output to both the delay and directly to the output as before. As you change the delay between 0 and 10 milliseconds, what do you hear? What special thing happens when you choose a 5 millisecond delay?