Fourier Series#
L’étude profonde de la nature est la source la plus féconde de découvertes mathématiques. – Jean-Baptiste Joseph Fourier (1768–1830)
Given a signal
In mathematics, the meaning of transform and transformation is somewhat specific, but it still is relatively wide or loose when the definition sometimes says it is a mathematical quantity obtained from a given quality by an algebraic, geometric, or functional operation. In transform theory, mathematicians talk about a suitable choice of a function called kernel (from the German nucleus or core), by which a problem may be simplified.
In 1822 Jean-Baptise Joseph Fourier discovered a truly remarkable transformation which gives us insights into our knowledge of waveforms in general and music in particular. He claimed that any function, whether continuous or discontinuous, can be transformed into a series of sines. That important work was corrected to
almost any periodic function can be represented by a Fourier series that converges.
and expanded upon by others to provide the foundation for various forms of the Fourier transform used since.
I find this result still fascinating. At this point, I have to mention that the great German mathematician Carl Friedrich Gauß already discovered this connection in 1805 and, what is even more remarkable, he formulated something quite similar to the fast Fourier transform (FFT)! His breakthrough was not widely adopted because it only appeared after his death in volume three of his collected works which was written with non-standard notation in a 19th-century version of Latin.
Especially since the re-discovery of the fast Fourier transform (FFT) in 1965 by Cooley and Tukey to detect underground tests of atomic bombs, the Fourier synthesis is a widespread technique performed in all areas of signal processing. There are so many applications of the FFT, from solving differential equations to radar and sonar, studying crystal structures, WiFi, and 5G. It is no surprise that the mathematician Gilbert Strang called the FFT
the most important numerical algorithm of our lifetime. – Gilbert Strang
But why is that?
Well, it is all about computation speed!
The FFT reduces the time complexity of the discrete Fourier transformation (DFT) from
Frequency Spectrum#
Before we dicuss the mathematical basis, let’s have a look at the frequency spectrum of a audio recordings such that we can picture what we want to compute. First let us use an audio recording of a physical piano. The note played is A0 = 440 Hz.
We can display the waveform of the signal

Fig. 18 Waveform, i.e., the audio signal in the time domain.#
as well as the frequency sprectrum

Fig. 19 Fourier coefficients, i.e., the audio signal in the frequency domain.#
The spectrum is computed by the discrete Fourier transform. As you can see, there are even lower frequencies than the fundamental present and the signal consists of a lot inharmonic content. The piano might be out of tune.
Let us look at a second synthetic example:
The sound was generated by the following code.
({
var sig = SinOsc.ar(440 * [1,2,3,4,5]) * [0.5, 0.2, 0.2, 0.1, 0.1];
sig = Mix(sig);
[sig, sig];
}.play;)
We can display the wave form of the signal (here I only plot a very short time period)

Fig. 20 Synthetic waveform, i.e., the audio signal in the time domain.#
as well as the frequency sprectrum

Fig. 21 Synthetic Fourier coefficients, i.e., the audio signal in the frequency domain.#
In the synthetic case, we get exaclty what we expected, i.e., 5 peaks, four harmonic overtones, and one fundamental at 440 Hz.
Similarity of Periodic Functions#
Let us start from the assumption that the Fourier theorem is correct (which it is). So we assume, that we can built any periodic vibration using a combination of sinusiods whose frequencies are integer multiple of a fundamental frequcency. Our job is to find the correct amplitudes and phases of these sinusiods. Let’s ignore the phase for a moment. We assume that all phases are zero.
The question that we have to answer is: how much of a specific sinusoidal is in
Functions are similar if their product result in a positive function. In other words, if the integral of their product is positive.
In the following plot we can see this intuition at play.
The integral of
( // generate the y(t) * sin(2*pi*u)
{[
SinOsc.ar(1) * SinOsc.ar(1),
LFSaw.ar(1) * SinOsc.ar(1),
SinOsc.ar(1) * SinOsc.ar(1,0.5*pi),
LFTri.ar(0.5)*(-1)*SinOsc.ar(1)
]}.plot(1)
)
Let’s have a look at the sum of the first terms of the sawtooth wave:
For shorthand let us also define the product with a sine wave of a certain frequency of
({
var sines = Array.fill(8, {arg i; 1/(i+1) * SinOsc.ar(i+1);});
var y = Mix(sines);
[y]++Array.fill(8, {arg i; y*SinOsc.ar(i+1)});
}.plot(1)
)
We get
In general we get
Note that
holds, thus
Therefore,
follows. If we look at the integral of
then
holds.
In fact, if we look at
holds.
Perpendicular Functions
For all frequencies
holds. We say that
({ // generate sin(2*pi*i*x) * sin(2*pi*j*x)
var sines = Array.fill(3, {arg i; 1/(i+1) * SinOsc.ar(i+1);});
var y = Mix(sines);
var indices = Array.fill2D(3, 3, {arg row, col; [row,col];}).flatten;
indices.collect({arg index; var i = index[0], j = index[1];
SinOsc.ar(i+1)*SinOsc.ar(j+1)
});
}.plot(1)
)
We say that these functions are perpendicular to each other because their scalar product (the integral of their product) is zero!
The similarity measure of two functions is similar to the similarity of two vectors.
One way to compare two vectors
is zero.
Their inner product is large if they are similar.
We can define the inner product of two functions
Inner Product of two Functions
Let
is the inner product of
Fourier Synthesis#
But let us start from the beginning, i.e., from the Fourier series. The process of constructing a periodic function by a Foruier series is called Fourier synthesis.
Fourier Series (FS)
A Fourier series is a sum that represents a periodic function as a sum of sine and cosine waves.
The frequency of each wave in the sum is an integer multiple of the periodic function’s fundamental frequency.
The Foruier series in amplitude-phase form
where
Except for pathological functions, any periodic function can be represented by a Fourier series (FS) that converges. Convergence of Fourier series means that as more and more harmonics from the series are summed, each successive partial Fourier series sum will better approximate the function, and will equal the function with a potentially infinite number of harmonics.
Fourier Theorem
Except for pathological functions, any periodic vibration, no matter how complicated it seems, can be built up from sinusoids whose frequencies are integer multiples of a fundamental frequency, by choosing the proper amplitudes and phases.
Non-periodic functions can be handled using an extension of the Fourier series called the Fourier transform which treats non-periodic functions as periodic with infinite period. This transform thus can generate frequency domain representations of non-periodic functions as well as periodic functions, allowing a waveform to be converted between its time domain representation and its frequency domain representation.
In section Additive Synthesis we use Fourier synthesis to construct complicated waveforms from a sum of simple sinusoids, i.e., a Fourier series. For example, the (periodic) sawtooth wave
can be constructed by an infinite sum
Fourier Analysis#
Until now, we assumed that all phase shifts are zero.
Then we concluded that if we compute the integral of signal
either
, where is the frequency of the sinusoid (similarity)or zero, in this case
is perpendicular to the sinusoid (non-similarity)
We can reformulate the problem of similarity using an optimization problem.
Let us start with an analog signal first
We multiply some term of the sum of
Following our discussion at the start of section Similarity of Periodic Functions, at the maximum of
is not zero, otherwise it is.
Therefore, we multiply the integral by
Using the equivalence of polar and Cartesian forms, that is,
We can simplify
The derivative of
holds and the correlation peak value is:
In other words,
where
Recalling complex numbers, remember that
and
holds. Therefore, we can write the Fourier series of a function in complex form by adapting Eq. (29):
Here we have used the following notations:
We finally arrive at the Fourier series in its exponential form.
Fourier Series (FS) in its Exponential Form
The Foruier series in exponential form
where
This form generalizes to complex-valued functions.
In this form phase and amplitude are represented by a phasor, e.g.,
We can define
to be the phasor of the respective sinusoid with frequency