Reference API Roblox

Engine API

Website

Related

Reference API Roblox

SoundService

A service that determines various aspects of how the audio engine works. Most of its properties affect how Sounds play in the experience.

This class is not creatable. Instances of this class cannot be created with Instance.new.
This class is a service. It is a singleton that may be acquired with GetService.
Tags: [NotCreatable, Service]

Member index 42

HistoryMember
726AcousticSimulationEnabled: bool
726AmbientReverb: ReverbType
726CharacterSoundsUseNewApi: RolloutState
726DefaultListenerLocation: ListenerLocation
726DistanceFactor: float
726DopplerScale: float
726ListenerCFrame: CFrame
726ListenerObject: Instance
726ListenerType: ListenerType
726RespectFilteringEnabled: bool
726RolloffScale: float
726VolumetricAudio: VolumetricAudio
462BeginRecording(): bool
462EndRecording(): Dictionary
660GetAudioApiByDefault(): bool
645GetAudioInstances(): Array
550GetInputDevice(): Tuple
550GetInputDevices(): Tuple
462GetListener(): Tuple
714GetMixerTime(): double
467GetOutputDevice(): Tuple
467GetOutputDevices(): Tuple
462GetRecordingDevices(): Dictionary
462GetSoundMemoryData(): Dictionary
660InsertAsset(assetId: ContentId, assetName: string, useSelection: bool = true): Instances
648OpenAttenuationCurveEditor(selectedCurveObjects: Instances): null
649OpenDirectionalCurveEditor(selectedCurveObjects: Instances): null
573PlayLocalSound(sound: Instance): null
660SetAudioApiByDefault(enabled: bool): null
721SetInputDevice(nameOrInstance: Variant, guidOrPin: string): null
573SetListener(listenerType: ListenerType, listener: Tuple): null
573SetOutputDevice(name: string, guid: string): null
462SetRecordingDevice(deviceIndex: int): bool
673SetSoundEnabled(enabled: bool): null
599AudioInstanceAdded(instance: Instance)
475DeviceListChanged(newDevices: Tuple)
648OpenAttenuationCurveEditorSignal(selectedCurveObjects: Instances)
655OpenAudioCompressorEditorSignal(selectedCompressorObjects: Instances)
648OpenAudioEqualizerEditorSignal(selectedEqualizerObjects: Instances)
648OpenDirectionalCurveEditorSignal(selectedCurveObjects: Instances)
inherited from Instance
726Archivable: bool
726Capabilities: SecurityCapabilities
726IsInSandbox: bool
726Name: string
726Parent: Instance
726PredictionMode: PredictionMode
726Sandboxed: bool
726UniqueId: UniqueId
576AddTag(tag: string): null
573ClearAllChildren(): null
462Clone(): Instance
573Destroy(): null
486FindFirstAncestor(name: string): Instance
486FindFirstAncestorOfClass(className: string): Instance
486FindFirstAncestorWhichIsA(className: string): Instance
486FindFirstChild(name: string, recursive: bool = false): Instance
486FindFirstChildOfClass(className: string): Instance
486FindFirstChildWhichIsA(className: string, recursive: bool = false): Instance
486FindFirstDescendant(name: string): Instance
563GetActor(): Actor
486GetAttribute(attribute: string): Variant
462GetAttributeChangedSignal(attribute: string): RBXScriptSignal
631GetAttributes(): Dictionary
648GetChildren(): Instances
462GetDebugId(scopeLength: int = 4): string
707GetDescendants(): Instances
486GetFullName(): string
706GetStyled(name: string, selector: string?): Variant
657GetStyledPropertyChangedSignal(property: string): RBXScriptSignal
576GetTags(): Array
576HasTag(tag: string): bool
486IsAncestorOf(descendant: Instance): bool
486IsDescendantOf(ancestor: Instance): bool
664IsPropertyModified(property: string): bool
698QueryDescendants(selector: string): Instances
573Remove(): null
576RemoveTag(tag: string): null
664ResetPropertyToDefault(property: string): null
573SetAttribute(attribute: string, value: Variant): null
462WaitForChild(childName: string, timeOut: double): Instance
726children(): Instances
726clone(): Instance
726destroy(): null
726findFirstChild(name: string, recursive: bool = false): Instance
726getChildren(): Instances
726isDescendantOf(ancestor: Instance): bool
726remove(): null
462AncestryChanged(child: Instance, parent: Instance)
462AttributeChanged(attribute: string)
462ChildAdded(child: Instance)
462ChildRemoved(child: Instance)
462DescendantAdded(descendant: Instance)
462DescendantRemoving(descendant: Instance)
500Destroying()
657StyledPropertiesChanged()
726childAdded(child: Instance)
inherited from Object
726ClassName: string
726className: string
647GetPropertyChangedSignal(property: string): RBXScriptSignal
647IsA(className: string): bool
726isA(className: string): bool
647Changed(property: string)

Removed member index 3

HistoryMember
699AudioPlayerVolumeFix: RolloutState
473PlayStockSound(sound: SoundType): void

Description

