Reverb#

Reverb Room#

The room reverb module imitates the reflections of a room. The algorithm is a Schroeder style reverberation, based on Freeverb by Jezar at Dreampoint. It consists of the wet predelay, 8 parallel comb filters fed into 4 series all-pass filters, with a wet and dry microphone control to set the effect level.

For more details on the algorithm, see Physical Audio Signal Processing by Julius Smith.

struct reverb_room_t#

A room reverb filter structure.

Public Members

uint32_t total_buffer_length#

Total buffer length

float room_size#

Room size

int32_t wet_gain#

Wet linear gain

int32_t dry_gain#

Dry linear gain

int32_t pre_gain#

Linear pre-gain

comb_fv_t combs[ADSP_RVR_N_COMBS]#

Comb filters

allpass_fv_t allpasses[ADSP_RVR_N_APS]#

Allpass filters

delay_t predelay#

Predelay applied to the wet channel

int32_t adsp_reverb_room(reverb_room_t *rv, int32_t new_samp)#

Process a sample through a reverb room object.

Parameters:
  • rv – Reverb room object

  • new_samp – New sample to process

Returns:

int32_t Processed sample

class audio_dsp.dsp.reverb.reverb_room(fs, n_chans, max_room_size=1, room_size=1, decay=0.5, damping=0.4, wet_gain_db=-1, dry_gain_db=-1, pregain=0.015, predelay=10, max_predelay=None, Q_sig=27)

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

Parameters:
fsint

Sampling frequency in Hz.

n_chansint

Number of channels the block runs on.

max_room_sizefloat, optional

sets the maximum size of the delay buffers, can only be set at initialisation.

room_sizefloat, optional

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

decayint, optional

The length of the reverberation of the room, between 0 and 1.

dampingfloat, optional

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

wet_gain_dbint, optional

wet signal gain, less than 0 dB.

dry_gain_dbint, optional

dry signal gain, less than 0 dB.

pregainfloat, optional

the amount of gain applied to the signal before being passed into the reverb, less than 1. If the reverb raises an OverflowWarning, this value should be reduced until it does not. The default value of 0.015 should be sufficient for most Q27 signals.

predelayfloat, optional

the delay applied to the wet channel in ms.

max_predelayfloat, optional

the maximum predelay in ms.

Q_sig: int, optional

Q format of the signal, number of bits after the decimal point. Defaults to Q4.27.

Attributes:
fsint

Sampling frequency in Hz.

n_chansint

Number of channels the block runs on.

Q_sig: int

Q format of the signal, number of bits after the decimal point.

pregainfloat

The pregain applied before the reverb as a floating point number.

pregain_intint

The pregain applied before the reverb as a fixed point number.

wet_dbfloat

The gain applied to the wet signal in dB.

wetfloat

The linear gain applied to the wet signal.

wet_intint

The linear gain applied to the wet signal as a fixed point number.

dryfloat

The linear gain applied to the dry signal.

dry_dbfloat

The gain applied to the dry signal in dB.

dry_intint

The linear gain applied to the dry signal as a fixed point number.

predelayfloat
comb_lengthsnp.ndarray

An array of the comb filter delay line lengths, scaled by max_room_size.

ap_lengthnp.ndarray

An array of the all pass filter delay line lengths, scaled by max_room_size.

combslist

A list of comb_fv objects containing the comb filters for the reverb.

allpasseslist

A list of allpass_fv objects containing the all pass filters for the reverb.

room_sizefloat

The room size as a proportion of the max_room_size.

decayfloat

The length of the reverberation of the room, between 0 and 1.

feedbackfloat

Gain of the feedback line in the reverb filters.

feedback_intint

feedback as a fixed point integer.

dampingfloat

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

damping_intint

damping as a fixed point integer.

process(sample, channel=0)

Add reverberation to a signal, using floating point maths.

Take one new sample and return the sample with reverb. Input should be scaled with 0 dB = 1.0.

Parameters:
samplefloat

The input sample to be processed.

channelint, optional

The channel index to process the sample on. Default is 0.

Returns:
float

The processed sample.

reset_state()

Reset all the delay line values to zero.

set_wet_dry_mix(mix)

Will mix wet and dry signal by adjusting wet and dry gains. So that when the mix is 0, the output signal is fully dry, when 1, the output signal is fully wet. Tries to maintain a stable signal level using -4.5 dB Pan Law.

