@maruaudio/dsp/acoustics/rt60 gives reverberation time two ways, ported from pyroomacoustics. In theory: rt60Sabine and rt60Eyring from wall area, volume, mean absorption, air attenuation and the speed of sound, and inverseSabine, which finds the single-material absorption and image-source order a shoebox room needs for a target RT60. Measured: measureRt60 integrates an impulse response backwards (Schroeder), converts the energy curve to dB, fits a least-squares line from the −5 dB point to the decay point and extrapolates the slope to −60 dB.
Parameters
| Argument | Accepts | Upstream default |
|---|---|---|
decayDb | Decay fitted, in dB; shortened when the curve does not reach it | 60 |
energyThres | Fraction of total energy fitted, in (0, 1] | 1 |
length | 0 to 4,194,304 samples of h | none |
Both fit arguments are required, because Maru compiler rejects an optional number.
Lifecycle
The theory functions and measureRt60 / measureRt60F32 are pure and write only the caller's energy scratch (at least length samples), which ends as the normalised dB curve. inverseSabine throws on a bad dimension count or an absorption above 1; inverseSabineStatus is its allocation-free form and returns 0, 1 or 2. For a budget per call: createRt60Measurement allocates → beginRt60Measurement → stepRt60Measurement(h, energy, budget) until it finishes, each unit one sample of one pass.
When to use it
Choosing wall absorption for a requested reverberation time, or reading back the RT60 or T30 of a rendered or measured room response.
Limits
- Log-domain fit only, accumulated in f64 even for
Float32Arrayinput; upstream's linear-domaincurve_fitis not ported. - Returns 0 when the curve never falls below −5 dB, for an empty or all-zero response, or when only the first sample has energy; NaN for invalid arguments. Eyring gives 0 at
a = 1and NaN above, as upstream.