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 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