1.2. Periodicity and waves#

This section introduces the concept of periodicity, which characterizes repeating signals. This idea is central to many concepts in both signal processing and perception of audio, so it’s worth spending some time with.

Specifically, this section covers the following topics:

  • Periodicity

  • Fundamental frequency

  • Waves (sinusoids) and their parameters

  • Basic properties of waves


1.2.1. Periodicity#

Definition 1.1 (Periodicity)

A signal \(x(t)\) is said to be periodic if there exists some finite \(t_0 > 0\) such that for every time \(t\),

\[ x(t + t_0) = x(t). \]

The smallest such \(t_0\) satisfying this equation, if it exists, it is called the fundamental period (or sometimes just period) of the signal \(x\). Different signals may have different periods, and some signals may have no period at all.

Think of the period of a signal as the shortest amount of time it takes, when listening to a looped recording, before you hear the recording start over.

Example (Pulse train)

A pulse train is a special kind of signal that consists only of ones and zeros, with the ones being separated at regular intervals. An example pulse train with a spacing of 1.5 second between pulses can be defined mathematically as

(1.2)#\[\begin{split}x(t) = \begin{cases} 1 & \text{ if } t \in 0, 1.5, 3, 4.5, \ldots\\ 0 & \text{otherwise} \end{cases}\end{split}\]

and the first few seconds are visualized as Fig. 1.4.

An illustration of a pulse train signal

Fig. 1.4 A pulse train \(x_\perp(t)\) with a period of \(t_0=1.5\) seconds.#

Fig. 1.4 demonstrates the pulse train which has a repeating pulse every 1.5 seconds. The signal is periodic with \(t_0 = 1.5\) because every point on the blue curve is identical to the point exactly \(t_0\) seconds later. Note that this must hold for every time \(t\), not just the locations of the pulses! The arrows indicate two such repetitions, though in general there will be infinitely many.

This points to a key consequence of periodicity.

Tip

If a signal is periodic, it must repeat forever:

\[x(t) = x(t + t_0) = x(t + 2\cdot t_0) = x(t + 3\cdot t_0) = \dots\]

This is why we take \(t_0\) to be the smallest possible period.


1.2.2. Aperiodic signals#

If a signal does not have a period, we call it aperiodic, and assign period \(t_0 = \infty\). Think of this as meaning that you would have to wait (literally) forever before you see the signal repeat itself exactly.

Aperiodic signals come in all kinds of flavors. Random noise (e.g., white noise) is aperiodic, and if it wasn’t, we probably wouldn’t call it noise. However, don’t think that all aperiodic signals are random or unpredictable. For example, a monotonically increasing sequence \(x(t) = t\) is perfectly predictable, but it is also aperiodic because you never see the same value twice.

As a final example, a staircase signal, which is like the monotonically increasing sequence but is piece-wise constant, is also aperiodic even though you do see the same values multiple times.

Three aperiodic signals, random noise, a linear ramp, and a staircase.

Fig. 1.5 Examples of aperiodic signals. In each case, there is no finite time \(t_0>0\) where \(x(t + t_0) = x(t)\).#

There’s a real sense in which most signals are aperiodic. We typically use periodicity as a conceptual tool to understand idealized signals, but it’s also helpful to remember that any signal of finite duration can be made periodic by playing it on a loop. This idea will come back later when we get to the Fourier transform.


1.2.3. Fundamental frequency#

Periods are defined in units of time: how long must we wait before observing the signal repeating itself? Often, it is more convenient to think in terms of how many times a signal repeats itself within a fixed duration of time, typically one second.

This idea provides a definition for frequency: how many cycles does a signal complete in one second? Frequency is measured in units of Hertz (Hz), where 1 Hz denotes one full cycle in one second.

Definition 1.2 (Fundamental frequency)

If a signal \(x(t)\) has a fundamental period \(t_0\), then its fundamental frequency is defined as

\[ f_0 = \frac{1}{t_0}. \]

Note that \(f_0\) need not be a whole number. In the pulse train example above, the period was \(1.5 = 3/2\) seconds, which is equivalent to \(f_0 = 2/3\) Hz: it completes two cycles in three seconds. (The third cycle starts at \(t=3\), as illustrated in the figure.)

