Build with this node

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

Ask Studio

@maruaudio/dsp/acoustics/ray-tracer traces rays from a source around a rectangular room and records the energy that reaches each microphone, ported from pyroomacoustics' libroom ray tracer. Each ray loses energy to per-band wall absorption, may scatter towards the receivers, and deposits energy into histograms of 4 ms distance bins, by receiver and band, and, for directional receivers, by arrival direction over 720 directions. These histograms shape the diffuse tail that @maru/acoustics-rt-tail synthesises.

Parameters

createRayTracerParams returns the record beginRayTracer latches.

FieldAcceptsDefault
room, source, micsPositive room sides below 1e6 m; source and mics inside1 mic
nMics, nBands, nRaysFloored and clamped: 1 to 2, 1 to 9, 1 to 262,1441, 1, 1,024
absorption, scattering0 to 1 per wall and band0
pattern, orientationReceiver cardioid-family p 0 to 1 and orientationomni, +x
order, hybridIn hybrid mode receiver hits count only from bounce order on3, on
speed, seconds, radius, binSeconds, threshold, seedPositive below 1e6; threshold in (0, 1]343 m/s, 3 s, 0.5 m, 4 ms, 1e-7, 258

Invalid geometry or coefficients leave a silent, finished result.

Lifecycle

createRayTracer(maxBins) allocates fixed histograms (1 to 2,500 bins) → beginRayTracer(params) latches and clears → stepRayTracer(budget) until ready. A work unit is one ray segment with its scattering connections, or a 1,024-entry clear of the direction histogram.

When to use it

The diffuse part of a hybrid room simulation, after its image sources.

Limits

  • Shoebox rooms only. A seeded xorshift32 replaces upstream's mt19937, so results are deterministic and budget-invariant but not bit-identical to upstream's; storage is bounded where upstream grows.

Algorithm properties and proofs

No Lean 4 proof is mapped to this node.

Explore proofs alongside performance

Dependencies

Dependents

Used by