Component reference
File components

Audio component

11min

Description

The Audio component allows you to add audio sources to entities within your scene. Audio can be set to play as ambient (heard throughout the scene) or positional (heard from a specific location with spatial effects).

When you add the Audio component to an entity, you configure how the audio behaves and how it is played back.

Document image



Media source

The Media Source setting determines how the audio is handled within the scene. Options include:

  • This Player: The entity plays its own audio source.
  • Sync With Other: This entity’s audio syncs with another entity playing the same source.

If This Player is selected, additional playback settings are available.



Playback settings

When using This Player, the following settings allow you to customize how the audio is played back:

Source Paths

A text field for specifying a media URL. You can:

  • Enter a URL manually.
  • Drag and drop an audio file from the Assets panel into this field, which will populate the URL automatically.
  • Add multiple source paths by clicking +.

Volume

A slider that controls playback volume, ranging from 0 (silent) to 10 (maximum).

Media Options

  • Synchronize Client Playback (enabled by default): Ensures audio playback is synced across all users.
  • Autoplay: Starts playback automatically when the scene loads.
  • Mute in Editor: Disables audio playback inside the Studio editor.

Play Mode

Determines how the audio plays:

  • Single: Plays the selected file once.
  • Random: Randomly selects a file from the Source Paths.
  • Loop: Repeats the audio continuously.
  • SingleLoop: Repeats the currently playing track indefinitely.


Audio mode

The Audio Mode setting determines whether the audio is heard throughout the scene or spatialized to a specific location.

  • Ambient: The audio plays evenly throughout the entire scene.
  • Positional: The audio emanates from a specific location in the scene and changes volume based on the listener's position.

If Positional is selected, additional spatial settings are available.

Positional audio settings

These settings control how the sound behaves in 3D space.

Property

Description

Distance Model

Defines how the audio volume decreases over distance. Options include: Linear, Inverse, and Exponential.

Rolloff Factor

Adjusts the rate at which the audio volume decreases according to the selected distance model. A higher value results in a steeper volume drop over distance.

Max Distance

The maximum distance (in meters) at which the audio can be heard. Beyond this distance, the audio is silent.

Cone Inner Angle

The angle (in degrees) of the inner cone where the audio is at full volume. This represents the area directly in front of the audio source.

Cone Outer Angle

The angle (in degrees) of the outer cone where the audio begins to decrease in volume. Outside this angle, the sound fades according to the Cone Outer Gain.

Cone Outer Gain

A value between 0.0 and 1.0 that determines the volume outside the outer cone. A value of 0.0 means the audio is silent outside the cone, while 1.0 means no decrease in volume.

Sync With Other

This option allows the Audio component to sync with another audio source in the scene, optimizing performance by reducing redundant audio streams.

Usage notes

  • Directional audio: Use cone properties to create focused sound sources, such as a speaker emitting sound in one direction.
  • Distance attenuation: Adjust the Distance Model, Rolloff Factor, and Max Distance to control how sound fades over distance.
  • Orientation: The entity’s forward direction determines where the cone is aimed. Ensure the entity is rotated correctly.