Parameters:
mixfloat

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

set_pre_gain(pre_gain)

Deprecated since version 1.0.0: set_pre_gain will be removed in 2.0.0. Replace reverb_room.set_pre_gain(x) with reverb_room.pregain = x

Set the pre gain.

Parameters:
pre_gainfloat

pre gain value, less than 1.

set_wet_gain(wet_gain_db)

Deprecated since version 1.0.0: set_wet_gain will be removed in 2.0.0. Replace reverb_room.set_wet_gain(x) with reverb_room.wet_db = x

Set the wet gain.

Parameters:
wet_gain_dbfloat

Wet gain in dB, less than 0 dB.

set_dry_gain(dry_gain_db)

Deprecated since version 1.0.0: set_dry_gain will be removed in 2.0.0. Replace reverb_room.set_dry_gain(x) with reverb_room.dry_db = x

Set the dry gain.

Parameters:
dry_gain_dbfloat

Dry gain in dB, lees than 0 dB.

set_decay(decay)

Deprecated since version 1.0.0: set_decay will be removed in 2.0.0. Replace reverb_room.set_decay(x) with reverb_room.decay = x

Set the decay of the reverb.

Parameters:
decayfloat

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

set_damping(damping)

Deprecated since version 1.0.0: set_damping will be removed in 2.0.0. Replace reverb_room.set_damping(x) with reverb_room.damping = x

Set the damping of the reverb.

Parameters:
dampingfloat

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

set_room_size(room_size)

Deprecated since version 1.0.0: set_room_size will be removed in 2.0.0. Replace reverb_room.set_room_size(x) with reverb_room.room_size = x

Set the current room size; will adjust the delay line lengths accordingly.

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

Reverb Room Stereo#

The stereo room reverb module extends the mono Reverb Room by adding a second set of comb and all-pass filters in parallel, and mixing the output of the two networks. Varying the mix of the networks changes the stereo width of the effect.

For more details on the algorithm, see Physical Audio Signal Processing by Julius Smith.

struct reverb_room_st_t#

A stereo room reverb filter structure.

Public Members

uint32_t total_buffer_length#

Total buffer length

uint32_t spread_length#

Spread length

float room_size#

Room size

int32_t wet_gain1#

Wet 1 linear gain

int32_t wet_gain2#

Wet 2 linear gain

int32_t dry_gain#

Dry linear gain

int32_t pre_gain#

Linear pre-gain

comb_fv_t combs[2][ADSP_RVR_N_COMBS]#

Comb filters, 0:left, 1:right

allpass_fv_t allpasses[2][ADSP_RVR_N_APS]#

Allpass filters, 0:left, 1:right

delay_t predelay#

Predelay applied to the wet channel

void adsp_reverb_room_st(reverb_room_st_t *rv, int32_t outputs_lr[2], int32_t in_left, int32_t in_right)#

Process samples through a stereo reverb room object.

Parameters:
  • rv – Stereo reverb room object

  • outputs_lr – Pointer to the outputs 0:left, 1:right

  • in_left – New left sample to process

  • in_right – New right sample to process

class audio_dsp.dsp.reverb_stereo.reverb_room_stereo(fs, n_chans, max_room_size=1, room_size=1, decay=0.5, damping=0.4, width=1.0, wet_gain_db=-1, dry_gain_db=-1, pregain=0.0075, predelay=10, max_predelay=None, Q_sig=27)

Generate a stereo room reverb effect. 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:
fsint

Sampling frequency in Hz.

n_chansint

Number of channels the block runs on.

max_room_sizefloat, optional

sets the maximum size of the delay buffers, can only be set at initialisation.

room_sizefloat, optional

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

decayint, optional

The length of the reverberation of the room, between 0 and 1.

dampingfloat, optional

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

widthfloat, optional

how much stereo separation there is between the left and right channels. Setting width to 0 will yield a mono signal, whilst setting width to 1 will yield the most stereo separation.

wet_gain_dbint, optional

wet signal gain, less than 0 dB.

dry_gain_dbint, optional

dry signal gain, less than 0 dB.

pregainfloat, optional

the amount of gain applied to the signal before being passed into the reverb, less than 1. If the reverb raises an OverflowWarning, this value should be reduced until it does not. The default value of 0.015 should be sufficient for most Q27 signals.

