@maruaudio/dsp/acoustics/rir-assembly builds a shoebox room's impulse response for one or two microphones a budget at a time: the realtime form of pyroomacoustics' Room.compute_rir, with no arithmetic beyond the glue. It enumerates images, adds each band's fractional-delay train, weights the bands, optionally adds a ray-traced diffuse tail, and applies the 10 Hz zero-phase high-pass, writing each finished IR into a caller-owned bank.
Parameters
createRirAssemblyParams returns the record beginRirAssembly latches.
| Field | Accepts | Default |
|---|---|---|
roomSize, source, mics, nMics | Metres; 1 or 2 microphones; the source inside the room | 1 mic |
micP, micGain, micOrientation | Cardioid-family p (1 omni), gain, unit vector | omni, 1, +x |
nBands, absorption, scattering | 1 band or the layout's count; per wall and band | 1 band |
airAbsorption, airCoefficients, speedOfSound | Air per band, m/s | off, 343 m/s |
maxOrder | Clamped to 17 and reported | 1 |
hpf, mode, directGain | High-pass on or off; FIR or exact; direct-path gain | on, FIR, 1 |
hybrid, nRays, seed, tailSeconds, receiverRadius | Ray-traced tail | off, 1,024, 258, 3 s, 0.5 m |
Lifecycle
createRirAssembly(maxIrFrames, maxBands, maxMics, maxExactFrames) allocates → setRirAssemblyRate(fs) in prepare (allocates one high-pass record; refuses rates above 192 kHz) → beginRirAssembly at any time, latching a snapshot and abandoning the job in flight → stepRirAssembly(budget, out) per quantum through its phases → takeRirAssemblyResult at READY. Any budget sequence gives a bit-identical result.
When to use it
Recomputing a simulated room while a player moves its walls, materials or microphones, handing each result to @maru/acoustics-room-convolver.
Limits
- Budgets are work units, not time: a step costs at most
max(budget, rirAssemblyMaxUnitCost). IRs are cut at 3 s and capacity (truncated). - FIR mode is about −59 dB from exact, which is for offline parity. Errors are status codes; an outside microphone gives a silent IR; no source directivity.