Advanced Parametric Audio Equalizer
This example shows how to create an Android™ app using Simulink® Support Package for Android Devices with Audio Toolbox™ to implement a parametric audio equalizer.
Parametric equalizers are often used to adjust the frequency response of an audio system. For example, a parametric equalizer can be used to compensate for physical speakers which have peaks and dips at different frequencies. It improves the quality of the audio signal by reducing chance of speaker saturation.
This example provides two Simulink models:
androidparameqsim: The parametric equalizer algorithm is specified and behavior is explored through simulation.
androidparameqdev: Deploy the app and tune parameters of algorithm on the device.
With these models, you can:
Equalize the audio, read from a file and send to the speakers/headphones.
Visualize the frequency response of equalizer by using the Array Plot (DSP System Toolbox) block.
Download and Install Simulink Support Package for Android Devices
Complete the Getting Started with Android Devices example
Complete the Implement Parametric Audio Equalizer on Android Device example (Recommended)
Simulink Support Package for Android Devices
Android device, configured using androidhwsetup
USB cable to connect the device to development computer
Headphones or speakers to connect to the development computer
In this model, a parametric equalizer is implemented in the Equalizer subsystem. In the subsystem, a MATLAB Function block implements 3-Band Equalizer algorithm using multibandParametricEQ function of Audio System Toolbox. This function performs multiband parametric equalization of input audio signal using specified center frequencies, gains, and quality factors.
You can use the sliders provided in the simulation controls subsystem to tune each of the equalizer band's center frequency, bandwidth, and peak (or dip) gain.
Connect headphones or speakers to your development computer if it does not have any. In the model, click the Run button on the toolbar to start simulation. When the model is simulating, the ArrayPlot shows the equalizer's response in terms of band gains over frequencies. The response is computed using a Discrete Transfer Function Estimator block. This block estimates the frequency-response of equalizer using the Welch's method. The response will change as you tune the equalizer specifications. You can also listen to either the original or equalized audio by toggling the switch inside bypass controller subsystem.
Deploying Advanced Parametric Equalizer App on Device
1. Connect your configured android device to development computer using USB cable. Open the androidparameqdev Simulink model.
2. On the Hardware tab of the Simulink model, in the Mode section, select Run on board and then click Build, Deploy & Start to deploy the model as an app on your device.
Differences in this model are described below:
It replaces From Multimedia File block with Audio File Read block from the Android Block Library.
Also, replaces Audio Device Writer block with Audio Playback block from the Android Block Library.
All Sliders and Toggle Switches from simulation controls subsystems are replaced with Slider and Button blocks from the Android Block Library.
Tuning Audio Equalizer on Device
As the model runs on the device, ArrayPlot displays equalizer response plotted on device screen. A list of sliders also present on screen to change center frequency, band width and band gain of equalizer algorithm. Change the slider values of band gains to specify the desired filter response characteristics. You can also toggle Mute button to mute the speaker.
Other Things to Try
Change the audio source file in Audio File Read block to your favorite music file.
Replace the Audio File Read block with Audio Capture block of Simulink Support Packages for Android Devices to experience real-time audio processing.