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.

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.

predelayfloat

The delay applied to the wet channel in ms.

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.