If a signal is aperiodic, and has \(t_0 = \infty\), then its fundamental frequency is defined to be \(f_0 = 0\), meaning that it completes 0 cycles in 1 second, or any number of seconds. Note that this definition is primarily used for notational consistency — if a signal is aperiodic, it is also common to say that it has no fundamental frequency.

1.2.3.1. Why the \(t_0\) and \(f_0\) business?#

At this point, you might (rightly) be wondering why we have these 0 subscripts on “fundamental” values. There are two reasons for this:

  1. To distinguish fundamental period (\(t_0\)) or frequency (\(f_0\)) from arbitrary times (\(t\)) or frequencies (\(f\)), and

  2. To highlight the connection between the fundamental \(f_0\) and “harmonics” or “overtones”, which are often notated as \(f_1, f_2, \cdots\).

The first point is a somewhat arbitrary convention, but the second point is definitely not arbitrary. However, it’s important to keep in mind that any periodic signal will have a fundamental frequency, but we typically only discuss harmonics in the context of sinusoids.

This naturally leads us to the question: what is a wave?


1.2.4. Waves#

So far, we’ve discussed arbitrary signals in terms of their periodicity properties, and seen examples of periodic and aperiodic signals. There are many kinds of periodic signals: pulse trains, square waves, triangle waves, sawtooth waves, just to name a few. Among all periodic signals, sinusoids (e.g., sine and cosine waves like the figure below) are in many ways, the most important and mathematically well-behaved. The term wave is therefore often used synonymously with the more specific sinusoid.

A sinusoid making three cycles per second

Fig. 1.6 A sinusoid at 3 Hz.#

1.2.4.1. What makes sinusoids special?#

While many readers with some prior familiarity with audio have an intuitive grasp of sinusoids as “pure tones”, it’s often not clearly stated why sinusoids are so well-suited to signal processing and analysis, or where they come from in the first place. The reasons underlying the use of sinusoidal waves go mathematically deep, but the basic principles can be understood directly in terms of geometry.

Keep in mind that our goal here is to understand periodicities in signals. The physical universe readily supplies us with countless examples of periodic phenomena: think about the rotation of the Earth (day and night cycles), the orbit of the Moon around the Earth (full and new Moon cycles), the Earth orbiting the sun, and so on. Each of these phenomena are repetitive. Moreover, each of these phenomena are characterized by continuous rotation: once a full rotation has been completed, the cycle repeats itself.

Put succinctly, rotation models repetition.

1.2.4.2. Rotation and sinusoids#

Sinusoids are typically introduced in a high-school geometry class in the study of right triangles. The sine of an angle \(\theta\) is defined as the ratio of the opposite side-length to the hypotenuse; the cosine being the ratio of the adjacent side-length to the hypotenuse, and so on. While it is certainly useful in many contexts, this view can obscure the interpretation of sinusoids as waves.

Here, we’ll use a different, but equivalent definition of the sine (and cosine) of an angle. First, we will draw a circle with radius \(1\) centered at the origin (\(x=y=0\)). Next, we will draw a line through the origin and making an angle \(\theta\) with the horizontal axis. This line will intersect the circle at a point. Then:

  • \(\sin(\theta)\) is the height (distance up from the horizontal axis) of the point on the circle at angle \(\theta\);

  • \(\cos(\theta)\) is the width (distance right from the vertical axis) of the point on the circle at angle \(\theta\).

A point at unit distance from the origin defines a right triangle whose side lengths are defined by cosine and sine.

Fig. 1.7 The \(\sin\) and \(\cos\) of an angle give the height and width of a right triangle whose hypotenuse connects the origin (0, 0) to a point on the unit circle.#

Note that when the circle has a radius of 1, the hypotenuse will always have length 1, so \(\sin\) and \(\cos\) measure the height and width of the triangle.

By convention, we take \(\theta=0\) to be the right-most point on the circle, the point \((x=1, y=0)\). Positive angles \(\theta > 0\) correspond to a counter-clockwise (upward) rotation from \((1, 0)\). Negative angles \(\theta < 0\) correspond to a clockwise (downward) rotation.

Remember: sines and cosines turn angles into distances.

Why does this give us waves?

