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 39

HistoryMember
691AcousticSimulationEnabled: bool
553AmbientReverb: ReverbType
659CharacterSoundsUseNewApi: RolloutState
645DefaultListenerLocation: ListenerLocation
553DistanceFactor: float
553DopplerScale: float
553RespectFilteringEnabled: bool
553RolloffScale: float
553VolumetricAudio: VolumetricAudio
462BeginRecording(): bool
462EndRecording(): Dictionary
660GetAudioApiByDefault(): bool
645GetAudioInstances(): Array
550GetInputDevice(): Tuple
550GetInputDevices(): Tuple
462GetListener(): Tuple
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
573SetInputDevice(name: string, guid: 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
553Archivable: bool
670Capabilities: SecurityCapabilities
553Name: string
553Parent: Instance
702PredictionMode: PredictionMode
670Sandboxed: bool
680UniqueId: 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
486GetDescendants(): Array
486GetFullName(): string
641GetStyled(name: 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
648children(): Instances
553clone(): Instance
573destroy(): null
553findFirstChild(name: string, recursive: bool = false): Instance
648getChildren(): Instances
553isDescendantOf(ancestor: Instance): bool
573remove(): null
462AncestryChanged(child: Instance, parent: Instance)
462AttributeChanged(attribute: string)
462ChildAdded(child: Instance)
462ChildRemoved(child: Instance)
462DescendantAdded(descendant: Instance)
462DescendantRemoving(descendant: Instance)
500Destroying()
657StyledPropertiesChanged()
553childAdded(child: Instance)
inherited from Object
647ClassName: string
647className: string
647GetPropertyChangedSignal(property: string): RBXScriptSignal
647IsA(className: string): bool
650isA(className: string): bool
647Changed(property: string)

Removed member index 2

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 105

Members 39

AcousticSimulationEnabled

TypeDefault
boolfalse

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 1

AmbientReverb

TypeDefault
ReverbTypeNoReverb

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 7

AudioInstanceAdded

Parameters (1)
instanceInstance

History 1

BeginRecording

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

History 8

CharacterSoundsUseNewApi

TypeDefault
RolloutStateDefault

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 1

DefaultListenerLocation

TypeDefault
ListenerLocationDefault

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 1

DeviceListChanged

Parameters (1)
newDevicesTuple

History 1

DistanceFactor

TypeDefault
float3.32999992

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 7

DopplerScale

TypeDefault
float1

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 7

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

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

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
boolfalse

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 4

RolloffScale

TypeDefault
float1

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 7

SetAudioApiByDefault

Parameters (1)
enabledbool
Returns (1)
null

History 1

SetInputDevice

Parameters (2)
namestring
guidstring
Returns (1)
null

History 2

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
VolumetricAudioAutomatic

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 3

Tags: [NotScriptable]

Removed members 2

AudioPlayerVolumeFix

TypeDefault
RolloutStateDefault

History 2

PlayStockSound

Parameters (1)
soundSoundType
Returns (1)
void

History 3

Settings