A service that determines various aspects of how the audio engine works. Most of its properties affect how Sounds play in the experience, while others affect the behavior of instances in the advanced audio system such as AudioPlayers and AudioEmitters.

SoundService is also often used to store SoundGroups, although this is not mandatory for groups to work.

History 124

Members 42

AcousticSimulationEnabled

TypeDefault
bool

Determines at a global level whether sound from AudioEmitters and AudioListeners should automatically implement features of acoustic simulation, such as occlusion (being muffled through walls), diffraction (bending around corners), and reverberation (echoing off of walls).

If set to false, these instances will not simulate these features, regardless of their individual AcousticSimulationEnabled settings.

History 2

AmbientReverb

TypeDefault
ReverbType

A reverb preset that should be applied to all Sounds in the experience.

Each ReverbType option for this property corresponds to a preset available in the FMOD sound engine. For example, when AmbientReverb is set to ReverbType.Hangar, Sounds will have reverb applied to simulate being in a large enclosed space.

Note that this only affects Sounds and not instances in the advanced audio system such as AudioPlayers and AudioEmitters. See AudioReverb for a way to apply reverb in that system.

History 8

AudioInstanceAdded

Parameters (1)
instanceInstance

History 1

BeginRecording

Parameters (0)
No parameters.
Returns (1)
bool

History 8

CharacterSoundsUseNewApi

TypeDefault
RolloutState

Determines which set of instances core scripts will use to create default character sounds. If set to RolloutState.Enabled, it will use instances in the advanced audio system such as AudioPlayers and AudioEmitters. If set to RolloutState.Disabled, it will use instances in the legacy sound system such as Sounds.

History 2

DefaultListenerLocation

TypeDefault
ListenerLocation

Determines where to place an AudioListener by default. The AudioListener will automatically be wired to a AudioDeviceOutput and will have an empty AudioListener.InteractionGroup set.

See ListenerLocation for detailed descriptions of each option.

History 3

DeviceListChanged

Parameters (1)
newDevicesTuple

History 1

DistanceFactor

TypeDefault
float

The number of studs to be considered a meter by SoundService when simulating the Doppler effect for Sounds. This impacts any Sound parented to a BasePart or Attachment.

By default, this property is 3.33, meaning that a meter is considered 3.33 studs for the purposes of simulating the Doppler effect. The greater the DistanceFactor, the faster the listener has to travel relative to Sounds in order to experience the same Doppler shift.

It's recommended that you only change this property if the objects in your experience are scaled differently from what they represent. For example, if your character is meant to be very small (but is normal-sized in the engine), you may want to increase SoundService.DistanceFactor.

Note that this does not impact the behavior of instances in the advanced audio system, such as AudioPlayer or AudioEmitter.

History 8

DopplerScale

TypeDefault
float

This property determines the degree to which the pitch of a Sound varies due to the Doppler effect. This impacts any Sound parented to a BasePart or Attachment.

The Doppler effect is a phenomenon whereby the pitch of a sound changes as the source and observer of the sound move further away or closer together, which is stronger the more quickly they are moving. Increasing SoundService.DopplerScale exaggerates the impact of this effect, whereas decreasing it minimizes it. By default, the value of this property is 1.

Note that this does not impact the behavior of instances in the advanced audio system, such as AudioPlayer or AudioEmitter.

History 8

EndRecording

Parameters (0)
No parameters.
Returns (1)
Dictionary
This function yields. It will block the calling thread until completion.

History 11

Tags: [Yields]

GetAudioApiByDefault

Parameters (0)
No parameters.
Returns (1)
bool

History 1

GetAudioInstances

Parameters (0)
No parameters.
Returns (1)
Array

History 1

GetInputDevice

Parameters (0)
No parameters.
Returns (1)
Tuple

History 1

GetInputDevices

Parameters (0)
No parameters.
Returns (1)
Tuple

History 1

GetListener

Parameters (0)
No parameters.
Returns (1)
Tuple

Returns the current listener type used by Sounds and what object or position that listener is currently set to. This is the point from which Sound audio in the experience is heard by the player. By default, the listener is set to Workspace.CurrentCamera. The listener can be changed using SetListener().

Note that this does not affect the listener location when using the advanced audio system. See AudioListener for a way to set the listener location in that system.

History 2

GetMixerTime

Parameters (0)
No parameters.
Returns (1)
double

History 1

GetOutputDevice

Parameters (0)
No parameters.
Returns (1)
Tuple

History 1

GetOutputDevices

Parameters (0)
No parameters.
Returns (1)
Tuple

History 1

GetRecordingDevices

Parameters (0)
No parameters.
Returns (1)
Dictionary
This function yields. It will block the calling thread until completion.

History 2

Tags: [Yields]

GetSoundMemoryData

Parameters (0)
No parameters.
Returns (1)
Dictionary

History 2

InsertAsset

Parameters (3)Default
assetIdContentId
assetNamestring
useSelectionbooltrue
Returns (1)
Instances

History 1

ListenerCFrame

TypeDefault
CFrame

This property is only functional when ListenerType is set to ListenerType.CFrame. In that scenario, this property determines the world space position from which 3D Sounds are heard by the player.

History 1

ListenerObject

TypeDefault
Instance

