Build with this node

Start with a prompt in Studio, or copy it into your own coding agent.

Ask Studio

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

FieldAcceptsDefault
roomSize, source, mics, nMicsMetres; 1 or 2 microphones; the source inside the room1 mic
micP, micGain, micOrientationCardioid-family p (1 omni), gain, unit vectoromni, 1, +x
nBands, absorption, scattering1 band or the layout's count; per wall and band1 band
airAbsorption, airCoefficients, speedOfSoundAir per band, m/soff, 343 m/s
maxOrderClamped to 17 and reported1
hpf, mode, directGainHigh-pass on or off; FIR or exact; direct-path gainon, FIR, 1
hybrid, nRays, seed, tailSeconds, receiverRadiusRay-traced tailoff, 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.

Algorithm properties and proofs

No Lean 4 proof is mapped to this node.

Explore proofs alongside performance

Parameters

ParameterTypeSetter
Rir assembly rate rirAssemblyRate

Rate-dependent setup, for `prepare` on a rate change: the 10 Hz high-pass (allocates one small record through `initRirHighPass`), the Antoni layout (base 125 Hz, overlap 0.5, slope 0) and the FIR bank configuration (T = `octaveFirTapsForRate(fs)`, F = 2T). Kernels are designed later by budgeted DESIGN units. Abandons any job in flight. Returns a status: RIR_ASSEMBLY_OK, or RIR_ASSEMBLY_BAD_RATE when the rate is not finite and positive or the high-pass cannot be designed. A layout with more bands than the state holds leaves multi-band jobs unavailable (single-band still works).

floatsetRirAssemblyRate
Rir assembly layout rirAssemblyLayout

The non-allocating part of the rate setup (layout and FIR configuration), realtime-lowerable. `setRirAssemblyRate` calls it; it is exported for a consumer that re-designs the high-pass elsewhere.

floatsetRirAssemblyLayout

Dependencies

Dependents

No other node imports this one.

Used by