atmoky Engage Server SDK is now available! Check out the documentation to learn more.
Going further
Distance Models

Distance Models

A DistanceModel defines how a gain factor is calculated based on a spatial distance. It ist paramerized by a set of data points, each consisting of a distance and a gain factor, as well as a value for the maximum distance. The gain factor is calculated by piecewiese linear interpolating between the data points, i.e.
|   \
|    \___C
|    B   \
|         \
|          \
|-----------\---> DISTANCE
When instantiating a Space, you can specify the number of different distance models to allocate:
let space = new Space({ numberOfDistanceModels: 2 });
You can then assign a name a parameters to these distance models:
dmShort = space.distanceModels[0]; = "short";
    { distance: 0.05, gainInDecibels: 0 }, // point A
    { distance: 0.1, gainInDecibels: -6 }, // point B
    { distance: 1, gainInDecibels: -30 }, // point C
    1.5 // max distance
dmLong = space.distanceModels[1]; = "long";
    { distance: 0.1, gainInDecibels: 0 }, // point A
    { distance: 0.2, gainInDecibels: -6 }, // point B
    { distance: 2, gainInDecibels: -30 }, // point C
    2.5 // max distance
To assign a specific distance model to an AudioObject (or a RemoteParticipant), use the setDistanceModel method:
While the direct path level of an audio object is affected by the assigned distance model, the reverberation level of an audio object does not depend on the distance between audio object and listener (which as approximately how diffuse reverberation behaves in a real enclosed space). However, it is often desirable to have the reverberation level of an audio object also depend on the distance between audio object and listener. This can be achieved by assigning a distance model to the the reverb send of an audio object:

atmoky Logo

© 2023 atmoky, GmbH.
All rights reserved.

We use cookies to measure and improve your browsing experience, and serve personalized ads or content.