Attenuation curves describe how the direct sound of a source is attenuated depending on its distance to the listener. You can create several of them, e.g. one for the narrator, one for effect sounds, one for ambiences...
Sources are assigned to the first (index 0) attenuation curve per default, so it's often handy to treat tis curve as a global one.
Accessing, tweaking, assigning to sources
AttenuationCurve instances are members of the renderer
Renderer.attenuationCurves, that's where you can tweak their parameters. And sources can be assigned to them using
Check out the
AttenuationCurve class for a rough visualization of the parameters (and see the tip below for a even nicer visualization).
// define curve parameters
const attenuationCurves = renderer.attenuationCurves;
attenuationCurves.setParameters(0, -2.47, 2.06, -2.75, 19.31, -38.93, 25.36);
attenuationCurves.setParameters(2.5, -15.79, 4.66, -13.27, 8.98, -23.16, 41.16);
let narrator: Source
let riverSoundA: Source
let riverSoundB: Source
// init sources ... //
// assign attenuation curves
Making things more fun
Hardcoding new parameters, compiling the source code, testing, changing the values, again ... this is cumbersome. Our thought as well!
That's why we've created the Attenuation Curve Designer dev-tool. It opens as a popup window and displays all attenuation curves and their assigned sources. All parameters can be adjusted in real-time. Once you've nailed things, simply copy the exported code block and paste it into your project!