Build with this node

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

Ask Studio

@maruaudio/dsp/acoustics/materials turns wall materials into per-band coefficients for a room simulation, ported from pyroomacoustics' Material. A material is an energy-absorption curve and a scattering curve, each given as a flat value, a database name (91 absorption and 8 scattering rows from @maru/acoustics-materials-table) or explicit coefficients with centre frequencies. materialResampleCurve maps a curve onto the simulation's octave-band centres by linear interpolation in log2 frequency, extrapolating past the ends and clipping to 0 to 1.

const m = createMaterial({ kind: "name", name: "brickwork" }, { kind: "flat", value: 0.1 })
materialAbsorptionBands(m, centres, out) // returns the band count written

Lifecycle

Control plane: materialAbsorptionIndex / materialScatteringIndex look up a row id (−1 when unknown); createMaterial, createMaterials and the createMaterial*Entry functions allocate and throw on an unknown name, duplicate centre frequencies or an invalid curve. Band writers (materialFillBands, materialResampleCurve, materialAbsorptionBands, materialScatteringBands) write into caller-owned arrays, never throw and allocate nothing, so a realtime path can call them on prepared materials.

When to use it

Giving each wall of a simulated room a surface such as brickwork or an audience, as the per-band absorption and scattering the room model reads.

Limits

  • Writers clamp to 64 bands and the output length, and return −1 for a curve they cannot resample: no coefficients, more than 64, or no centres and more coefficients than bands.
  • A single coefficient or a flat value is copied to every band without clipping, as upstream. A flat scattering takes the absorption's band list, and the reverse. Scattering defaults to flat 0.
  • Linear interpolation only; unsorted centres are sorted. Unlike upstream, resampling leaves the material unchanged and a scalar broadcasts. Table entries are views into constant tables; treat them as read-only.

Algorithm properties and proofs

No Lean 4 proof is mapped to this node.

Explore proofs alongside performance

Dependencies

Dependents

No other node imports this one.

Used by