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:
Connect the differential pair B29/B30 on the 24DSI12 to B34/B33 on the 16AO16 boards.
Attach a source (for example, a signal generator or mp3 player) to channels 1 & 2 of the 24DSI12 board.
Attach a sink (for example, a speaker) to channels 1 & 2 of the 16AO16 board.
Build, download, and run the model.
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.
Use 'slrtpingtarget' to test the connection between the development and target computers.
if ~strcmp(slrtpingtarget, 'success') error(message('xPCTarget:examples:Connection')); end
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.mldatx, that can be run on a computer booted with the Simulink Real-Time kernel.
Figure 1: Tone control model using the General Standards 24DSI12 and 16AO16 boards.
Build the model and download the image, xpcosc.mldatx, 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
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