Main Content

Audio Effects for iOS Devices

This example shows how to use System objects™ from Audio Toolbox™ to implement echo and reverberation effects in a Simulink® model. You can run the model on your host computer or deploy it to an Apple iOS device.

Introduction

Echo and reverberation are two commonly-used audio effects in recording, movie making, and sound design. Echo is a reflection of sound that arrives at the listener with a delay after the direct sound. Echo can be produced by the bottom of a well or by the walls of a building. Reverberation is a large number of sound reflections building up and then decaying. A common use of reverberation is to simulate music played in a closed room. Most digital audio workstations (DAWs) have options to add echo and reverberation effects to sound tracks.

In this example, you design and implement echo and reverberation audio effects in a Simulink model. You can run your model on the host computer or an Apple iOS device.

Required Hardware

To run this example on iOS devices you will need the following hardware:

  • iPhone, iPod or an iPad

  • Host computer with Mac OS X system

  • USB cable to connect the device to host computer

Model Setup

TheaudioeffectsiOSmodel provides a choice of audio effect (echo or reverberation), device (host computer or iOS device), and audio source (MATLAB workspace or microphone). You can choose the configuration by clicking theConfiguration UIbutton.

Configuration UI:

Audio Effect: Echo

The echo effect has four tunable parameters that can be modified while the model is running:

  • Delay - Delay applied to audio signal, in seconds

  • Gain - Linear gain of the delayed audio

  • FeedbackLevel - Feedback gain applied to delay line

  • Wet/Dry Mix - Ratio of wet signal added to dry signal

Run Echo Effect on the Host Computer

If you choose to run the echo effect on your host computer, a UI designed to interact with the simulation is provided and can be opened by clickingHost Tuning UI. The UI allows you to tune echo parameters and hear the echo sound effect in real time.

Host tuning UI for echo effect:

Run Echo Effect on an Apple iOS Device

When you choose to run the echo effect on your Apple iOS device, you need to first ensure that you have installedSimulink Support Package for Apple iOS Devicesand that your iOS device is provisioned.

Once your iOS device is properly configured, use a USB cable to connect the device to your host computer.

You can choose to make an iOS standalone echo effect app by clicking theDeploy to hardwarebutton on the Simulink Editor toolbar. After deployment, the app can run on your iOS device even when it is disconnected from the host computer. You can also run the model inExternalmode by clicking theRunbutton on the Simulink Editor toolbar. To run inExternalmode, the iOS device must stay connected to the host computer.

The UI for the echo effect displays on your iOS device screen, as shown below:

Audio Effect: Reverberation

The reverberation effect has six tunable parameters that can be modified while the model is running:

  • Pre-delay - Time between hearing direct sound and the first early reflection

  • Highcut frequency - Cutoff frequency for the lowpass filter at the front of the reverberator structure

  • Diffusion - Density of reverb tail

  • Decay factor - Decay factor of reverb tail

  • High Frequency Damping - Attenuation of high frequencies in the reverberation output

  • Wet/Dry Mix - Ratio of wet signal added to dry signal

Run Reverberation Effect on the Host Computer

If you choose to run the reverberation effect on your host computer, a UI designed to interact with the simulation is provided and can be opened by clickingHost Tuning UI. The UI allows you to tune reverberation parameters and hear the reverberation sound effect in real time.

Host tuning UI for reverberation effect:

Run Reverberation Effect on an Apple iOS Device

When you choose to run the reverberation effect on your Apple iOS device, you need to first ensure that you have installedSimulink Support Package for Apple iOS Devicesand that your iOS device is provisioned.

Once your iOS device is properly configured, use a USB cable to connect the device to your host computer.

You can choose to make an iOS standalone reverberation effect app by clicking theDeploy to hardwarebutton on the Simulink Editor toolbar. After deployment, the app can run on your iOS device even when it is disconnected from the host computer. You can also run the model inExternalmode by clicking theRunbutton on the Simulink Editor toolbar. To run inExternalmode, the iOS device must stay connected to the host computer.

The UI for the reverberation effect displays on your iOS device screen, as shown below: