Skip to content
Documentation

Spatial Audio and Listeners

Use Play Sound At when a sound should belong to a place in the world. A passing vehicle can carry its sound; an impact can leave a sound at its collision point. Distance changes volume, and the source’s direction changes stereo pan in both 2D and 3D.

Prerequisites

Import a short Sound, confirm it previews, and prepare a visible source Object with one enabled Logic attachment in the running Scene. Set resource, Sound Effects bus, and master volume to audible values. Save a checkpoint.

Use headphones or stereo speakers for the pan check. Also test mono output when your game needs directional feedback. Browser audio can require a player interaction before playback starts.

Hear a Moving Source

  1. In a discrete Event on the source Object, add Play Sound At from Audio > Sound and Music.
  2. Choose the Sound, keep Source at object, and leave At Object blank to use the acting Object.
  3. Keep Follow It on. Set Heard Up To to 20 and Full Volume Within to 3, both in world metres.
  4. Run and trigger the Event once. Move the source from the left of the visible view to its right while the sound plays.
  5. Repeat with the source close to the listener, between the two hearing distances, and beyond 20 metres.
  6. Compare Follow It off: the new occurrence stays at the source’s resolved starting position.

Expected result: a followed occurrence changes pan and volume as its source moves. It has full distance gain within 3 metres, fades farther away, and reaches silence at 20 metres. Resource and bus multipliers still affect its final volume.

When At Object names an Object definition, the Action chooses the nearest live instance for that occurrence. It doesn’t play from every matching placement. With several copies, check the selected instance and the Event’s acting Object before assuming all sources are audible.

Leave a Sound at a Point

Set Source to position. Choose Position Relative To and supply X and Y; a 3D position can also use Z (Height). The resolved position is fixed for this occurrence.

Use world for an authored point in metres, or the offered Object, Coordinate, or Bounding Box controls when the point depends on a target. Coordinates explains world and local space.

In 2D, positive world Y is upward. In 3D, X and Y form the ground plane and Z is height. A screen-space UI click needs conversion to a world point before it supplies a useful world sound location.

Choose Whose Position Hears

By default, the Camera supplies the listener. Add Set Audio Listener and choose your player in Listen From when the Camera can lag behind or frame something elsewhere. Leave Listen From blank to return to the Camera.

Compare the same sound first with the Camera listener, then with the player listener. Move the Camera and player apart. A listener Object changes the hearing position; pan still follows the visible Camera orientation. If the listener Object disappears, the engine falls back to the Camera. Restart also restores the default.

In 2D, pan uses the source’s horizontal position in the shown view, including Camera rotation and zoom. In 3D, pan uses the Camera’s right direction. A split-view game needs an explicit check of which view supplies that orientation.

Set Range and Lifetime

Control Meaning
Heard Up To Distance at which the spatial occurrence becomes silent.
Full Volume Within Inner distance with no distance attenuation. Keep it below Heard Up To for a useful fade zone.
Follow It Tracks the chosen source instance; off retains its starting position.
Listen From Listener Object, or blank for the Camera.

Blank hearing fields use the runtime’s mode defaults. Set them explicitly when the sound must communicate a particular gameplay range. Increasing the range changes audibility, not the Sound’s resource volume or the bus mix.

Start one occurrence for each intended discrete event. An Every Step Action can create many overlapping voices. For a looping source, define and test its stop condition. Control Sound with Operation stop targets the selected Sound resource; check that scope when several sources reuse the resource.

A followed voice whose Object is destroyed retains its last position while the voice finishes. Check that case separately from your loop’s stop operation. Test Scene changes and repeated spawns, then listen on the intended published device.

Troubleshooting

Symptom Check
Sound previews but is silent in play Check the Event, live source, player interaction, resource and bus volumes, listener, and hearing range.
Sound follows the wrong copy Check At Object’s nearest-instance selection and the acting instance.
A moving sound stays in one place Inspect Follow It and whether its chosen source still exists.
Pan reverses after Camera rotation Compare the visible Camera axes; pan follows screen orientation.
The player hears from far behind Bind Listen From to the intended player instead of the lagging Camera.
Many copies overlap Count Event firings, loop starts, and simultaneous live sources.
Direction is unclear on a mono device Supply another gameplay cue and test mono output directly.

See Play Sound At, Set Audio Listener, and audio mixing for their fields and bus controls.

Myth Engine Documentation