# 3d min max distance

**URL:** <https://qa.fmod.com/t/3d-min-max-distance/19495>\
**Category:** FMOD Engine\
**Tags:** cpp\
**Created:** [November 10, 2022, 4:13am UTC](https://qa.fmod.com/t/3d-min-max-distance/19495 "2022-11-10T04:13:41Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![juhrell](https://avatars.discourse-cdn.com/v4/letter/j/c6cbf5/32.png) [@juhrell](https://qa.fmod.com/u/juhrell)\
**Post date:** [November 10, 2022, 4:13am UTC](https://qa.fmod.com/t/3d-min-max-distance/19495/1 "2022-11-10T04:13:41Z")

</div>

hello, I’ve encountered an issue with setting the min max distance of the channel group, the audio is still audible and way too loud even after going outside of the max distance.

Here’s what i’ve done so far,

```auto
m_StereoGroup->setMode(FMOD_3D);
m_StereoGroup->set3DMinMaxDistance(0.3f, 1.f);

```

I’m also updating the position of both listener and audio object in run time so the panning works. However, after going outside of the max distance, eg 1.0f, am i suppose to be able to hear the audio?

If that’s the case, is there a way for the listener to not be able to hear the audio after a certain range for stereo sounds? Thanks for the help 🙂

---

<div class="post-metadata">

**Author:** ![Leah\_FMOD](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/leah_fmod/32/3685_2.png) [@Leah\_FMOD](https://qa.fmod.com/u/Leah_FMOD)\
**Post date:** [November 11, 2022, 4:28am UTC](https://qa.fmod.com/t/3d-min-max-distance/19495/2 "2022-11-11T04:28:47Z")

</div>

When using 3D audio, the rolloff model you’re using determines how sounds attenuate with respect to distance. Enabling 3D audio as you’ve done with `m_StereoGroup->setMode(FMOD_3D)` sets the rolloff model to [FMOD\_3D\_INVERSEROLLOFF](https://www.fmod.com/docs/2.02/api/core-api-common.html#fmod_3d_inverserolloff) by default, which stops attenuating sound at and beyond max distance - the sound will never be truly silent as attenuation with this rolloff model is calculated with `mindistance / distance`, though with enough distance a sound may be imperceptible.

To have silence when beyond `maxdistance`, you simply need to set the channel group to use an appropriate rolloff model. You can do this by calling `m_StereoGroup->setMode()` again, and setting the mode to [FMOD\_3D\_LINEARROLLOFF](https://www.fmod.com/docs/2.02/api/core-api-common.html#fmod_3d_linearrolloff), or [FMOD\_3D\_LINEARSQUAREROLLOFF](https://www.fmod.com/docs/2.02/api/core-api-common.html#fmod_3d_linearsquarerolloff).

You can see more info regarding 3D sounds, distance and rolloff in FMOD under [White Papers | 3D Sounds](https://www.fmod.com/docs/2.02/api/white-papers-3d-sounds.html#distance-models-and-linear-rolloff-vs-inverse) in the documentation.

---

<div class="post-metadata">

**Author:** ![juhrell](https://avatars.discourse-cdn.com/v4/letter/j/c6cbf5/32.png) [@juhrell](https://qa.fmod.com/u/juhrell)\
**Post date:** [November 11, 2022, 7:10pm UTC](https://qa.fmod.com/t/3d-min-max-distance/19495/3 "2022-11-11T19:10:03Z")

</div>

omg yes thank you so much! I can’t believe I missed that part out on the documentations… Been looking all over for weeks
