Main Content

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:

  1. Open the Simulink Start Page by typing simulink at the MATLAB® command prompt.

  2. 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

  1. Create a model using an Audio Toolbox template.

  2. Open the Simulink Library Browser and select Audio Toolbox.

  3. Select a block from one of the Audio Toolbox Block Library categories and add it to your model.

  4. 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.

  5. To run your model, click the button.

  6. 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.

  7. 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.

Related Topics