This example shows how to create an Android™ app using Simulink® Support Package for Android Devices with Audio System 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:
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 block.
Complete the Getting Started with Android Devices example.
Complete the Parametric Audio Equalizer 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.
Connect your configured android device to development computer using USB cable. Open the androidparameqdev model and click the Deploy to Hardware button on the toolbar 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.
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.
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.