predelayfloat, optional

the delay applied to the wet channel in ms.

max_predelayfloat, optional

the maximum predelay in ms.

Q_sig: int, optional

Q format of the signal, number of bits after the decimal point. Defaults to Q4.27.

Attributes:
fsint

Sampling frequency in Hz.

n_chansint

Number of channels the block runs on.

Q_sig: int

Q format of the signal, number of bits after the decimal point.

pregainfloat

The pregain applied before the reverb as a floating point number.

pregain_intint

The pregain applied before the reverb as a fixed point number.

wet_dbfloat

The gain applied to the wet signal in dB.

wetfloat

The linear gain applied to the wet signal.

wet_intint

The linear gain applied to the wet signal as a fixed point number.

dryfloat

The linear gain applied to the dry signal.

dry_dbfloat

The gain applied to the dry signal in dB.

dry_intint

The linear gain applied to the dry signal as a fixed point number.

predelayfloat
widthfloat

Stereo separation of the reverberated signal.

comb_lengthsnp.ndarray

An array of the comb filter delay line lengths, scaled by max_room_size.

ap_lengthnp.ndarray

An array of the all pass filter delay line lengths, scaled by max_room_size.

combslist

A list of comb_fv objects containing the comb filters for the reverb.

allpasseslist

A list of allpass_fv objects containing the all pass filters for the reverb.

room_sizefloat

The room size as a proportion of the max_room_size.

decayfloat

The length of the reverberation of the room, between 0 and 1.

feedbackfloat

Gain of the feedback line in the reverb filters.

feedback_intint

feedback as a fixed point integer.

dampingfloat

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

damping_intint

damping as a fixed point integer.

process(sample, channel=0)

Process is not implemented for the stereo reverb, as it needs 2 channels at once.

Parameters:
samplefloat

The input sample to be processed.

channelint, optional

The channel index to process the sample on. Default is 0.

Returns:
float

The processed sample.

reset_state()

Reset all the delay line values to zero.

set_wet_dry_mix(mix)

Will mix wet and dry signal by adjusting wet and dry gains. So that when the mix is 0, the output signal is fully dry, when 1, the output signal is fully wet. Tries to maintain a stable signal level using -4.5 dB Pan Law.

Parameters:
mixfloat

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

property wet_db

The gain applied to the wet signal in dB.

property dry_db

The gain applied to the dry signal in dB.

property decay

The length of the reverberation of the room, between 0 and 1.

property damping

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

Reverb Plate Stereo#

The plate reverb module imitates the reflections of a plate reverb, which has more early reflections than the room reverb. The algorithm 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. The left and right output can be mixed with various widths.

For more details on the algorithm, see Effect Design, Part 1: Reverberator and Other Filters by Jon Dattorro.

struct reverb_plate_t#

A plate reverb structure.

Public Members

int32_t decay#

Reverb decay

int32_t wet_gain1#

Wet 1 linear gain

int32_t wet_gain2#

Wet 2 linear gain

int32_t dry_gain#

Dry linear gain

int32_t pre_gain#

Linear pre-gain

int32_t paths[ADSP_RVP_N_PATHS]#

Saved output paths

int32_t taps_l[ADSP_RVP_N_OUT_TAPS]#

Indexes for the left channel calculation

int32_t taps_len_l[ADSP_RVP_N_OUT_TAPS]#

Max lenghts of buffers use for the left channel calculation

int32_t taps_r[ADSP_RVP_N_OUT_TAPS]#

Indexes for the right channel calculation

int32_t taps_len_r[ADSP_RVP_N_OUT_TAPS]#

Max lenghts of buffers use for the right channel calculation

lowpass_1ord_t lowpasses[ADSP_RVP_N_LPS]#

FIrst order lowpass filters

allpass_fv_t mod_allpasses[ADSP_RVP_N_PATHS]#

Modulated allpass filters

allpass_fv_t allpasses[ADSP_RVP_N_APS]#

Allpass filters

delay_t delays[ADSP_RVP_N_DELAYS]#

Delay lines

delay_t predelay#

Predelay applied to the wet channel

void adsp_reverb_plate(reverb_plate_t *rv, int32_t outputs_lr[2], int32_t in_left, int32_t in_right)#

Process samples through a reverb plate object.