This property is only functional when ListenerType is set to ListenerType.ObjectPosition or ListenerType.ObjectCFrame. In that scenario, this property determines which Instance will be used to determine the position from which 3D Sounds are heard by the player. This property can only be set to Instances with a position, such as a BasePart or an Attachment. If it is set to nil, 3D Sounds will not be heard by the player.

History 1

ListenerType

TypeDefault
ListenerType

The listener type for any 3D Sounds in the experience, effectively the point from which 3D Sound audio in the experience is heard by the player. For Sounds parented to a BasePart or Attachment, the listener influences the volume and left/right balance of a playing sound. By default, this listener is set to Workspace.CurrentCamera.

Note that this does not affect the listener location when using the advanced audio system; see AudioListener for a way to set the listener location within that system.

This property may not yet be enabled for all creators; until full rollout, use SoundService:GetListener() and SoundService:SetListener() instead.

History 1

OpenAttenuationCurveEditor

Parameters (1)
selectedCurveObjectsInstances
Returns (1)
null

Opens the attenuation curve editor in Studio for the provided AudioEmitter or AudioListener instances.

History 2

OpenAttenuationCurveEditorSignal

Parameters (1)
selectedCurveObjectsInstances

History 2

OpenAudioCompressorEditorSignal

Parameters (1)
selectedCompressorObjectsInstances

History 1

OpenAudioEqualizerEditorSignal

Parameters (1)
selectedEqualizerObjectsInstances

History 2

OpenDirectionalCurveEditor

Parameters (1)
selectedCurveObjectsInstances
Returns (1)
null

Opens the directional curve editor in Studio for the provided AudioEmitter or AudioListener instances.

History 2

OpenDirectionalCurveEditorSignal

Parameters (1)
selectedCurveObjectsInstances

History 1

PlayLocalSound

Parameters (1)
soundInstance
Returns (1)
null

Plays a copy of a Sound locally. The Sound will only be heard by the client calling this method, regardless of where it's parented to.

Some properties of the Sound will be carried over into the copy. These include its Sound.Volume, Sound.TimePosition, Sound.PlaybackSpeed, and any spatialization and effects that are applied to it, including through SoundGroups. Properties that do not affect the copy include Sound.Looped and SoundService.AmbientReverb.

History 3

RespectFilteringEnabled

TypeDefault
bool

This property determines whether Sound playback is replicated from the client to the server, and therefore from the server. In other words, when a LocalScript calls Play() and this property is true, the sound will only play on the respective client. If this property is false, other clients will also hear the sound.

Default is true, meaning filtering is enabled.

History 5

RolloffScale

TypeDefault
float

Determines how fast the volume of a spatialized Sound attenuates. This impacts any Sound parented to a BasePart or Attachment.

A higher RolloffScale means the volume of a Sound will attenuate more rapidly as the distance between the listener and the Sound grows. More precisely, the volume of the Sound will still start attenuating at a distance equal to Sound.RollOffMinDistance, but the attenuation curve will be steeper or more gradual based on the value of RolloffScale. Note that the Sound will still be inaudible past its the Sound.RollOffMaxDistance regardless of the value of SoundService.RolloffScale.

Note that this property does not affect the behavior of instances in the advanced audio system, such as AudioEmitter. See AudioEmitter:SetDistanceAttenuation for a way to apply custom attenuation in that system.

History 8

SetAudioApiByDefault

Parameters (1)
enabledbool
Returns (1)
null

History 1

SetInputDevice

Parameters (2)
nameOrInstanceVariant
guidOrPinstring
Returns (1)
null

History 4

SetListener

Parameters (2)
listenerTypeListenerType
listenerTuple
Returns (1)
null

Sets the listener type for any Sounds in the experience, which defines the point from which Sound audio in the experience is heard by the player. For Sounds parented to a BasePart or Attachment, the listener influences the volume and left/right balance of a playing sound. By default, this listener is set to Workspace.CurrentCamera.

Note that this does not affect the listener location when using the advanced audio system. See AudioListener for a way to set the listener location in that system.

History 3

SetOutputDevice

Parameters (2)
namestring
guidstring
Returns (1)
null

History 2

SetRecordingDevice

Parameters (1)
deviceIndexint
Returns (1)
bool

History 2

SetSoundEnabled

Parameters (1)
enabledbool
Returns (1)
null

History 1

VolumetricAudio

TypeDefault
VolumetricAudio

Determines whether any Sounds parented to a Part emit volumetrically. If set to VolumetricAudio.Enabled, the Sound will simulate being emitted from every point in the interior of the Part. If set to VolumetricAudio.Disabled, the Sound will only emit from a single point in the center of the Part.

Note that this does not impact Sounds parented to other objects, such as Attachments or MeshParts. This also does not impact the behavior of instances in the advanced audio system such as AudioEmitter.

This property is not scriptable. It cannot be accessed by script code.

History 4

Tags: [NotScriptable]

Removed members 3

AudioPlayerVolumeFix

TypeDefault
RolloutStateDefault

History 2

PlayStockSound

Parameters (1)
soundSoundType
Returns (1)
void

History 3

Settings