Parametric Audio Equalizer
This demo shows how to use ALSA Audio Capture and ALSA Audio Playback blocks from the BeagleBoard™ block library to implement a parametric audio equalizer algorithm with a Simulink® model and to run the model on BeagleBoard hardware.
Parametric equalizers are used to adjust the frequency response of audio systems. For example, a parametric equalizer can be used to compensate for biases with specific speakers that have peaks and dips at different frequencies.
In this demo, you will implement a parametric audio equalizer with a Simulink model and then run that model on BeagleBoard hardware. The parametric equalizer algorithm in this example provides three second-order (bi-quadratic) filters whose coefficients can be adjusted to achieve a desired frequency response. A graphical user interface (GUI) is used in simulation to dynamically adjust filter coefficients and explore behavior.
The following sections will describe how the parametric equalizer algorithm is specified, how the performance can be assessed through simulation, and how the model is run on BeagleBoard hardware. You will also learn how the ALSA Audio Capture and Playback blocks are used to input and output audio signals.
- We recommend completing Getting Started with BeagleBoard Hardware demo.
- DSP System Toolbox™
To run this demo you will need the following hardware:
- BeagleBoard xM or BeagleBoard Cx hardware
- Headphones or speakers
- Audio input source and audio cable
In this task, you will connect an audio input source, and speakers or headphones to BeagleBoard hardware. The audio captured from the audio input source will be equalized on BeagleBoard hardware and sent to the speakers/headphones.
1. Connect an audio source, such an MP3 player, to the AUDIO IN connector of your BeagleBoard hardware. You may use the audio output of your host computer as an audio input source to BeagleBoard hardware.
2. Connect speakers or headphones to the AUDIO OUT connector of the BeagleBoard hardware.
In this task, you will configure and run the parametric equalizer model on BeagleBoard hardware.
1. Open the Parametric Audio Equalizer model.
2. Select Tools > Run on Target Hardware > Options.... Review the parameters on the page that opens. If you performed a Firmware Update, Board information will be automatically populated with the host name, user name and password of your BeagleBoard hardware. If you have not performed a Firmware Update or you need to change the board parameters, enter the IP address, user name and password of your BeagleBoard hardware.
3. Make sure the Enable External mode option is checked.
4. In the Simulink model, double-click on the ALSA Audio Capture block. Note that the Audio sampling frequency is set to 44100 Hz and the Frame size is set to 4410. With these settings, the Equalizer algorithm processes 4410/44100(Hz) = 0.1 seconds of audio data at each sample time hit.
5. Select Tools > Run on Target Hardware > Run to run the model on BeagleBoard hardware.
1. As the model is running on BeagleBoard hardware, you will hear audio from the speakers/headphones connected to the BeagleBoard hardware.
2. A GUI displaying the frequency response of the audio equalizer will appear as shown in the picture below:
3. Click and drag the markers or lines in the Three Band Equalizer GUI to specify the desired filter response characteristics. Note the change in audio output as the frequency response of the equalizer changes.
4. Press the Stop button on the model to stop model execution.
- Change the volume of the sound sent to speakers/headphones by tuning the appropriate parameter in the model.
This demo showed a Simulink model of a parametric audio equalizer. Using External mode, equalizer settings were changed in real-time as the model executed on BeagleBoard hardware.