Reverb Stages#

Reverb Stages emulate the natural reverberance of rooms.

ReverbRoom#

class audio_dsp.stages.ReverbRoom(max_room_size=1, predelay=10, max_predelay=None, **kwargs)

The room reverb stage. This is based on Freeverb by Jezar at Dreampoint, and consists of 8 parallel comb filters fed into 4 series all-pass filters.

Parameters:
max_room_size

Sets the maximum room size for this reverb. The room_size parameter sets the fraction of this value actually used at any given time. For optimal memory usage, max_room_size should be set so that the longest reverb tail occurs when room_size=1.0.

predelayfloat, optional

The delay applied to the wet channel in ms.

max_predelayfloat, optional

The maximum predelay in ms.

Attributes:
dsp_blockaudio_dsp.dsp.reverb.reverb_room

The DSP block class; see Reverb Room for implementation details.

set_damping(damping)

Set the damping of the reverb room stage. This controls how much high frequency attenuation is in the room. Higher values yield shorter reverberation times at high frequencies.

Parameters:
dampingfloat

How much high frequency attenuation in the room, between 0 and 1.

set_decay(decay)

Set the decay of the reverb room stage. This sets how reverberant the room is. Higher values will give a longer reverberation time for a given room size.

Parameters:
decayfloat

How long the reverberation of the room is, between 0 and 1.

set_dry_gain(gain_dB)

Set the dry gain of the reverb room stage. This sets the level of the unprocessed signal.

Parameters:
gain_dbfloat

Dry gain in dB, less than 0 dB.

set_pre_gain(pre_gain)

Set the pre gain of the reverb room stage.

Parameters:
pre_gainfloat

Pre gain value. Must be less than 1.

set_predelay(predelay)

Set the predelay of the wet channel.

Parameters:
predelayfloat

Predelay in ms, less than max_predelay.

set_room_size(new_room_size)

Set the room size, will adjust the delay line lengths.

The room size is proportional to max_room_size, and must be between 0 and 1. To increase the room_size above 1.0, max_room_size must instead be increased. Optimal memory usage occurs when room_size is set to 1.0.

Parameters:
new_room_sizefloat

How big the room is as a proportion of max_room_size. This sets delay line lengths and must be between 0 and 1.

set_wet_dry_mix(mix)

Set the wet/dry gains so that the mix of 0 results in a fully dry output, the mix of 1 results in a fully wet output.

Parameters:
mixfloat

The wet/dry mix, must be [0, 1].

set_wet_gain(gain_dB)

Set the wet gain of the reverb room stage. This sets the level of the reverberated signal.

Parameters:
gain_dbfloat

Wet gain in dB, less than 0 dB.

ReverbRoom Control#

The following runtime command ids are available for the ReverbRoom Stage. For details on reading and writing these commands, see the Run-Time Control User Guide.

Control parameter

Payload length

CMD_REVERB_ROOM_ROOM_SIZE

sizeof(float)

How big the room is as a proportion of max_room_size. This sets delay line lengths and must be between 0 and 1.


CMD_REVERB_ROOM_FEEDBACK

sizeof(int32_t)

feedback gain in Q0.31 format. Feedback can be calculated from decay as (0.28 decay) + 0.7. Use the function adsp_reverb_calculate_feedback() in control/reverb.h.


CMD_REVERB_ROOM_DAMPING

sizeof(int32_t)

High frequency attenuation in Q0.31 format. Use the function adsp_reverb_calculate_damping() in control/reverb.h.


CMD_REVERB_ROOM_WET_GAIN

sizeof(int32_t)

Gain applied to the wet signal in Q0.31 format. Use the function adsp_reverb_db2int() in control/reverb.h. Alternatively, both wet and dry gains can be obtained from adsp_reverb_wet_dry_mix().


CMD_REVERB_ROOM_DRY_GAIN

sizeof(int32_t)

Dry signal gain in Q0.31 format. Use the function adsp_reverb_db2int() in control/reverb.h. Alternatively, both wet and dry gains can be obtained from adsp_reverb_wet_dry_mix().


CMD_REVERB_ROOM_PREGAIN

