Skip to content

Directional Sound

Hangman edited this page Apr 3, 2023 · 6 revisions

Directional sound is a spatial sound that extends in a specified direction. Directionality works on all types of sound sources (BufferedSoundSource, StreamedSoundSource).
To illustrate, here's a video:
Youtube Video

Make It Directional

source.makeDirectional(direction, coneInnerAngle, coneOuterAngle, outOfConeVolume);

Sound is emitted from a directional source in a cone shape:

  • Within coneInnerAngle the full volume of the source can be heard.
  • Outside coneOuterAngle the volume set with outOfConeVolume is heard.
  • Between coneInnerAngle (full volume) and coneOuterAngle (outOfConeVolume) the volume is interpolated.

Update Direction

Once you made it directional, you can update the direction the source is facing. To also update the cone angles, you can simply call makeDirectional again. That's probably a rare use case, hence there's no extra method for it.

source.setDirection(direction);

Make It Omni-Directional

It's the opposite of directional, so it simply turns off the directionality again.

source.makeOmniDirectional();