Skip to content
Back to top

# 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

C API

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

Python API

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:
    fs int

      Sampling frequency in Hz.

    n_chans int

      Number of channels the block runs on.

    max_room_size float, optional

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

    room_size float, 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.

    decay int, optional

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

    damping float, optional

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

    wet_gain_db int, optional

      wet signal gain, less than 0 dB.

    dry_gain_db int, optional

      dry signal gain, less than 0 dB.

    pregain float, 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.

    predelay float, optional

      the delay applied to the wet channel in ms.

    max_predelay float, 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:
    fs int

      Sampling frequency in Hz.

    n_chans int

      Number of channels the block runs on.

    Q_sig: int

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

    `pregain` float

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

    pregain_int int

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

    `wet_db` float

      The gain applied to the wet signal in dB.

    `wet` float

      The linear gain applied to the wet signal.

    wet_int int

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

    `dry` float

      The linear gain applied to the dry signal.

    `dry_db` float

      The gain applied to the dry signal in dB.

    dry_int int

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

    predelay float
    comb_lengths np.ndarray

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

    ap_length np.ndarray

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

    combs list

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

    allpasses list

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

    `room_size` float

      The room size as a proportion of the max_room_size.

    `decay` float

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

    `feedback` float

      Gain of the feedback line in the reverb filters.

    feedback_int int

      feedback as a fixed point integer.

    `damping` float

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

    damping_int int

      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:
      sample float

        The input sample to be processed.

      channel int, 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:
      mix float

        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_gain float

        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_db float

        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_db float

        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:
      decay float

        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:
      damping float

        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_size 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.

## 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

C API

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

Python API

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:
    fs int

      Sampling frequency in Hz.

    n_chans int

      Number of channels the block runs on.

    max_room_size float, optional

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

    room_size float, 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.

    decay int, optional

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

    damping float, optional

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

    width float, 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_db int, optional

      wet signal gain, less than 0 dB.

    dry_gain_db int, optional

      dry signal gain, less than 0 dB.

    pregain float, 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.

    predelay float, optional

      the delay applied to the wet channel in ms.

    max_predelay float, 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:
    fs int

      Sampling frequency in Hz.

    n_chans int

      Number of channels the block runs on.

    Q_sig: int

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

    `pregain` float

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

    pregain_int int

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

    `wet_db` float

      The gain applied to the wet signal in dB.

    `wet` float

      The linear gain applied to the wet signal.

    wet_int int

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

    `dry` float

      The linear gain applied to the dry signal.

    `dry_db` float

      The gain applied to the dry signal in dB.

    dry_int int

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

    predelay float
    `width` float

      Stereo separation of the reverberated signal.

    comb_lengths np.ndarray

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

    ap_length np.ndarray

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

    combs list

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

    allpasses list

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

    `room_size` float

      The room size as a proportion of the max_room_size.

    `decay` float

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

    `feedback` float

      Gain of the feedback line in the reverb filters.

    feedback_int int

      feedback as a fixed point integer.

    `damping` float

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

    damping_int int

      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:
      sample float

        The input sample to be processed.

      channel int, 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:
      mix float

        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

C API

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

Python API

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:
    fs int

      Sampling frequency in Hz.

    n_chans int

      Number of channels the block runs on.

    decay int, optional

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

    damping float, optional

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

    bandwidth float, optional

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

    early_diffusion float, optional

      Controls how much diffusion the early echoes have.

    late_diffusion float, optional

      Controls how much diffusion the late echoes have.

    width float, 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_db int, optional

      wet signal gain, less than 0 dB.

    dry_gain_db int, optional

      dry signal gain, less than 0 dB.

    pregain float, 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.

    predelay float, optional

      the delay applied to the wet channel in ms.

    max_predelay float, 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:
    fs int

      Sampling frequency in Hz.

    n_chans int

      Number of channels the block runs on.

    Q_sig: int

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

    `pregain` float

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

    pregain_int int

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

    `wet_db` float

      The gain applied to the wet signal in dB.

    `wet` float

      The linear gain applied to the wet signal.

    wet_int int

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

    `dry` float

      The linear gain applied to the dry signal.

    `dry_db` float

      The gain applied to the dry signal in dB.

    dry_int int

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

    predelay float
    `width` float

      Stereo separation of the reverberated signal.

    allpasses list

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

    lowpasses list

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

    delays list

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

    mod_allpasses list

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

    taps_l list

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

    taps_r list

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

    tap_lens_l list

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

    tap_lens_r list

      As tap lens_l, but for the right output channel.

    `decay` float

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

    decay_int int

      decay as a fixed point integer.

    `damping` float

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

    damping_int int

      damping as a fixed point integer.

    `bandwidth` float

      The bandwidth of the reverb input signal, in Hertz.

    `early_diffusion` float

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

    `late_diffusion` float

      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:
      sample float

        The input sample to be processed.

      channel int, 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:
      mix float

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