sizeof(int32_t)

The pregain applied to the signal before the reverb. Changing this value is not recommended. Use the function adsp_reverb_float2int() in control/reverb.h.


CMD_REVERB_ROOM_PREDELAY

sizeof(uint32_t)

Predelay applied to the wet channel in samples. To convert a value in other units of time to samples, use time_to_samples() in control/signal_chain.h.

ReverbRoomStereo#

class audio_dsp.stages.ReverbRoomStereo(max_room_size=1, predelay=10, max_predelay=None, **kwargs)

The stereo room reverb stage. This is based on Freeverb by Jezar at Dreampoint. Each channel consists of 8 parallel comb filters fed into 4 series all-pass filters, and the reverberator outputs are mixed according to the width parameter.

Parameters:
max_room_size

Sets the maximum room size for this reverb. The room_size parameter sets the fraction of this value actually used at any given time. For optimal memory usage, max_room_size should be set so that the longest reverb tail occurs when room_size=1.0.

predelayfloat, optional

The delay applied to the wet channel in ms.

max_predelayfloat, optional

The maximum predelay in ms.

Attributes:
dsp_blockaudio_dsp.dsp.reverb_stereo.reverb_room_stereo

The DSP block class; see Reverb Room Stereo for implementation details.

set_damping(damping)

Set the damping of the reverb room stage. This controls how much high frequency attenuation is in the room. Higher values yield shorter reverberation times at high frequencies.

Parameters:
dampingfloat

How much high frequency attenuation in the room, between 0 and 1.

set_decay(decay)

Set the decay of the reverb room stage. This sets how reverberant the room is. Higher values will give a longer reverberation time for a given room size.

Parameters:
decayfloat

How long the reverberation of the room is, between 0 and 1.

set_dry_gain(gain_dB)

Set the dry gain of the reverb room stage. This sets the level of the unprocessed signal.

Parameters:
gain_dbfloat

Dry gain in dB, less than 0 dB.

set_pre_gain(pre_gain)

Set the pre gain of the reverb room stage.

Parameters:
pre_gainfloat

Pre gain value. Must be less than 1.

set_predelay(predelay)

Set the predelay of the wet channel.

Parameters:
predelayfloat

Predelay in ms, less than max_predelay.

set_room_size(new_room_size)

Set the room size, will adjust the delay line lengths.

The room size is proportional to max_room_size, and must be between 0 and 1. To increase the room_size above 1.0, max_room_size must instead be increased. Optimal memory usage occurs when room_size is set to 1.0.

Parameters:
new_room_sizefloat

How big the room is as a proportion of max_room_size. This sets delay line lengths and must be between 0 and 1.

set_wet_dry_mix(mix)

Set the wet/dry gains so that the mix of 0 results in a fully dry output, the mix of 1 results in a fully wet output.

Parameters:
mixfloat

The wet/dry mix, must be [0, 1].

set_wet_gain(gain_dB)

Set the wet gain of the reverb room stage. This sets the level of the reverberated signal.

Parameters:
gain_dbfloat

Wet gain in dB, less than 0 dB.

set_width(width)

Set the decay of the reverb room stage. This sets how reverberant the room is. Higher values will give a longer reverberation time for a given room size.

Parameters:
widthfloat

How much stereo separation between the channels. A width of 0 indicates no stereo separation (i.e. mono). A width of 1 indicates maximum stereo separation.

ReverbRoomStereo Control#

The following runtime command ids are available for the ReverbRoomStereo Stage. For details on reading and writing these commands, see the Run-Time Control User Guide.

Control parameter

Payload length

CMD_REVERB_ROOM_STEREO_ROOM_SIZE

sizeof(float)

How big the room is as a proportion of max_room_size. This sets delay line lengths and must be between 0 and 1.


CMD_REVERB_ROOM_STEREO_FEEDBACK

sizeof(int32_t)

feedback gain in Q0.31 format. Feedback can be calculated from decay as (0.28 decay) + 0.7. Use the function adsp_reverb_calculate_feedback() in control/reverb.h.


CMD_REVERB_ROOM_STEREO_DAMPING

