Skip to content

Repairing Diffuse Reverb ​

masteringRepairDereverbClassical is for a sustained, diffuse tail that masks the direct sound. It uses STFT-domain spectral subtraction and can run an optional WPE pre-stage. It is an offline restoration pass, not room-impulse-response deconvolution and not a way to recover a perfectly dry source.

Terms on this page

  • Direct sound, early reflections, late tail: in a room, a listener first hears the sound that travels straight from the source, then a few distinct reflections from nearby surfaces, then a dense, diffuse decay (the late tail or reverb). Dereverb targets the late tail.
  • RT60: the time the late tail takes to decay by 60 dB, the usual measure of how reverberant a room is. See Reverberation Time.
  • Mixing time: the point after which reflections have blended into the diffuse tail; lateDelayMs marks it.
  • Spectral subtraction: estimating the tail's power in each STFT bin from the same bin one late delay earlier, decayed at the t60Sec rate, and subtracting it, as a denoiser subtracts noise.
  • WPE (weighted prediction error): an optional pre-stage that predicts the late reverberation of each bin from earlier frames and subtracts that prediction.
ROOM · IMPULSE RESPONSEIDLE
Impulse response — how a room decays

A room impulse response synthesized from shoebox dimensions, shown as its energy decay in dB. Enlarge the room or lower the absorption and the tail stretches — the RT60 (time to fall 60 dB) climbs with it. Press play to hear a clap in the room.

Room size
7 m
Absorption
0.16

Detect before dereverb ​

The detector reports the statistic used by the dereverberator. It does not calculate an RT60 by the standard room-measurement method (ISO 3382). Use estimateRoom (see Room Acoustics) when you need an equivalent-room estimate and inspect its confidence before using it to configure the repair.

ts
import {
  estimateRoom,
  init,
  masteringRepairDereverbClassical,
  masteringRepairDereverbConfigForRoom,
  masteringRepairDetectReverb,
} from '@libraz/libsonare';

await init();

const detection = masteringRepairDetectReverb({
  samples,
  sampleRate,
});
const estimate = estimateRoom(samples, sampleRate, { nOctaveBands: 6 });
console.log(detection.lateDecayRatioDb, detection.latePredictability);
console.log(estimate.confidence, estimate.rt60Bands, estimate.volume);

const config = masteringRepairDereverbConfigForRoom(estimate, {
  attenuation: 0.7,
});
const cleaned = masteringRepairDereverbClassical({
  samples,
  sampleRate,
  ...config,
});

The configForRoom call reads the room estimate and returns a complete dereverb configuration. Python spells it mastering_repair_dereverb_config_for_room. A real workflow still needs an audition: a low-confidence room estimate or a tail that is actually musical may not justify the pass.

What the room config changes ​

masteringRepairDereverbConfigForRoom reads only volume and rt60Bands from the estimateRoom result. It changes two timing parameters and leaves the amount of removal under your control.

OptionHow to use it
t60SecDerived from the mid-band RT60 estimate. If the relevant bands did not converge, the helper uses the documented fallback from the available bands. Accepted range (0, 10] seconds (default 0.4).
lateDelayMsDerived from the estimated volume as a mixing-time delay, which marks the late diffuse region. Accepted range [0, 500] ms (default 50).
attenuation, threshold, overSubtraction, spectralFloorKeep or override these amount and gate controls; they are not replaced by room geometry. threshold, attenuation, and spectralFloor are validated in the [0, 1] range, overSubtraction in [0, 16].
nFft, hopLengthSet the STFT window length and hop. See the constraints below.
wpeEnabled, wpeIterations, wpeTaps, wpeStrengthEnable and shape the optional WPE pre-stage. WPE analysis is otherwise off by default. wpeIterations is in [1, 16], wpeTaps in [1, 32], and wpeStrength in [0, 1].

The Room Acoustics page explains equivalent-room estimates, RT60 bands, and confidence. Its roomMorph effect adds a target-room character; it is a different operation from dereverberation.

nFft and hopLength follow the STFT rules shared by every repair stage. An input shorter than nFft is padded for analysis, but padding does not relax this validation.

When WPE is enabled, each STFT bin fits one complex predictor from delayed frames, pooled across all channels for linked input. Predictor coefficients are scaled down when the sum of their magnitudes (the L1 norm) exceeds 0.98, and each iteration subtracts the shared predictor from every channel, weighted by wpeStrength.

Keep channels linked ​

Use the stereo or linked entry point for multichannel material so one mask controls the set. The common spectral mask preserves interchannel level and phase relationships. When WPE is enabled, its shared predictor set is also fitted across the linked channels and applied to each one.

ts
import {
  masteringRepairDereverbClassicalLinked,
  masteringRepairDereverbClassicalStereo,
} from '@libraz/libsonare';

const stereo = masteringRepairDereverbClassicalStereo({
  left,
  right,
  sampleRate,
  attenuation: 0.7,
});

const linked = masteringRepairDereverbClassicalLinked({
  channels: [frontLeft, frontRight, center],
  sampleRate,
  attenuation: 0.7,
});
console.log(stereo.report.meanReductionDb, linked.report.suppressedFraction);

The dereverb detector and repair pad an input shorter than nFft for analysis. All channels in a stereo or linked call must have the same length. The report contains ratios and fractions, so its values do not acquire the channel-count offset of the denoise floor measurement.

Listen to a dereverb A/B ​

A/B PROCESS · DEREVERBIDLE
Restoration — a worn record, before and after

The piano clip contains hum, hiss, clicks and crackle. This example applies only the classical dereverberator, which attenuates diffuse sustained energy; it does not apply a dedicated declick or dehum stage. Compare the spectra and audition the result without added loudness matching. The processor can change musical tails and timbre as well as the noise bed. FLOOR shows the high-band reduction in dB.

Compare

This A/B applies only the classical dereverberator, with no declick, dehum, or denoise stage and no loudness matching. The pass can change tails and timbre.

Limits ​

The reverb detector is a module-specific late-decay and optional predictability measurement, not a room-acoustic standard. Dereverb attenuates diffuse sustained energy; it does not remove every early reflection, reconstruct a room impulse response, or separate overlapping sources. It can mistake a held note or other sustained musical material for a tail. Keep the untreated signal, compare at the same playback gain, and use the Audio Repair Workflow to place dereverb last after the other supported repairs.

For exact overloads and report fields, see the JavaScript mastering API.