Added in API level 9

EnvironmentalReverb


open class EnvironmentalReverb : AudioEffect
kotlin.Any
   ↳ android.media.audiofx.AudioEffect
   ↳ android.media.audiofx.EnvironmentalReverb

A sound generated within a room travels in many directions. The listener first hears the direct sound from the source itself. Later, he or she hears discrete echoes caused by sound bouncing off nearby walls, the ceiling and the floor. As sound waves arrive after undergoing more and more reflections, individual reflections become indistinguishable and the listener hears continuous reverberation that decays over time. Reverb is vital for modeling a listener's environment. It can be used in music applications to simulate music being played back in various environments, or in games to immerse the listener within the game's environment. The EnvironmentalReverb class allows an application to control each reverb engine property in a global reverb environment and is more suitable for games. For basic control, more suitable for music applications, it is recommended to use the android.media.audiofx.PresetReverb class.

An application creates a EnvironmentalReverb object to instantiate and control a reverb engine in the audio framework.

The methods, parameter types and units exposed by the EnvironmentalReverb implementation are directly mapping those defined by the OpenSL ES 1.0.1 Specification (http://www.khronos.org/opensles/) for the SLEnvironmentalReverbItf interface. Please refer to this specification for more details.

The EnvironmentalReverb is an output mix auxiliary effect and should be created on Audio session 0. In order for a MediaPlayer or AudioTrack to be fed into this effect, they must be explicitely attached to it and a send level must be specified. Use the effect ID returned by getId() method to designate this particular effect when attaching it to the MediaPlayer or AudioTrack.

Creating a reverb on the output mix (audio session 0) requires permission android.Manifest.permission#MODIFY_AUDIO_SETTINGS

See android.media.audiofx.AudioEffect class for more details on controlling audio effects.

Summary

Nested classes
abstract

The OnParameterChangeListener interface defines a method called by the EnvironmentalReverb when a parameter value has changed.

open

The Settings class regroups all environmental reverb parameters.

Constants
static Int

Decay HF ratio.

static Int

Decay time.

static Int

Density.

static Int

Diffusion.

static Int

Early reflections delay.

static Int

Early reflections level.

static Int

Reverb delay.

static Int

Reverb level.

static Int

Room HF level.

static Int

Room level.

Inherited constants
Public constructors
EnvironmentalReverb(priority: Int, audioSession: Int)

Class constructor.

Public methods
open Short

Gets the ratio of high frequency decay time (at 5 kHz) relative to low frequencies.

open Int

Gets the decay time.

open Short

Gets the density level.

open Short

Gets diffusion level.

open EnvironmentalReverb.Settings!

Gets the environmental reverb properties.

open Int

Gets the reflections delay.

open Short

Gets the volume level of the early reflections.

open Int

Gets the reverb delay.

open Short

Gets the reverb level.

open Short

Gets the room HF level.

open Short

Gets the master volume level of the environmental reverb effect.

open Unit
setDecayHFRatio(decayHFRatio: Short)

Sets the ratio of high frequency decay time (at 5 kHz) relative to the decay time at low frequencies.

open Unit
setDecayTime(decayTime: Int)

Sets the time taken for the level of reverberation to decay by 60 dB.

open Unit
setDensity(density: Short)

Controls the modal density of the late reverberation decay.

open Unit
setDiffusion(diffusion: Short)

Sets the echo density in the late reverberation decay.

open Unit

Registers an OnParameterChangeListener interface.

open Unit

Sets the environmental reverb properties.

open Unit
setReflectionsDelay(reflectionsDelay: Int)

Sets the delay time for the early reflections.

open Unit
setReflectionsLevel(reflectionsLevel: Short)

Sets the volume level of the early reflections.

open Unit
setReverbDelay(reverbDelay: Int)

Sets the time between the first reflection and the reverberation.

open Unit
setReverbLevel(reverbLevel: Short)

Sets the volume level of the late reverberation.

open Unit

Sets the volume level at 5 kHz relative to the volume level at low frequencies of the overall reverb effect.

open Unit

Sets the master volume level of the environmental reverb effect.

Inherited functions
Inherited properties

Constants

PARAM_DECAY_HF_RATIO

Added in API level 9
static val PARAM_DECAY_HF_RATIO: Int

Decay HF ratio. Parameter ID for android.media.audiofx.EnvironmentalReverb.OnParameterChangeListener

Value: 3

PARAM_DECAY_TIME

Added in API level 9
static val PARAM_DECAY_TIME: Int

Decay time. Parameter ID for OnParameterChangeListener

Value: 2

PARAM_DENSITY

Added in API level 9
static val PARAM_DENSITY: Int

Density. Parameter ID for OnParameterChangeListener

Value: 9

PARAM_DIFFUSION

Added in API level 9
static val PARAM_DIFFUSION: Int

Diffusion. Parameter ID for OnParameterChangeListener

Value: 8

PARAM_REFLECTIONS_DELAY

Added in API level 9
static val PARAM_REFLECTIONS_DELAY: Int

Early reflections delay. Parameter ID for OnParameterChangeListener

Value: 5

PARAM_REFLECTIONS_LEVEL

Added in API level 9
static val PARAM_REFLECTIONS_LEVEL: Int

Early reflections level. Parameter ID for OnParameterChangeListener

Value: 4

PARAM_REVERB_DELAY

Added in API level 9
static val PARAM_REVERB_DELAY: Int

Reverb delay. Parameter ID for OnParameterChangeListener

Value: 7

PARAM_REVERB_LEVEL

Added in API level 9
static val PARAM_REVERB_LEVEL: Int

Reverb level. Parameter ID for OnParameterChangeListener

Value: 6

PARAM_ROOM_HF_LEVEL

Added in API level 9
static val PARAM_ROOM_HF_LEVEL: Int

Room HF level. Parameter ID for OnParameterChangeListener

Value: 1

PARAM_ROOM_LEVEL

Added in API level 9
static val PARAM_ROOM_LEVEL: Int

Room level. Parameter ID for OnParameterChangeListener

Value: 0

Public constructors

EnvironmentalReverb

Added in API level 9
EnvironmentalReverb(
    priority: Int,
    audioSession: Int)

Class constructor.

Parameters
priority Int: the priority level requested by the application for controlling the EnvironmentalReverb engine. As the same engine can be shared by several applications, this parameter indicates how much the requesting application needs control of effect parameters. The normal priority is 0, above normal is a positive number, below normal a negative number.
audioSession Int: system wide unique audio session identifier. If audioSession is not 0, the EnvironmentalReverb will be attached to the MediaPlayer or AudioTrack in the same audio session. Otherwise, the EnvironmentalReverb will apply to the output mix. As the EnvironmentalReverb is an auxiliary effect it is recommended to instantiate it on audio session 0 and to attach it to the MediaPLayer auxiliary output.
Exceptions
java.lang.IllegalArgumentException
java.lang.UnsupportedOperationException
java.lang.RuntimeException

Public methods

getDecayHFRatio

Added in API level 9
open fun getDecayHFRatio(): Short

Gets the ratio of high frequency decay time (at 5 kHz) relative to low frequencies.

Return
Short the decay HF ration. See setDecayHFRatio(short) for units.
Exceptions
java.lang.IllegalStateException
java.lang.IllegalArgumentException
java.lang.UnsupportedOperationException

getDecayTime

Added in API level 9
open fun getDecayTime(): Int

Gets the decay time.

Return
Int the decay time in milliseconds.
Exceptions
java.lang.IllegalStateException
java.lang.IllegalArgumentException
java.lang.UnsupportedOperationException

getDensity

Added in API level 9
open fun getDensity(): Short

Gets the density level.

Return
Short the density level. See setDiffusion(short) for units.
Exceptions
java.lang.IllegalStateException
java.lang.IllegalArgumentException
java.lang.UnsupportedOperationException

getDiffusion

Added in API level 9
open fun getDiffusion(): Short

Gets diffusion level.

Return
Short the diffusion level. See setDiffusion(short) for units.
Exceptions
java.lang.IllegalStateException
java.lang.IllegalArgumentException
java.lang.UnsupportedOperationException

getProperties

Added in API level 9
open fun getProperties(): EnvironmentalReverb.Settings!

Gets the environmental reverb properties. This method is useful when a snapshot of current reverb settings must be saved by the application.

Return
EnvironmentalReverb.Settings! an EnvironmentalReverb.Settings object containing all current parameters values
Exceptions
java.lang.IllegalStateException
java.lang.IllegalArgumentException
java.lang.UnsupportedOperationException

getReflectionsDelay

Added in API level 9
open fun getReflectionsDelay(): Int

Gets the reflections delay.

Return
Int the early reflections delay in milliseconds.
Exceptions
java.lang.IllegalStateException
java.lang.IllegalArgumentException
java.lang.UnsupportedOperationException

getReflectionsLevel

Added in API level 9
open fun getReflectionsLevel(): Short

Gets the volume level of the early reflections.

Return
Short the early reflections level in millibels.
Exceptions
java.lang.IllegalStateException
java.lang.IllegalArgumentException
java.lang.UnsupportedOperationException

getReverbDelay

Added in API level 9
open fun getReverbDelay(): Int

Gets the reverb delay.

Return
Int the reverb delay in milliseconds.
Exceptions
java.lang.IllegalStateException
java.lang.IllegalArgumentException
java.lang.UnsupportedOperationException

getReverbLevel

Added in API level 9
open fun getReverbLevel(): Short

Gets the reverb level.

Return
Short the reverb level in millibels.
Exceptions
java.lang.IllegalStateException
java.lang.IllegalArgumentException
java.lang.UnsupportedOperationException

getRoomHFLevel

Added in API level 9
open fun getRoomHFLevel(): Short

Gets the room HF level.

Return
Short the room HF level in millibels.
Exceptions
java.lang.IllegalStateException
java.lang.IllegalArgumentException
java.lang.UnsupportedOperationException

getRoomLevel

Added in API level 9
open fun getRoomLevel(): Short

Gets the master volume level of the environmental reverb effect.

Return
Short the room level in millibels.
Exceptions
java.lang.IllegalStateException
java.lang.IllegalArgumentException
java.lang.UnsupportedOperationException

setDecayHFRatio

Added in API level 9
open fun setDecayHFRatio(decayHFRatio: Short): Unit

Sets the ratio of high frequency decay time (at 5 kHz) relative to the decay time at low frequencies.

Parameters
decayHFRatio Short: high frequency decay ratio using a permille scale. The valid range is [100, 2000]. A ratio of 1000 indicates that all frequencies decay at the same rate.
Exceptions
java.lang.IllegalStateException
java.lang.IllegalArgumentException
java.lang.UnsupportedOperationException

setDecayTime

Added in API level 9
open fun setDecayTime(decayTime: Int): Unit

Sets the time taken for the level of reverberation to decay by 60 dB.

Parameters
decayTime Int: decay time in milliseconds. The valid range is [100, 20000].
Exceptions
java.lang.IllegalStateException
java.lang.IllegalArgumentException
java.lang.UnsupportedOperationException

setDensity

Added in API level 9
open fun setDensity(density: Short): Unit

Controls the modal density of the late reverberation decay.

The scale should approximately map linearly to the perceived change in reverberation. A lower density creates a hollow sound that is useful for simulating small reverberation spaces such as bathrooms.

Parameters
density Short: density specified using a permille scale. The valid range is [0, 1000]. A value of 1000 o/oo indicates a natural sounding reverberation. Values below this level produce a more colored effect.
Exceptions
java.lang.IllegalStateException
java.lang.IllegalArgumentException
java.lang.UnsupportedOperationException

setDiffusion

Added in API level 9
open fun setDiffusion(diffusion: Short): Unit

Sets the echo density in the late reverberation decay.

The scale should approximately map linearly to the perceived change in reverberation.

Parameters
diffusion Short: diffusion specified using a permille scale. The diffusion valid range is [0, 1000]. A value of 1000 o/oo indicates a smooth reverberation decay. Values below this level give a more grainy character.
Exceptions
java.lang.IllegalStateException
java.lang.IllegalArgumentException
java.lang.UnsupportedOperationException

setParameterListener

Added in API level 9
open fun setParameterListener(listener: EnvironmentalReverb.OnParameterChangeListener!): Unit

Registers an OnParameterChangeListener interface.

Parameters
listener EnvironmentalReverb.OnParameterChangeListener!: OnParameterChangeListener interface registered

setProperties

Added in API level 9
open fun setProperties(settings: EnvironmentalReverb.Settings!): Unit

Sets the environmental reverb properties. This method is useful when reverb settings have to be applied from a previous backup.

Parameters
settings EnvironmentalReverb.Settings!: a EnvironmentalReverb.Settings object containing the properties to apply
Exceptions
java.lang.IllegalStateException
java.lang.IllegalArgumentException
java.lang.UnsupportedOperationException

setReflectionsDelay

Added in API level 9
open fun setReflectionsDelay(reflectionsDelay: Int): Unit

Sets the delay time for the early reflections.

This method sets the time between when the direct path is heard and when the first reflection is heard.

Parameters
reflectionsDelay Int: reflections delay in milliseconds. The valid range is [0, 300].
Exceptions
java.lang.IllegalStateException
java.lang.IllegalArgumentException
java.lang.UnsupportedOperationException

setReflectionsLevel

Added in API level 9
open fun setReflectionsLevel(reflectionsLevel: Short): Unit

Sets the volume level of the early reflections.

This level is combined with the overall room level (set using setRoomLevel(short)).

Parameters
reflectionsLevel Short: reflection level in millibels. The valid range is [-9000, 1000].
Exceptions
java.lang.IllegalStateException
java.lang.IllegalArgumentException
java.lang.UnsupportedOperationException

setReverbDelay

Added in API level 9
open fun setReverbDelay(reverbDelay: Int): Unit

Sets the time between the first reflection and the reverberation.

Parameters
reverbDelay Int: reverb delay in milliseconds. The valid range is [0, 100].
Exceptions
java.lang.IllegalStateException
java.lang.IllegalArgumentException
java.lang.UnsupportedOperationException

setReverbLevel

Added in API level 9
open fun setReverbLevel(reverbLevel: Short): Unit

Sets the volume level of the late reverberation.

This level is combined with the overall room level (set using setRoomLevel(short)).

Parameters
reverbLevel Short: reverb level in millibels. The valid range is [-9000, 2000].
Exceptions
java.lang.IllegalStateException
java.lang.IllegalArgumentException
java.lang.UnsupportedOperationException

setRoomHFLevel

Added in API level 9
open fun setRoomHFLevel(roomHF: Short): Unit

Sets the volume level at 5 kHz relative to the volume level at low frequencies of the overall reverb effect.

This controls a low-pass filter that will reduce the level of the high-frequency.

Parameters
roomHF Short: high frequency attenuation level in millibels. The valid range is [-9000, 0].
Exceptions
java.lang.IllegalStateException
java.lang.IllegalArgumentException
java.lang.UnsupportedOperationException

setRoomLevel

Added in API level 9
open fun setRoomLevel(room: Short): Unit

Sets the master volume level of the environmental reverb effect.

Parameters
room Short: room level in millibels. The valid range is [-9000, 0].
Exceptions
java.lang.IllegalStateException
java.lang.IllegalArgumentException
java.lang.UnsupportedOperationException