主要内容

Implement Parametric Audio Equalizer on Android Device

This example shows how to use Audio File Read and Audio Playback blocks from the Simulink® Support Package for Android™ Devices to implement a parametric audio equalizer algorithm with a Simulink model and run the model on an Android device to hear and visualize output of it.

介绍

参数均衡器用于调整音频系统的频率响应。例如,参数均衡器可用于补偿具有特定扬声器的偏差,该扬声器具有不同频率的峰值和垂度。

In this example, you will implement a parametric audio equalizer with a Simulink model and then run that model on an Android device. 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 gauge in the GUI displays the average gain for the achieved frequency response.

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 an Android device. You will also learn how the Audio File Read and Playback blocks are used to input and output audio signals.

Prerequisites

Required Products

  • DSP System Toolbox™

Required Hardware

  • Android device, configured using和roidhwsetup

  • USB cable to connect the device to host computer

  • 耳机或扬声器

Task 1 - Connect Audio Output

将扬声器或耳机连接到Android设备的耳机插孔。从文件读取的音频将在设备上均衡并发送到扬声器/耳机。

Task 2 - Configure and Run Basic Parametric Equalizer Simulink Model

In this task, you will configure and run the parametric equalizer model on the device.

1.Open theBasic Parametric Audio Equalizermodel.

open_system('androidAudioEqualizerExample')

2.On the模式lingtab of the toolstrip, select模式l Settings.

3.Select theHardware Implementation窗格并查看打开的页面上的参数。

4.在Simuli金宝appnk模型中,双击音频文件读取块。请注意File nameis set as 'guitartune.wav' and the框架大小is set to 4410. You can findaudio sampling frequency这是块掩码上该音频文件的44100 Hz。通过这些设置,均衡器算法在每个采样时间命中过程4410/44100(Hz)= 0.1秒的音频数据。

5.On theHardwaretab of the Simulink model, in the模式section, selectRun on board和then clickBuild, Deploy & Start.

Task 3 - Change Frequency Response of Parametric Equalizer

1.As the model is running on the device, you will hear audio from the speakers/headphones connected to the device.

The UI of the application contains仪表盘APPtab views. The仪表盘tab view, displays gain using a gauge and in theAPPtab view the gain is plotted. You can switch between the tab views with a swipe.

2.一个GUI显示澳元的频率响应io equalizer will appear in your computer 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.

  • Change the audio source file in 'Audio File Read' block to your favorite music file.

  • 将“音频文件读取”块替换为Android设备的Simulink支持软件包的“音频捕获”块。金宝app金宝app

  • Advanced Parametric Audio EqualizerExample