The sine or cosine of a single angle just gives us a single number, between -1 and +1. A single number is not enough to get a wave—for that, we’ll need to change the angle over time. Imagine the angle varying continuously over time, like the seconds hand of a clock. We’ll denote this by \(\theta(t)\), and have \(\theta(0) = 0\) indicate that the starting position is at the right-most point on the circle \((1, 0)\).

Equivalently, we can think of this changing \(\theta(t)\) in terms of the \((x, y)\)-position of the point on the circle at the corresponding angle. To get a wave out of this continuous rotation, we can look at what happens to just one of the two coordinates this point, which will be given by

\[\begin{split}\begin{split} x(t) &= \cos(\theta(t))\\ y(t) &= \sin(\theta(t)). \end{split}\end{split}\]

This process is illustrated by Fig. 1.8.

Fig. 1.8 A point traveling around the unit circle at a fixed speed produces sinusoidal waves when you look only at its horizontal (cosine) or vertical (sine) coordinate.#

As long as \(\theta(t)\) keeps moving at a constant rate, there will be some minimal time \(t_0\) such that \(\theta(t_0) = 0\) returns to its initial position: the first complete cycle. We can translate this fundamental period \(t_0\) into a frequency \(f_0 = 1/t_0\), measuring the number of cycles completed in one second.

If we assume that \(\theta(t)\) is moving at a constant speed, we would have

\[ \theta(t) = 2 \pi \cdot f_0 \cdot t, \]

so that after \(t=t_0\) seconds, \(f_0 \cdot t_0 = 1\), and \(\theta(t_0) = 2\pi \equiv 0\) because \(2\pi\) radians completes a turn around the circle. Typically, we don’t bother with separate notation for \(\theta(t)\). Instead, we parameterize the \(x\) and \(y\) positions directly in terms of time and frequency:

\[\begin{split}\begin{split} x(t) &= \cos\left(2\pi \cdot f_0 \cdot t\right)\\ y(t) &= \sin\left(2\pi \cdot f_0 \cdot t\right) \end{split}\end{split}\]

1.2.4.3. Wave parameters#

The equations above are helpful for providing a geometric interpretation of sinusoids, but they aren’t quite general enough to describe every wave we might want. Fortunately, it’s not too much more work to do just that.

Every wave can be expressed in the following standardized form:

(1.3)#\[x(t) = A \cdot \cos\left(2\pi \cdot f \cdot t + \phi\right).\]

This form requires us to specify three parameters to describe the wave:

  • \(A\): the amplitude of the wave, how high it can rise or fall from 0;

  • \(f\): the frequency of the wave, how many cycles it completes in one second;

  • \(\phi\): the phase offset of the wave, the starting position (in radians) at time \(t=0\).

Changing the amplitude \(A\) has the effect of stretching or compressing the wave vertically. Amplitude (\(A\)) can be also be interpreted as the radius of the circle along which our point is traveling.

Changing the frequency \(f\) has the effect of stretching or compressing the wave horizontally. Frequency (\(f\)) can also be thought of as the speed at which our point travels.

Changing the phase offset \(\phi\) has the effect of horizontally shifting the wave. Positive \(\phi\) moves the wave to the left, and negative \(\phi\) moves the wave to the right.

Fig. 1.9 Top: changing amplitude (\(A\)) stretches or compresses the wave vertically. Middle: changing frequency (\(f\)) stretches the wave horizontally. Bottom: changing phase (\(\phi\)) rigidly shifts the wave horizontally with no stretching.#

1.2.4.3.1. Some gotchas#

Every wave can be expressed in the above standard form, but that doesn’t mean the representation is unique. In general, there are multiple combinations of \((A, f, \phi)\) that each describe the same wave. For example,

(1.4)#\[x(t) = 2 \cdot \cos(2\pi \cdot f \cdot t) = -2 \cdot \cos(2\pi \cdot f \cdot t - \pi).\]

This particular case arises because a phase offset of \(\pi\) amounts to exactly half a turn around the circle. The figure below demonstrates this effect: offset by \(\phi = -\pi\) turns the wave upside-down, and if we also negate the amplitude (not pictured), the two waves would match up exactly.

Illustration of two waves with opposite phase

Fig. 1.10 A phase offset of \(\phi=\pm\pi\) negates any sinusoid.#

