Discrete Fourier Transform for Audio Analysis

I must apologize for this quite long time since my last update. There are many things occurring and the good stuff will be soon available here in the blog. First of all, I’d like to share with you that the Infoway had two papers accepted in the 24th International Conference on Software Engineering and Knowledge Engineering! Soon they will be available in posts, so everyone can read and discuss about them. But today’s post is not about that…

Until now, we already did some interesting works with Digital Signal Processing focusing in images. Continuing with the multimedia systems it’s time to explore audio signals and today I’m gonna present you to the Discrete Fourier Transform for analyzing the frequency content and behavior of signals.

Fourier Transforms

Interested in heat propagation, the french mathematician and physicist Fourier published a paper on the use of sinusoids to represent temperature distributions. In this paper Fourier claimed that any continuous periodic signal could be represented as the sum of properly chosen sinusoidal waves. It’s important to remember that there are an infinite number of ways that a signal can be decomposed. But the component sine and cosine waves are simpler, so there is no general reason for using square and triangular decompositions.

A signal can be either continuous or discrete, and it can be either periodic or aperiodic. The combination of these two features generates four categories, that can be used to classify The Fourier Transforms.

Fourier Transforms

Fourier Transforms

Aperiodic-Continuous: These signals extend to both positive and negative infinity without repeating in a periodic pattern. The Fourier Transform for this type of signal is simply called the Fourier Transform.

Periodic-Continuous: Any waveform that repeats itself in a regular pattern from negative to positive infinity. This version of the Fourier Transform is called the Fourier Series.

Aperiodic-Discrete: These signals are only defined at discrete points between positive and negative infinity, and do not repeat themselves in a periodic way. This type of Fourier Transform is called the Discrete Time Fourier Transform.

Periodic-Discrete: These are discrete signals that repeat themselves in a periodic way from negative to positive infinity. This type of Fourier Transform is called the Discrete Fourier Transform.

As you can imagine, it is impossible to calculate the Discrete Time Fourier Transform in a computer algorithm. That is because an infinite number of sinusoids are required to synthesize a signal that is aperiodic. We will focus then, in the only type of Fourier Transform that can be used in Digital Signal Processing, the Discrete Fourier Transform.

Discrete Fourier Transform

Lets take a quick overview on the concept of transform. Suppose you have a signal composed of 100 samples. If you devise some equation, algorithm, or procedure for changing these 100 samples into another 100 samples, you have yourself a transform. In short, a transform is any fixed procedure that changes one chunk of data into another chunk of data.

In the DFT although any kind of sampled data can be used as the input, it is usually composed of samples taken at regular intervals of time, described by the term time domain. The output is described by the term frequency domain, and is composed by the amplitudes of the sine and cosine waves.

The frequency domain contains exactly the same information as the time domain, just in a different form. If you know one domain, you can calculate the other. Given the time domain signal, the process of calculating the frequency domain is called decomposition, analysis, the forward DFT, or simply, the DFT. If you know the frequency domain, calculation of the time domain is called synthesis, or the inverse DFT. Both synthesis and analysis can be represented in equation form and computer algorithms.

There are three different ways to calculate the DFT: Simultaneous Equations, Correlation and the most used, Fast Fourier Transform. The FFT is a complicated algorithm, and its details are usually left to those that specialize in such things.

DFT Application for Audio Analysis

There are many applications for DSP in audio analysis, specially in the music area. The transformation of individuals sound tracks of the many instruments in the final product involve many processes as filtering, signal addition and subtraction, signal editing, etc.

Our example is an application of the DFT for recognizing fundamental frequency in audio samples. This application could be used as a digital tuner for instance, and the code can be downloaded here.

References:

The Scientist and Engineer’s Guide to Digital Signal Processing

Leave a comment