sizeof(int32_t)

High frequency attenuation in Q0.31 format. Use the function adsp_reverb_calculate_damping() in control/reverb.h.


CMD_REVERB_ROOM_STEREO_WET_GAIN1

sizeof(int32_t)

Gain applied to obtain the wet signal in Q0.31 format. Use function adsp_reverb_room_st_calc_wet_gains() in control/reverb.h. Alternatively, all gains can be obtained from adsp_reverb_st_wet_dry_mix().


CMD_REVERB_ROOM_STEREO_WET_GAIN2

sizeof(int32_t)

Gain applied to obtain the wet signal in Q0.31 format. Use function adsp_reverb_room_st_calc_wet_gains() in control/reverb.h. Alternatively, all gains can be obtained from adsp_reverb_st_wet_dry_mix().


CMD_REVERB_ROOM_STEREO_DRY_GAIN

sizeof(int32_t)

Dry signal gain in Q0.31 format. Use the function adsp_reverb_db2int() in control/reverb.h. Alternatively, all gains can be obtained from adsp_reverb_st_wet_dry_mix().


CMD_REVERB_ROOM_STEREO_PREGAIN

sizeof(int32_t)

The pregain applied to the signal before the reverb. Changing this value is not recommended. Use the function adsp_reverb_float2int() in control/reverb.h.


CMD_REVERB_ROOM_STEREO_PREDELAY

sizeof(uint32_t)

Predelay applied to the wet channel in samples. To convert a value in other units of time to samples, use time_to_samples() in control/signal_chain.h.

ReverbPlateStereo#

class audio_dsp.stages.ReverbPlateStereo(predelay=10, max_predelay=None, **kwargs)

The stereo room plate stage. This is based on Dattorro’s 1997 paper. This reverb consists of 4 allpass filters for input diffusion, followed by a figure of 8 reverb tank of allpasses, low-pass filters, and delays. The output is taken from multiple taps in the delay lines to get a desirable echo density.

Parameters:
predelayfloat, optional

The delay applied to the wet channel in ms.

max_predelayfloat, optional

The maximum predelay in ms.

Attributes:
dsp_blockaudio_dsp.dsp.reverb.reverb_plate_stereo

The DSP block class; see Reverb Plate Stereo for implementation details.

set_bandwidth(bandwidth)

Set the bandwidth of the plate reverb stage. This sets the low pass cutoff frequency of the reverb input. Higher values will give a higher cutoff frequency.

Parameters:
bandwidthfloat

The bandwidth of the plate input signal, between 0 and 1.

set_damping(damping)

Set the damping of the plate reverb stage. This controls how much high frequency attenuation is in the plate. Higher values yield shorter reverberation times at high frequencies.

Parameters:
dampingfloat

How much high frequency attenuation in the plate, between 0 and 1.

set_decay(decay)

Set the decay of the plate reverb stage. This sets how reverberant the plate is. Higher values will give a longer reverberation time.

Parameters:
decayfloat

How long the reverberation of the plate is, between 0 and 1.

set_dry_gain(gain_dB)

Set the dry gain of the reverb room stage. This sets the level of the unprocessed signal.

Parameters:
gain_dbfloat

Dry gain in dB, less than 0 dB.

set_early_diffusion(diffusion)

Set the early diffusion of the plate reverb stage. This sets how much diffusion is present in the first part of the reverberation. Higher values will give more diffusion.

Parameters:
diffusionfloat

How diffuse the plate is, between 0 and 1.

set_late_diffusion(diffusion)

Set the late diffusion of the plate reverb stage. This sets how much diffusion is present in the latter part of the reverberation. Higher values will give more diffusion.

Parameters:
diffusionfloat

How diffuse the plate is, between 0 and 1.

set_pre_gain(pre_gain)

Set the pre gain of the reverb room stage.

Parameters:
pre_gainfloat

Pre gain value. Must be less than 1.

set_predelay(predelay)

Set the predelay of the wet channel.

Parameters:
predelayfloat

Predelay in ms, less than max_predelay.

set_wet_dry_mix(mix)

