Long Nguyen

Resources and online courses for Math and Computer Science.

An Introduction to the Discrete Fourier Transform

The Discrete Fourier Transform(DFT) lies at the beautiful intersection of math and music. It is one of the most useful and widely used tools in many applications. If you have opened a JPEG, listened to an MP3, watch an MPEG movie, used the voice recognition capabilities of Amazon's Alexa, you've used some variant of the DFT. Its efficient implementation, the Fast Fourier Transform, is considered one of the most important algorithms in computer science.

The goals of this short course is to understand the math behind the algorithm and to appreciate its utility by analyzing and manipulating audio files with Python. No programming experience is necessary although some understanding of basic trig(sine and cosine) is useful.

This course is currently being taught on Udemy(free) and on Youtube.

It is recommended that you download the Anaconda distribution which includes latest version of Python, many packages and libraries for scientific computing and a package manager. The code for the lecture exercises below, however, can also be run on the cloud on MyBinder.

Lecture 1: Overview and Applications of the DFT

What is the Discrete Fourier Transform? Reading .txt and .wav files with Python. Working with Numpy's fft module. Plotting Graphs with Matplotlib. Determine the note/chord of a piano recording with the DFT.

Lecture 2: Digital Audio Basics

Waveforms. Digital Audio. Sampling Rate. Amplitude, Frequency and Phase of Sinusoids. Frequency is Pitch. Logarithm of Frequency. Fundamental Frequency. Overtones and Harmonics. Time Domain vs. Frequency Domain. Discrete Fourier Transform. Inverse Discrete Fourier Transform.

Lecture 3: Aliasing and the Nyquist Frequency

Aliasing. The Sampling Theorem. The Nyquist Frequency. Distortion of Audio. Reconstruction of Audio. Lowpass Filters. CD Quality Sampling Rate.

Lecture 4: The Discrete Fourier Transform

The Discrete Fourier Transform. The DFT is a Frequency Detector. Applications of the Inverse Discrete Fourier Transform. Complex Exponentials. Real vs. Complex Sinusoids. Positive vs. Negative Frequency. Symmetry of the Spectrum of a Real Signal. An in-depth Example. Understanding the DFT as an Inner Product. Complex Sinusoids are Basis Vectors for Audio Signals. Using Numpy's fft Module.

Lecture 5: A Simple Noise Filtering Example

A simple application of noise filtering. Use the Inverse Discrete Fourier Transform to filter out a high pitch frequency from an audio file.

Creative Commons License
This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.