@maruaudio/dsp/acoustics/rt-tail synthesises the late, diffuse part of a simulated room's response from the energy histograms of @maru/acoustics-ray-tracer, ported from pyroomacoustics' simulation/rt.py. It draws a seeded Poisson sequence of reflections at rate 4πc³t²/V (capped at 10,000 per second), weights it per band with the shared Antoni FIRs of @maru/acoustics-octave-bands and each band's histogram envelope, optionally applies air absorption, and writes one microphone's padded tail to caller storage; directional receivers draw arrival directions from the histogram.
Parameters
beginRtTail(state, rays, mic, fs, seed, air, useAir, capFrames) returns false and leaves no frames unless:
| Argument | Accepts |
|---|---|
rays | A finished ray tracer (ready) whose bins fit this state |
mic | An integer microphone index the ray tracer traced |
fs | Above 0 and at most 96 kHz |
air, useAir | Nine finite, non-negative air coefficients; applied when useAir |
capFrames | 81 up to the state's frame capacity |
Lifecycle
createRtTail(maxFrames, maxBins) allocates (81 to 524,288 frames, 1 to 2,500 bins) → beginRtTail → stepRtTail(rays, fir, budget, out) until rtTailReady; a bad buffer or unfinished FIR ends it with −1. Budget splits do not change the response.
When to use it
Completing a hybrid room simulation: image sources give the early reflections, this the dense tail.
Limits
- The tail is cropped to the capacity minus 40 frames of padding without compressing its timeline;
truncatedreports a crop. Clearing is spread across steps. - A seeded xorshift32 replaces upstream's generator: deterministic, not upstream's.