Contents

Audio Tone Control Using General Standards Boards

This model shows how to do tone control audio processing using General Standards I/O boards. It requires the DSP System Toolbox™.

Left and right channel inputs are digitized with the 24DSI12 board, processed using the Tone Filters subsystem, and then fed to the 16AO16 board for output. The Tone Filters subsystem implements Bass, Mid, and Treble filters. Coefficients are selectable from a bank of filters and are slewed between the selected indices.

To test this model:

  1. Connect the differential pair B29/B30 on the 24DSI12 to B34/B33 on the 16AO16 boards.

  2. Attach a source (for example, a signal generator or mp3 player) to channels 1 & 2 of the 24DSI12 board.

  3. Attach a sink (for example, a speaker) to channels 1 & 2 of the 16AO16 board.

  4. Build, download, and run the model.

  5. Control the filter banks using the tone control GUI: tone_gui Note: To use tone_gui, you must run tone_controls_xpc in External mode.

Check Connection Between Host and Target Computer

Use 'slrtpingtarget' to test the host-target connection.

if ~strcmp(slrtpingtarget, 'success')
  error(message('xPCTarget:examples:Connection'));
end

Open, Build, and Download Model to the Target Computer

Open the tone control model, tone_controls_xpc. Under the model's configuration parameter Simulink Real-Time option settings, the system target file has been set to slrt.tlc. Hence, building the model will create an executable image, tone_controls_xpc.dlm, that can be run on a computer booted with the Simulink Real-Time kernel.

open_system('tone_controls_xpc')

Figure 1: Tone control model using the General Standards 24DSI12 and 16AO16 boards.

Build the model and download the image, xpcosc.dlm, to the target computer.

set_param('tone_controls_xpc','RTWVerbose','off'); % Configure for a non-Verbose build.
rtwbuild('tone_controls_xpc');                     % Build and download application.
### Starting Simulink Real-Time build procedure for model: tone_controls_xpc
Warning: This model contains blocks that do not handle sample time
changes at runtime. To avoid incorrect results, only change
the sample time in the original model, then rebuild the model. 
### Successful completion of build procedure for model: tone_controls_xpc
### Looking for target: TargetPC1
### Download model onto target: TargetPC1

Run Model, Randomize 'Gain' Parameter, Plot Host Scope Data

Create the MATLAB® variable, tg, containing the Simulink Real-Time target object. This object allows you to communicate with and control the target computer.

tg = SimulinkRealTime.target;           % Create a Simulink Real-Time target object
start(tg);                              % Start model execution

pause(10);
stop(tg);

% EOF tone_controls_xpc.m
Was this topic helpful?