Set the wet/dry gains so that the mix of 0 results in a fully dry output, the mix of 1 results in a fully wet output.

Parameters:
mixfloat

The wet/dry mix, must be [0, 1].

set_wet_gain(gain_dB)

Set the wet gain of the reverb room stage. This sets the level of the reverberated signal.

Parameters:
gain_dbfloat

Wet gain in dB, less than 0 dB.

set_width(width)

Set the decay of the reverb room stage. This sets how reverberant the room is. Higher values will give a longer reverberation time for a given room size.

Parameters:
widthfloat

How much stereo separation between the channels. A width of 0 indicates no stereo separation (i.e. mono). A width of 1 indicates maximum stereo separation.

ReverbPlateStereo Control#

The following runtime command ids are available for the ReverbPlateStereo Stage. For details on reading and writing these commands, see the Run-Time Control User Guide.

Control parameter

Payload length

CMD_REVERB_PLATE_STEREO_DECAY

sizeof(int32_t)

The amount of decay in the plate in Q0.31 format. To convert a decay value between 0 and 1 to an int32_t control value, use the function adsp_reverb_float2int() in control/reverb.h.


CMD_REVERB_PLATE_STEREO_DAMPING

sizeof(int32_t)

The amount of high frequency attenuation in Q0.31 format. To convert a damping value between 0 and 1 to an int32_t control value, use the function adsp_reverb_plate_calc_damping() in control/reverb.h.


CMD_REVERB_PLATE_STEREO_EARLY_DIFFUSION

sizeof(int32_t)

The amount of diffusion in the early part of the reverb. To convert a diffusion value between 0 and 1 to an int32_t control value, use the function adsp_reverb_float2int() in control/reverb.h.


CMD_REVERB_PLATE_STEREO_LATE_DIFFUSION

sizeof(int32_t)

The amount of diffusion in the late part of the reverb. To convert a diffusion value between 0 and 1 to an int32_t control value, use the function adsp_reverb_plate_calc_late_diffusion() in control/reverb_plate.h.


CMD_REVERB_PLATE_STEREO_BANDWIDTH

sizeof(int32_t)

The input low pass coefficient in Q0.31 format. A bandwidth in Hertz can be converted to an int32_t control value using the function adsp_reverb_plate_calc_bandwidth() in control/reverb_plate.h.


CMD_REVERB_PLATE_STEREO_WET_GAIN1

sizeof(int32_t)

Gain applied to the wet signal in Q0.31 format. To calculate the wet gains based on a level in dB and a stereo width, use the function adsp_reverb_room_st_calc_wet_gains() in control/reverb.h. Alternatively, wet and dry gains can be calculated using a wet/dry ratio with the function adsp_reverb_st_wet_dry_mix().


CMD_REVERB_PLATE_STEREO_WET_GAIN2

sizeof(int32_t)

Gain applied to the wet signal in Q0.31 format. To calculate the wet gains based on a level in dB and a stereo width, use the function adsp_reverb_room_st_calc_wet_gains() in control/reverb.h. Alternatively, wet and dry gains can be calculated using a wet/dry ratio with the function adsp_reverb_st_wet_dry_mix().


CMD_REVERB_PLATE_STEREO_DRY_GAIN

sizeof(int32_t)

Gain applied to the dry signal in Q0.31 format. To calculate the dry gain based on a level in dB, use the function adsp_reverb_db2int() in control/reverb.h. Alternatively, wet and dry gains can be calculated using a wet/dry ratio with the function adsp_reverb_st_wet_dry_mix().


CMD_REVERB_PLATE_STEREO_PREGAIN

sizeof(int32_t)

The pregain applied to the signal before the reverb. Changing this value is only required if saturation occurs in the reverb tank. To convert a linear gain value to an int32_t control value, use the function adsp_reverb_float2int() in control/reverb.h.


CMD_REVERB_PLATE_STEREO_PREDELAY

sizeof(uint32_t)

The wet channel predelay value in samples. To convert a value in other units of time to samples, use time_to_samples() in control/signal_chain.h. Note the minimum delay provided by this stage is 1 sample. Setting the delay to 0 will still yield a 1 sample delay.