Platform: MATLAB Implement a system that analyses audio in real time and display
ID: 2082937 • Letter: P
Question
Platform: MATLAB Implement a system that analyses audio in real time and displays energy at each frequency evolving as a function of time. Frequency resolution and rate at which energy changes are estimated should be adjustable parameters in your code. Audio input should be via the PC micin/line-in. In addition, your system should also be able to accept an audio file (.wav format, 16kHz sampling rate) as input and produce the required display as the audio is played in real time via loudspeakers/headphones.
Explanation / Answer
inShare Save Follow PRINT PDF EMAIL
One of the best things about working at Tektronix is all of the smart test engineers floating around our Beaverton, OR campus, and around the world. In this post, engineer Ian Dees goes “behind the scenes” on FFTs.—Jit Lim
Imagine your test system has just captured several signals at once from an antenna. You know there are multiple RF signals in the acquisition because you were tuned to a heavily used part of the spectrum. In the time domain, the waveform’s a mess. If only you could break the data apart into the various frequencies—the various signals—that make up the entire acquisition.
A Fourier transform is just what the engineer ordered! Open any good DSP book, and a dozen different algorithms will greet you: Chirp-Z, Prime Factor, and so on. None of these are particularly hard to implement. But why reinvent the wheel? There’s a world of solid, tested, decent-performing implementations of the Discrete Fourier Transform out there. Today, we’ll focus on one of the most popular: FFTW.
FFTW, or “Fastest Fourier Transform in the West,” is perhaps the best-known open-source FFT implementation. It originated at MIT and has contributors from around the globe. Its license provides the ultimate try-before-you-buy experience. You can slip FFTW into your project, see if it fits your needs, and only then decide whether or not to purchase a commercial license.
The implementation has several control knobs you can fine-tune, depending on how much you know in advance about the data you’ll be dealing with. But FFTW also comes with a few good-enough default settings, so you can get up and running quickly.
How quickly? It’s nearly a one-liner. First, you create a plan for your data, which is a data structure FFTW uses for bookkeeping. Next, you acquire your signal and perform the frequency transform. Once you’ve used the result, you tell FFTW you’re done with the plan and let it do some cleanup. Here’s what the process looks like in C