Most of the time, this ambiguity of representation doesn’t cause us too many troubles. It’s sometimes useful to know about this though, especially when algebraically manipulating wave equations. We won’t do too much of that here, but it’s good to keep in mind.


1.2.5. Properties of waves#

We’ll round out this section with a few facts about waves that will be useful in the later chapters.

1.2.5.1. Symmetry and anti-symmetry#

The cosine function has a horizontal symmetry: \(\cos(\theta) = \cos(-\theta)\). (Sometimes called an even function.) This can be understood geometrically: positive \(\theta\) means counter-clockwise rotation, and negative \(\theta\) means clockwise rotation. In both cases, the horizontal position is the same as long as the absolute value of the angle is preserved.

By contrast, the sine function as a horizontal anti-symmetry: \(\sin(-\theta) = -\sin(\theta)\). This also can be understood geometrically as above, except now changing the direction of the rotation means flipping vertically across the horizontal axis.

These symmetries are summarized visually below by observing that negating the angle \(-\theta\) preserves horizontal position of the point on the circle, but negates the vertical position.

Illustration of sine and cosine symmetries

Fig. 1.11 Sine and cosine symmetries for \(\purple{\theta}\) and \(\magenta{-\theta}\). Both angles produce points with the same horizontal component: \(\cos(-\theta) = \cos(\theta)\). Opposite angles produce points with opposite vertical components: \(\sin(-\theta) = -\sin(\theta)\).#

1.2.5.2. Converting between sine and cosine#

Every cosine can be expressed as a sine with an appropriate phase offset, and vice versa. The rule for this is as follows

(1.5)#\[\begin{split}\begin{split} \sin(\theta) &= \cos(\pi/2 - \theta)\\ \cos(\theta) &= \sin(\pi/2 - \theta) \end{split}\end{split}\]

These rules follow from the fact that all triangles have angles which sum to \(\pi\) radians, and that we’re dealing specifically with right triangles. If one angle is \(\purple{\theta}\), the corner has angle \(\pi/2\) (90 degrees), then the remaining angle must be \(\green{\pi/2 - \theta}\), so that the sum totals to \(\pi\):

\[ \purple{\theta} + \frac{\pi}{2} + \green{\left(\frac{\pi}{2} - \theta\right)} = \frac{\pi}{2} + \green{\frac{\pi}{2}} + \purple{\theta} - \green{\theta} = \pi. \]

Finally, the cosine of one angle is the sine of the other (and vice versa). In the example below, \(\cos(\theta)\) is the ratio of the adjacent side (in red) to the hypotenuse (in blue), which is also the sine of the opposing angle. Similarly, \(\sin(\theta)\) is the ratio of the opposite side (in yellow) to the hypotenuse (in blue), which is the cosine of the opposing angle \(\pi/2 - \theta\).

Illustration of complementary angles

Fig. 1.12 If one acute angle \(\purple{\theta}\) of a right triangle is given, the other can be inferred as \(\green{\pi/2 - \theta}\).#

1.2.5.3. Averaging over time#

Imagine that we have a wave with some frequency \(f_0\), or equivalently, a fundamental period \(t_0 = 1/f_0\). If you were to look at the average value of the wave over the time interval \([0, t_0]\), it will always come out to 0. This may seem like an obvious fact, but it is worth reasoning through carefully.

A careful proof of this statement can be done with calculus, but we can also reason about it intuitively via symmetry:

  • The time interval \([0, t_0]\) corresponds to one full rotation around the circle.

  • The circle has equally much perimeter in one half of the plane (e.g., \(x<0\)) as the other (e.g., \(x>0\)).

  • For every position \((x, y)\) the point on the circle occupies during our time interval, it must also pass through the opposite point \((-x, -y)\) at some other time during our time interval. These two points cancel each other out and sum to 0.

  • Since all points are canceled to 0, so is the total sum.

Note that the above argument only works if the time interval covers exactly one cycle of the wave. The argument can be extended to cover other intervals of the same duration, or intervals spanning a whole number of cycles. However, it does not extend to fractional cycles. If you don’t cover exactly a whole number of cycles, the average will not be 0. This observation will become important later on when using the Fourier transform to analyze the contents of signals.

Illustration of two opposing points on a circle

Fig. 1.13 Two points at opposite ends of the circle will average to the circle’s origin.#