Performing Spectral Analysis on Live Audio Data

This example shows how to use the Analog Input block to acquire live signals from a data acquisition device into Simulink. In this example, the sound card is selected as the input device in the Analog Input block. The Simulink model implements a spectral analysis method known as the periodogram. A periodogram computes the spectral content of a signal over time.

Note: This example requires 32-bit version of MATLAB®, Simulink, Data Acquisition Toolbox, DSP System Toolbox™ and a Windows® sound card to open and run the model.

Watch the spectrogram on a live audio input. (18 seconds)

The input signal is a real-time audio signal through a microphone. The signal is buffered into frames, with 128 samples per frame. Each frame is then windowed using a Hamming window function, and the DSP System Toolbox block computes the FFT for the windowed frame. The system collects the FFTs for successive frames and plots them to produce a spectrogram.

Even though a Windows sound card was used for this example, this model can be easily updated to connect your models to other supported data acquisition devices. This provides you the flexibility to use the same Simulink model with different data acquisition device.

Was this topic helpful?