@maruaudio/dsp/acoustics/room-convolver convolves live audio with a simulated room impulse response of up to 3 s for one or two microphones and one or two sources, and mixes dry and wet. It owns no convolution arithmetic: it composes @maru/filters-partitioned-convolution in its two-stage zero-latency layout (a 128-tap head, 128-frame partitions and a 2048-frame tail, 4096 above 64 kHz). It owns the double-banked IR buffer a budgeted RIR assembly writes, and swaps responses with a 50 ms equal-power crossfade.
Parameters
| Call | Accepts | Default |
|---|---|---|
initRoomConvolver(rate, maxMics, maxIrSeconds, maxSources) | Mics and sources 1 or 2; seconds clamped to (0, 3]; a rate below 1 becomes 48 kHz | 1 source; silent, dry 1, wet 1 |
setRoomConvolverMix(dry, wet) | Linear targets, followed per sample by a 5 ms one-pole; NaN becomes 0 | 1, 1 |
setRoomConvolverInputMode(mode) | ROOM_CONVOLVER_INPUT_MEAN, (L + R) / 2, or INPUT_POWER, (L + R) / √2 | mean |
submitRoomConvolverBank(bank, frames, mics, gain) | Frames clamped to the capacity; refused for the bank being prepared | none |
Lifecycle
initRoomConvolver allocates everything → claimRoomConvolverBank (never the bank being prepared from), write the IR at roomConvolverBankOffset, submitRoomConvolverBank → once per render quantum stepRoomConvolver(maxPartitions), which begins the newest submission, transforms a partition budget per convolver and commits both together → processRoomConvolverBlock. resetRoomConvolver clears audio history and keeps the loaded responses; clearRoomConvolver discards them too.
When to use it
The convolution half of a simulated room: a module recomputes the response a budget at a time and hands each finished one here, crossfaded while audio plays.
Limits
- Zero latency, so the dry path needs no compensation. Output is stereo, mic 0 left and mic 1 right; a one-mic IR feeds both sides and a mono output takes the wet pair's mean. With two sources each input drives its own pair; one submitted source loads both at half gain.
- A swap starts at the second tail boundary (at most 2T frames). A newer submission restarts a preparation but waits during a swap or crossfade.
- Rate clamped to at most 768 kHz; buffer offsets are the caller's contract.