Documentation

### This is machine translation

Translated by
Mouseover text to see original. Click the button below to return to the English version of the page.

# reverberator System object

## Description

The `reverberator` System object™ adds reverberation to mono or stereo audio signals.

1. Create the `reverberator` object and set its properties.

2. Call the object with arguments, as if it were a function.

## Creation

### Syntax

``reverb = reverberator``
``reverb = reverberator(Name,Value)``

### Description

````reverb = reverberator` creates a System object, `reverb`, that adds artificial reverberation to an audio signal.```
````reverb = reverberator(Name,Value)` sets each property `Name` to the specified `Value`. Unspecified properties have default values.Example: `reverb = reverberator('PreDelay',0.5,'WetDryMix',1)` creates a System object, `reverb`, with a 0.5 second pre-delay and a wet-to-dry mix ratio of one.```

## Properties

expand all

Unless otherwise indicated, properties are nontunable, which means you cannot change their values after calling the object. Objects lock when you call them, and the `release` function unlocks them.

If a property is tunable, you can change its value at any time.

Pre-delay for reverberation in seconds, specified as a real scalar in the range [0, 1].

Pre-delay for reverberation is the time between hearing direct sound and the first early reflection. The value of `PreDelay` is proportional to the size of the room being modeled.

Tunable: Yes

Data Types: `single` | `double`

Lowpass filter cutoff in Hz, specified as a real positive scalar in the range 0 to $\left(\frac{SampleRate}{2}\right)$.

Lowpass filter cutoff is the –3 dB cutoff frequency for the single-pole lowpass filter at the front of the reverberator structure. It prevents the application of reverberation to high-frequency components of the input.

Tunable: Yes

Data Types: `single` | `double`

Density of reverb tail, specified as a real positive scalar in the range [0, 1].

`Diffusion` is proportional to the rate at which the reverb tail builds in density. Increasing `Diffusion` pushes the reflections closer together, thickening the sound. Reducing `Diffusion` creates more discrete echoes.

Tunable: Yes

Data Types: `single` | `double`

Decay factor of reverb tail, specified as a real positive scalar in the range [0, 1].

`DecayFactor` is proportional to the time it takes for reflections to run out of energy. To model a large room, use a long reverb tail (low decay factor). To model a small room, use a short reverb tail (high decay factor).

Tunable: Yes

Data Types: `single` | `double`

High-frequency damping, specified as a real positive scalar in the range [0, 1].

`HighFrequencyDamping` is proportional to the attenuation of high frequencies in the reverberation output. Setting `HighFrequencyDamping` to a large value makes high-frequency reflections decay faster than low-frequency reflections.

Tunable: Yes

Data Types: `single` | `double`

Wet-dry mix, specified as a real positive scalar in the range [0, 1].

Wet-dry mix is the ratio of wet (reverberated) to dry (original) signal that your `reverberator` System object outputs.

Tunable: Yes

Data Types: `single` | `double`

Input sample rate in Hz, specified as a positive scalar.

Tunable: Yes

Data Types: `single` | `double`

## Usage

For versions earlier than R2016b, use the `step` function to run the System object algorithm. The arguments to `step` are the object you created, followed by the arguments shown in this section.

For example, `y = step(obj,x)` and `y = obj(x)` perform equivalent operations.

### Syntax

``audioOut = reverb(audioIn)``

### Description

example

````audioOut = reverb(audioIn)` adds reverberation to the input signal, `audioIn`, and returns the mixed signal, `audioOut`. The type of reverberation is specified by the algorithm and properties of the reverberator System object, `reverb`.```

### Input Arguments

expand all

Audio input to the reverberator, specified as a column vector or two-column matrix. The columns of the matrix are treated as independent audio channels.

Data Types: `single` | `double`

### Output Arguments

expand all

Audio output from the reverberator, returned as a two-column matrix.

Data Types: `single` | `double`

## Object Functions

To use an object function, specify the System object as the first input argument. For example, to release system resources of a System object named `obj`, use this syntax:

`release(obj)`

expand all

 `createAudioPluginClass` Create audio plugin class that implements functionality of System object
 `configureMIDI` Configure MIDI connections between audio object and MIDI controller `disconnectMIDI` Disconnect MIDI controls from audio object `getMIDIConnections` Get MIDI connections of audio object
 `clone` Create duplicate System object `isLocked` Determine if System object is in use `release` Release resources and allow changes to System object property values and input characteristics `reset` Reset internal states of System object `step` Run System object algorithm

The `createAudioPluginClass` and `configureMIDI` functions map tunable properties of the `compressor` System object to user-facing parameters:

PropertyRangeMappingUnit
`PreDelay`[0, 1]linears
`HighCutFrequency`[20, 20000]logHz
`Diffusion`[0, 1]linearnone
`DecayFactor`[0, 1]linearnone
`HighFrequencyDamping`[0, 1]linearnone
`WetDryMix`[0, 1]linearnone

## Examples

expand all

Use the `reverberator` System object™ to add artificial reverberation to an audio signal read from a file.

Create the `dsp.AudioFileReader` and `audioDeviceWriter` System objects. Use the sample rate of the reader as the sample rate of the writer.

```fileReader = dsp.AudioFileReader( ... 'FunkyDrums-44p1-stereo-25secs.mp3', ... 'SamplesPerFrame',1024); deviceWriter = audioDeviceWriter( ... 'SampleRate',fileReader.SampleRate);```

Play 10 seconds of the audio signal through your device.

```tic while toc < 10 audio = fileReader(); deviceWriter(audio); end release(fileReader)```

Construct a `reverberator` System object with default settings.

`reverb = reverberator`

Construct a time scope to visualize the original audio signal and the audio signal with added artificial reverberation.

```scope = dsp.TimeScope( ... 'SampleRate',fileReader.SampleRate, ... 'TimeSpanOverrunAction','Scroll', ... 'TimeSpan',10, ... 'BufferLength',1.5e6, ... 'YLimits',[-1,1], ... 'ShowGrid',true, ... 'ShowLegend',true, ... 'Title','Audio with Reverberation vs. Original');```

Play the audio signal with artificial reverberation. Visualize the audio with reverberation and the original audio.

```while ~isDone(fileReader) audio = fileReader(); audioWithReverb = reverb(audio); deviceWriter(audioWithReverb); scope([audioWithReverb(:,1),audio(:,1)]) end release(fileReader) release(deviceWriter)```

## Algorithms

expand all

The algorithm to add reverberation follows the plate-class reverberation topology described in [1] and is based on a 29,761 Hz sample rate.

The algorithm has five stages.

The description for the algorithm that follows is for a stereo input. A mono input is a simplified case.

## References

[1] Dattorro, Jon. "Effect Design, Part 1: Reverberator and Other Filters." Journal of the Audio Engineering Society. Vol. 45, Issue 9, 1997, pp. 660–684.

[2] Dattorro, Jon. "Effect Design, Part 2: Delay-Line Modulation and Chorus." Journal of the Audio Engineering Society. Vol. 45, Issue 10, 1997, pp. 764–788.