Every DJ knows how to drop the beat to a great tune. But do you know how to transform the frequency components of any periodic signal?
This post answers that question with an ode to the Fourier transform. We’ll describe it’s history, theory, how to do it, and wrap up with real world applications in music production and ML.
I’ll keep it light and accessible while delivering the right level of technical depth for you to apply what you learn below in your own explorations.
- What is the Fourier Transform?
- Breaking Down Waves into Sine Waves
- The Math Behind the Magic
- Inverse Fourier Transform
- Discrete Fourier Transform (DFT)
- The Fourier Transform in Music
- Dissecting Sound: From Waveforms to Frequencies
- How DJs Use Fourier Transforms
- Fourier Transform in Machine Learning
- Feature Extraction: Teaching AI to "Hear"
- Convolutional Neural Networks
- Spectrograms
- An Ode to the Fourier Transform
- Conclusions
- Call to Action: Remix Your Skills
- Resources for Further Learning
What is the Fourier Transform?
The Fourier Transform is a math tool that breaks a signal down into its different frequency components. It's like taking a smoothie and separating out the fruits that went into it.
Using Fourier Transforms we convert a signal from the time domain (where we see how the signal changes over time) to the frequency domain (where we see how much of each frequency is present in the signal).
This is quite useful in fields like engineering, physics, and mathematics. Understanding the frequency content of a signal is necessary to properly balance audio content while mixing, beat-matching, or arranging a song using various audio content.
Breaking Down Waves into Sine Waves
Put another way, the Fourier transform is a mathematical technique that breaks down complex waveforms (like music) into a sum of simple sinusoidal waves of different frequencies and amplitudes. This allows any periodic signal to be represented as a weighted sum of sine and cosine waves!d
The Math Behind the Magic
What follows is calculus. If you are not comfortable with this math, just bear with me!
For a continuous function , the Fourier transform is defined as the integral:
where:
- represents angular frequency
- represents time
- is the imaginary unit
In a way, this function represents a form of mathematical listening. The original function is broken into its component frequencies and the resonance of each band is measured.
Inverse Fourier Transform
The inverse Fourier transform allows us to reconstruct the original function from its frequency domain representation:
Intuitively, this integral represents the sum of the Fourier transform at each frequency. We’re going to skip over complex properties of this function. I’ve included it here only to reinforce this concept: Fourier transforms are invertible.
Discrete Fourier Transform (DFT)
For discrete signals, we use the Discrete Fourier Transform (which is easier to compute).
where:
- is the input sequence
- is the DFT
- is the number of samples
The Fast Fourier Transform (FFT) is an efficient algorithm to compute the DFT, reducing computational complexity from to . In application, we are almost always using the FFT for music software compared to the other variations, which are more expensive to compute in real-time.
That’s enough theory for now. Let’s move on to discuss the more interesting applications.
The Fourier Transform in Music
In music, Fourier transform is used to analyze the frequency content of sound. It converts a musical signal from the time domain (amplitude over time) to the frequency domain, providing information about the frequencies and amplitudes that make up the signal.
Dissecting Sound: From Waveforms to Frequencies
The resulting frequency spectrum shows the amplitude of each frequency component in the original sound. Each peak in the spectrum represents a sinusoidal wave at a specific frequency that is present in the signal. The height of the peak indicates the amplitude or volume of that frequency. Such analytical information is often essential to quality post-production.
How DJs Use Fourier Transforms
Frequency information is useful for many aspects of music:
- Equalization (EQ) - Seeing the frequency makeup allows producers to boost or cut specific frequency ranges to shape the overall tonal balance.
- Multiband Compression - Key frequencies can be targeted to control dynamics using a multiband compressor, which splits the main signal into several frequency bands using a Fourier transform prior to processing. This allows targeted application of compression to control dynamic range within certain sections at precise times.
- Mix analysis in post-production - Clashing frequencies between channels can be identified and adjusted by comparing the frequency representations and applying equalization.
- Sound synthesis - Fourier analysis shows how different timbres are composed of various harmonics, which can then be replicated with additive synthesis.
- Audio effects - Filters, distortion, and other effects can be precisely controlled in the frequency domain, and are also less computationally expensive to compute this way.
The Fourier transform is an essential tool that allows DJs and producers to visualize and manipulate the frequency content of sounds din great detail. By decomposing complex musical waveforms into a combination of sine waves, it lets you process and shape audio in a mix or recording.
Virtually anytime you are viewing a frequency or pitch based representation of an audio signal, you are using a Fourier transform as an analytical tool. Without the Fourier transform, modern digital music production wouldn’t be possible.
Fourier Transform in Machine Learning
Digital Signal Processing tools such as the Fourier transform are also useful within the domain of Machine Learning.
Feature Extraction: Teaching AI to "Hear"
The Fourier transform allows the key frequency components and patterns in a signal to be identified and extracted for machine learning models. The main steps are:
- Apply Fourier transform to split the raw signal into component frequencies and amplitudes.
- Analyze frequency spectrum to identify key frequencies based on amplitude.
- Extract key features from the spectrum, such as the frequencies and amplitudes of major peaks, power in different frequency bands, spectral entropy, etc.
The Fourier transform reveals frequency patterns while reducing dimensionality compared to raw signal. This leads to more effective learning from time-series data.
Convolutional Neural Networks
Operating Convolutional Neural Networks on data in the domain of space or time is computationally expensive. This operation could be more efficient in the frequency domain due to the convolution theorem.
For Fourier transforms, the convolution theorem states:
- The Fourier transform of the convolution of two functions is the product of their individual Fourier transforms.
- The Fourier transform of the product of two functions is the convolution of their individual Fourier transforms.
Combined with the Fast Fourier transform algorithm, we improve runtime complexity to (for an image and kernel).
You achieve a significant speedup in the convolutional neural network by performing the convolution in frequency domain and inverse transform back into time domain. This scaling effect is even more noticeable for large image and kernel sizes.
Spectrograms
Spectrograms visualize how frequency content varies over time. They’re created by dividing the signal into short segments and computing the Fourier transform of each segment.
This shows the frequency components present at each time step. Spectrograms are commonly used to analyze audio signals like speech and music, showing how the energy at different frequencies changes over the duration of the sound.
An Ode to the Fourier Transform
To celebrate Fourier’s gift to us, an irregular ode.
O, gift to mankind, broken down into parts! Demystify our shadows from separate arts Reverse multiplexor, a rainbow from dark Scattered through essence by crescents & arcs Shift us from time and into your domain The periods and primes that we find shall remain Circles collapsing, a phase of survival Principal components, perplex, no surprisal Extracting dimensions from unity and gain Designing a soundscape, so myriad yet plain You might read this ode to your gift & get vexed As vibes get transformed from surreal to complex
Let’s move on and wrap up.
Conclusions
Today we learned about the Fourier transform and the integral mathematical role it plays in digital signal processing for music production and machine learning. Tools used every day by music industry professionals rely on Fourier transforms to transform audio signals into recorded music.
Use this to inform your next musical or programmatic creation. Show me what you make!
Call to Action: Remix Your Skills
AI, music, and technology are moving faster than ever before. Stay abreast of developments in the field(s) with these resources for further learning. Feel free to share this article and blog with your communities, and don’t forget to follow me on X and LinkedIn!