Parameters:
  • rv – Reverb plate object

  • outputs_lr – Pointer to the outputs 0:left, 1:right

  • in_left – New left sample to process

  • in_right – New right sample to process

class audio_dsp.dsp.reverb_plate.reverb_plate_stereo(fs, n_chans, decay=0.4, damping=0.75, bandwidth=8000, early_diffusion=0.75, late_diffusion=0.7, width=1.0, wet_gain_db=-3, dry_gain_db=-3, pregain=0.5, predelay=10, max_predelay=None, Q_sig=27)

Generate a stereo plate reverb effect, 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:
fsint

Sampling frequency in Hz.

n_chansint

Number of channels the block runs on.

decayint, optional

The length of the reverberation of the room, between 0 and 1.

dampingfloat, optional

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

bandwidthfloat, optional

Controls the low pass filter cutoff frequency at the start of the reverb, in Hz.

early_diffusionfloat, optional

Controls how much diffusion the early echoes have.

late_diffusionfloat, optional

Controls how much diffusion the late echoes have.

widthfloat, optional

how much stereo separation there is between the left and right channels. Setting width to 0 will yield a mono signal, whilst setting width to 1 will yield the most stereo separation.

wet_gain_dbint, optional

wet signal gain, less than 0 dB.

dry_gain_dbint, optional

dry signal gain, less than 0 dB.

pregainfloat, optional

the amount of gain applied to the signal before being passed into the reverb, less than 1. If the reverb raises an OverflowWarning, this value should be reduced until it does not. The default value of 0.5 should be sufficient for most Q27 signals, and should be reduced by 1 bit per increase in Q format, e.g. 0.25 for Q28, 0.125 for Q29 etc.

predelayfloat, optional

the delay applied to the wet channel in ms.

max_predelayfloat, optional

the maximum predelay in ms.

Q_sig: int, optional

Q format of the signal, number of bits after the decimal point. Defaults to Q4.27.

Attributes:
fsint

Sampling frequency in Hz.

n_chansint

Number of channels the block runs on.

Q_sig: int

Q format of the signal, number of bits after the decimal point.

pregainfloat

The pregain applied before the reverb as a floating point number.

pregain_intint

The pregain applied before the reverb as a fixed point number.

wet_dbfloat

The gain applied to the wet signal in dB.

wetfloat

The linear gain applied to the wet signal.

wet_intint

The linear gain applied to the wet signal as a fixed point number.

dryfloat

The linear gain applied to the dry signal.

dry_dbfloat

The gain applied to the dry signal in dB.

dry_intint

The linear gain applied to the dry signal as a fixed point number.

predelayfloat
widthfloat

Stereo separation of the reverberated signal.

allpasseslist

A list of allpass objects containing the all pass filters for the reverb.

lowpasseslist

A list of lowpass objects containing the low pass filters for the reverb.

delayslist

A list of delay objects containing the delay lines for the reverb.

mod_allpasseslist

A list of allpass objects containing the modulated all pass objects for the reverb.

taps_llist

A list of the current output tap locations for the left output.

taps_rlist

A list of the current output tap locations for the right output.

tap_lens_llist

A list of the buffer lengths used by taps_l, to aid wrapping the read head at the end of the buffer

tap_lens_rlist

As tap lens_l, but for the right output channel.

decayfloat

The length of the reverberation of the room, between 0 and 1.

decay_intint

decay as a fixed point integer.

dampingfloat

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

damping_intint

damping as a fixed point integer.

bandwidthfloat

The bandwidth of the reverb input signal, in Hertz.

early_diffusionfloat

How much early diffusion in the reverb, between 0 and 1.

late_diffusionfloat

How much late diffusion in the reverb, between 0 and 1.

process(sample, channel=0)

Process is not implemented for the stereo reverb, as it needs 2 channels at once.

Parameters:
samplefloat

The input sample to be processed.

channelint, optional

The channel index to process the sample on. Default is 0.

Returns:
float

The processed sample.

reset_state()

Reset all the delay line values to zero.

set_wet_dry_mix(mix)

Will mix wet and dry signal by adjusting wet and dry gains. So that when the mix is 0, the output signal is fully dry, when 1, the output signal is fully wet. Tries to maintain a stable signal level using -4.5 dB Pan Law.

Parameters:
mixfloat

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