Real-Time Audio in Simulink
Create Model Using Audio Toolbox Simulink Model Templates
The Audio Toolbox™ Simulink® model templates provide a Simulink environment suitable for audio signal processing.
To create a model using the Audio Toolbox Simulink model templates:
Open the Simulink Start Page by typing
simulink
at the MATLAB® command prompt.Under Audio Toolbox, click the model template you want.
The two Audio Toolbox Simulink model templates are:
Audio System – Creates a blank model configured with settings recommended for Audio Toolbox.
Basic Audio Player – Creates an audio model configured with settings recommended for Audio Toolbox. This model uses a From Multimedia File block to read multimedia files, and an Audio Device Writer block to send sound data to the default audio device of your computer. Adjust the model as needed to model your audio system. For example, to process live audio input, replace the From Multimedia File block with an Audio Device Reader block.
Add Audio Toolbox Blocks to Model
Create a model using an Audio Toolbox template.
Open the Simulink Library Browser and select Audio Toolbox.
Select a block from one of the Audio Toolbox Block Library categories and add it to your model.
In this example, a Compressor is added to the model by dragging and dropping from the Dynamic Range Control category of the Simulink Library Browser.
To run your model, click the button.
Open a block parameter user interface by double-clicking the block. You can modify parameters while the model runs. For example, if you added a Compressor block, you can adjust the Threshold (dB) dial to compress the dynamic range of your audio signal.
Running a model in the Simulink environment does not save the model. Save your model by clicking the button.
Block Characteristics
You can type showaudioblockdatatypetable
at the MATLAB command line to generate a table showing characteristics of
Simulink blocks in Audio Toolbox.