SoundService
A service that determines various aspects of how Sounds play in the game.
Memory category | Instances |
---|
Member index 30
Removed member index 1
History | Member | |
---|---|---|
473 | PlayStockSound(sound: SoundType): void |
Description
A service that determines various aspects of how Sounds play in the game. SoundService is also often used to store SoundGroups although this is not mandatory for SoundGroups to work.
What can SoundService do?
SoundService properties such as SoundService.AmbientReverb, SoundService.DistanceFactor, SoundService.DopplerScale and SoundService.RolloffScale can be used to change how all Sounds play in the game.
The SoundService:SetListener() function allows developers to set the position where sounds are heard from.
SoundService:PlayLocalSound() can be used to play a sound locally regardless of where it is parented to.
Developers looking to find out more about how sound works in Roblox should consult the documentation provided for the FMOD sound engine.
History 94
- 649 Change Security of OpenDirectionalCurveEditor from RobloxScriptSecurity to PluginSecurity
- 648 Add OpenDirectionalCurveEditorSignal
- 648 Change Parameters of OpenAudioEqualizerEditorSignal from (selectedEqualizerObjects: Objects) to (selectedEqualizerObjects: Instances)
- 648 Change Parameters of OpenAttenuationCurveEditorSignal from (selectedCurveObjects: Objects) to (selectedCurveObjects: Instances)
- 648 Add OpenDirectionalCurveEditor
- 648 Change Parameters of OpenAttenuationCurveEditor from (selectedCurveObjects: Objects) to (selectedCurveObjects: Instances)
- 645 Add GetAudioInstances
- 645 Add DefaultListenerLocation
- 630 Add OpenAudioEqualizerEditorSignal
- 629 Add OpenAttenuationCurveEditorSignal
- 629 Add OpenAttenuationCurveEditor
- 599 Add AudioInstanceAdded
- 573 Change ReturnType of SetOutputDevice from void to null
- 573 Change ReturnType of SetListener from void to null
- 573 Change ReturnType of SetInputDevice from void to null
- 573 Change ReturnType of PlayLocalSound from void to null
- 559 Add
- 553 Change Default of VolumetricAudio from to Automatic
- 553 Change Default of RolloffScale from to 1
- 553 Change Default of RespectFilteringEnabled from to false
- 553 Change Default of DopplerScale from to 1
- 553 Change Default of DistanceFactor from to 3.32999992
- 553 Change Default of AmbientReverb from to NoReverb
- 550 Add SetInputDevice
- 550 Add GetInputDevices
- 550 Add GetInputDevice
- 538 Change Tags of VolumetricAudio from [NotScriptable, NotBrowsable] to [NotScriptable]
- 536 Add VolumetricAudio
- 486 Change ThreadSafety of RolloffScale from ReadOnly to ReadSafe
- 486 Change ThreadSafety of RespectFilteringEnabled from ReadOnly to ReadSafe
- 486 Change ThreadSafety of DopplerScale from ReadOnly to ReadSafe
- 486 Change ThreadSafety of DistanceFactor from ReadOnly to ReadSafe
- 486 Change ThreadSafety of AmbientReverb from ReadOnly to ReadSafe
- 475 Add DeviceListChanged
- 473 Remove PlayStockSound
- 467 Add SetOutputDevice
- 467 Add GetOutputDevices
- 467 Add GetOutputDevice
- 462 Change ThreadSafety of SetRecordingDevice from to Unsafe
- 462 Change ThreadSafety of SetListener from to Unsafe
- 462 Change ThreadSafety of PlayStockSound from to Unsafe
- 462 Change ThreadSafety of PlayLocalSound from to Unsafe
- 462 Change ThreadSafety of GetSoundMemoryData from to Unsafe
- 462 Change ThreadSafety of GetRecordingDevices from to Unsafe
- 462 Change ThreadSafety of GetListener from to Unsafe
- 462 Change ThreadSafety of EndRecording from to Unsafe
- 462 Change ThreadSafety of BeginRecording from to Unsafe
- 462 Change ThreadSafety of RolloffScale from to ReadOnly
- 462 Change ThreadSafety of RespectFilteringEnabled from to ReadOnly
- 462 Change ThreadSafety of DopplerScale from to ReadOnly
- 462 Change ThreadSafety of DistanceFactor from to ReadOnly
- 462 Change ThreadSafety of AmbientReverb from to ReadOnly
- 372 Add GetSoundMemoryData
- 305 Add RespectFilteringEnabled
- 259 Add PlayLocalSound
- 252 Add SetRecordingDevice
- 252 Add GetRecordingDevices
- 251 Change Tags of EndRecording from [] to [Yields]
- 251 Change Security of EndRecording from RobloxSecurity to RobloxScriptSecurity
- 251 Change ReturnType of EndRecording from string to Dictionary
- 251 Change Security of BeginRecording from RobloxSecurity to RobloxScriptSecurity
- 251 Change ReturnType of BeginRecording from void to bool
- 250 Change ReturnType of EndRecording from Dictionary to string
- 250 Change Security of EndRecording from RobloxScriptSecurity to RobloxSecurity
- 250 Change Tags of EndRecording from [Yields] to []
- 250 Change Security of BeginRecording from RobloxScriptSecurity to RobloxSecurity
- 250 Change ReturnType of BeginRecording from bool to void
- 251 Change Tags of EndRecording from [] to [Yields]
- 251 Change Security of EndRecording from RobloxSecurity to RobloxScriptSecurity
- 251 Change ReturnType of EndRecording from string to Dictionary
- 251 Change Security of BeginRecording from RobloxSecurity to RobloxScriptSecurity
- 251 Change ReturnType of BeginRecording from void to bool
- 249 Add EndRecording
- 249 Add BeginRecording
- 210 Add SetListener
- 210 Add GetListener
- 79 Change Tags of RolloffScale from [preliminary] to []
- 79 Change Tags of DopplerScale from [preliminary] to []
- 79 Change Tags of DistanceFactor from [preliminary] to []
- 79 Change Tags of AmbientReverb from [preliminary] to []
- 78 Change Tags of RolloffScale from [] to [preliminary]
- 78 Change Tags of DopplerScale from [] to [preliminary]
- 78 Change Tags of DistanceFactor from [] to [preliminary]
- 78 Change Tags of AmbientReverb from [] to [preliminary]
- 79 Change Tags of RolloffScale from [preliminary] to []
- 79 Change Tags of DopplerScale from [preliminary] to []
- 79 Change Tags of DistanceFactor from [preliminary] to []
- 79 Change Tags of AmbientReverb from [preliminary] to []
- 47 Add PlayStockSound
- 47 Add RolloffScale
- 47 Add DopplerScale
- 47 Add DistanceFactor
- 47 Add AmbientReverb
- 47 Add SoundService
Members 30
AmbientReverb
Type | Default | |
---|---|---|
ReverbType | NoReverb |
The ambient sound environment preset used by SoundService.
The ReverbType this property simulates a range of different environment's impact on sound. Each different option corresponds with a preset available in the FMOD sound engine. For example, when AmbientReverb is set to Hangar, the sound will reverberate differently to simulate being in a large enclosed space.
Changing the AmbientReverb effects the following properties used by Roblox's sound engine.
- Reverberation decay time
- Initial reflection delay time
- Late reverberation delay time relative to initial reflection
- Reference high frequency
- High-frequency to mid-frequency decay time ratio
- Value that controls the echo density in the late reverberation decay
- Value that controls the modal density in the late reverberation decay
- Reference low frequency
- Relative room effect level at low frequencies
- Relative room effect level at high frequencies
- Early reflections level relative to room effect
- Room effect level at mid frequencies
Those interested in finding more out about ambient reverb presets should see the FMOD documentation on the topic. For most developers however, the ReverbType names are descriptive enough to be able to use this setting without advanced knowledge.
Thread safety | ReadSafe |
---|---|
Category | Data |
Loaded/Saved | true |
History 7
- 553 Change Default of AmbientReverb from to NoReverb
- 486 Change ThreadSafety of AmbientReverb from ReadOnly to ReadSafe
- 462 Change ThreadSafety of AmbientReverb from to ReadOnly
- 79 Change Tags of AmbientReverb from [preliminary] to []
- 78 Change Tags of AmbientReverb from [] to [preliminary]
- 79 Change Tags of AmbientReverb from [preliminary] to []
- 47 Add AmbientReverb
AudioInstanceAdded
Parameters (1) | |
---|---|
instance | Instance |
Security | RobloxScriptSecurity |
---|---|
Thread safety | Unsafe |
History 1
BeginRecording
Parameters (0) | ||
---|---|---|
No parameters. | ||
Returns (1) | ||
bool |
Security | RobloxScriptSecurity |
---|---|
Thread safety | Unsafe |
History 8
- 462 Change ThreadSafety of BeginRecording from to Unsafe
- 251 Change Security of BeginRecording from RobloxSecurity to RobloxScriptSecurity
- 251 Change ReturnType of BeginRecording from void to bool
- 250 Change Security of BeginRecording from RobloxScriptSecurity to RobloxSecurity
- 250 Change ReturnType of BeginRecording from bool to void
- 251 Change Security of BeginRecording from RobloxSecurity to RobloxScriptSecurity
- 251 Change ReturnType of BeginRecording from void to bool
- 249 Add BeginRecording
DefaultListenerLocation
Type | Default | |
---|---|---|
ListenerLocation | Default |
Security | PluginSecurity |
---|---|
Thread safety | ReadSafe |
Category | Data |
Loaded/Saved | true |
History 1
DeviceListChanged
Parameters (1) | |
---|---|
newDevices | Tuple |
Security | RobloxScriptSecurity |
---|---|
Thread safety | Unsafe |
History 1
- 475 Add DeviceListChanged
DistanceFactor
Type | Default | |
---|---|---|
float | 3.32999992 |
The number of studs to be considered a meter by SoundService when calculating 3D Sound volume attenuation.
By default, the DistanceFactor is 3.33. This means, for the purposes of volume attenuation, a meter is considered 3.33 studs. The greater the DistanceFactor, the more gradually sound will attenuate.
local SoundService = game:GetService("SoundService")
SoundService.DistanceFactor = 1 -- 1 meter = 1 stud
SoundService.DistanceFactor = 10 -- 1 meter = 10 studs
Developers are advised to only change this property if their game uses a different scale. For example, when using larger custom characters, developers may want to reduce the DistanceFactor. In all other cases, Sound settings such as Sound.RollOffMode should be used instead.
Those looking to find out more about how 3D sound in Roblox works, should consult the FMOD documentation.
Thread safety | ReadSafe |
---|---|
Category | Data |
Loaded/Saved | true |
History 7
- 553 Change Default of DistanceFactor from to 3.32999992
- 486 Change ThreadSafety of DistanceFactor from ReadOnly to ReadSafe
- 462 Change ThreadSafety of DistanceFactor from to ReadOnly
- 79 Change Tags of DistanceFactor from [preliminary] to []
- 78 Change Tags of DistanceFactor from [] to [preliminary]
- 79 Change Tags of DistanceFactor from [preliminary] to []
- 47 Add DistanceFactor
DopplerScale
Type | Default | |
---|---|---|
float | 1 |
This property determines the degree to which a 3D Sound object's pitch varies due to the Doppler effect.
The Doppler effect describes a phenomenon whereby the pitch of a sound changes as the source and observer of the sound move further away, or closer together. The Doppler effect can often be seen in real life, such as when a car with a siren drives past.
Increasing this value exaggerates the impact of the Doppler effect, whereas decreasing it minimizes it. By default, the value of this property is 1.
local SoundService = game:GetService("SoundService")
SoundService.DopplerScale = 1 -- default
SoundService.DopplerScale = 2 -- exaggerated Doppler effect
SoundService.DopplerEffect = 0.5 -- subdued Doppler effect
Note the Doppler effect has no impact on 2D Sounds, (Sounds not parented to a BasePart or Attachment).
Developers wishing to learn more about the different settings Roblox's sound engine uses should consult the FMOD documentation.
Thread safety | ReadSafe |
---|---|
Category | Data |
Loaded/Saved | true |
History 7
- 553 Change Default of DopplerScale from to 1
- 486 Change ThreadSafety of DopplerScale from ReadOnly to ReadSafe
- 462 Change ThreadSafety of DopplerScale from to ReadOnly
- 79 Change Tags of DopplerScale from [preliminary] to []
- 78 Change Tags of DopplerScale from [] to [preliminary]
- 79 Change Tags of DopplerScale from [preliminary] to []
- 47 Add DopplerScale
EndRecording
Parameters (0) | ||
---|---|---|
No parameters. | ||
Returns (1) | ||
Dictionary |
Security | RobloxScriptSecurity |
---|---|
Thread safety | Unsafe |
History 11
- 462 Change ThreadSafety of EndRecording from to Unsafe
- 251 Change Tags of EndRecording from [] to [Yields]
- 251 Change Security of EndRecording from RobloxSecurity to RobloxScriptSecurity
- 251 Change ReturnType of EndRecording from string to Dictionary
- 250 Change ReturnType of EndRecording from Dictionary to string
- 250 Change Security of EndRecording from RobloxScriptSecurity to RobloxSecurity
- 250 Change Tags of EndRecording from [Yields] to []
- 251 Change Tags of EndRecording from [] to [Yields]
- 251 Change Security of EndRecording from RobloxSecurity to RobloxScriptSecurity
- 251 Change ReturnType of EndRecording from string to Dictionary
- 249 Add EndRecording
GetAudioInstances
Parameters (0) | ||
---|---|---|
No parameters. | ||
Returns (1) | ||
Array |
Security | RobloxScriptSecurity |
---|---|
Thread safety | Unsafe |
History 1
- 645 Add GetAudioInstances
GetInputDevice
Parameters (0) | ||
---|---|---|
No parameters. | ||
Returns (1) | ||
Tuple |
Security | RobloxScriptSecurity |
---|---|
Thread safety | Unsafe |
History 1
- 550 Add GetInputDevice
GetInputDevices
Parameters (0) | ||
---|---|---|
No parameters. | ||
Returns (1) | ||
Tuple |
Security | RobloxScriptSecurity |
---|---|
Thread safety | Unsafe |
History 1
- 550 Add GetInputDevices
GetListener
Parameters (0) | ||
---|---|---|
No parameters. | ||
Returns (1) | ||
Tuple |
This function returns the SoundService current listener type and what is set as listener.
The first result returned is the ListenerType of the listener, the second result is dependent on the ListenerType:
ListenerType | Description |
---|---|
ListenerType.Camera | Does not return a listener object as Workspace/CurrentCamera is always used |
ListenerType.CFrame | Returns the CFrame used in SoundService:SetListener() |
ListenerType.ObjectPosition | Returns the BasePart used in SoundService:SetListener() |
ListenerType.ObjectCFrame | Returns the BasePart used in SoundService:SetListener() |
The listener can be changed using SoundService:SetListener().
1 2 3 4 |
|
What is a listener?
The listener determines the point from which audio in the game is being 'heard' by the player. For 3D Sounds (Sounds parented to a BasePart or Attachment) the listener influences the volume and left/right balance of a playing sound. Listeners have no influence on the playback of 2D sounds as they have no position of emission.
By default, the listener is set to the CurrentCamera. However, a range of different types of listeners can be used.
Thread safety | Unsafe |
---|
History 2
- 462 Change ThreadSafety of GetListener from to Unsafe
- 210 Add GetListener
GetOutputDevice
Parameters (0) | ||
---|---|---|
No parameters. | ||
Returns (1) | ||
Tuple |
Security | RobloxScriptSecurity |
---|---|
Thread safety | Unsafe |
History 1
- 467 Add GetOutputDevice
GetOutputDevices
Parameters (0) | ||
---|---|---|
No parameters. | ||
Returns (1) | ||
Tuple |
Security | RobloxScriptSecurity |
---|---|
Thread safety | Unsafe |
History 1
- 467 Add GetOutputDevices
GetRecordingDevices
Parameters (0) | ||
---|---|---|
No parameters. | ||
Returns (1) | ||
Dictionary |
Security | RobloxScriptSecurity |
---|---|
Thread safety | Unsafe |
History 2
- 462 Change ThreadSafety of GetRecordingDevices from to Unsafe
- 252 Add GetRecordingDevices
GetSoundMemoryData
Parameters (0) | ||
---|---|---|
No parameters. | ||
Returns (1) | ||
Dictionary |
Security | RobloxScriptSecurity |
---|---|
Thread safety | Unsafe |
History 2
- 462 Change ThreadSafety of GetSoundMemoryData from to Unsafe
- 372 Add GetSoundMemoryData
OpenAttenuationCurveEditor
Parameters (1) | ||
---|---|---|
selectedCurveObjects | Instances | |
Returns (1) | ||
null |
Security | PluginSecurity |
---|---|
Thread safety | Unsafe |
History 2
- 648 Change Parameters of OpenAttenuationCurveEditor from (selectedCurveObjects: Objects) to (selectedCurveObjects: Instances)
- 629 Add OpenAttenuationCurveEditor
OpenAttenuationCurveEditorSignal
Parameters (1) | |
---|---|
selectedCurveObjects | Instances |
Security | RobloxScriptSecurity |
---|---|
Thread safety | Unsafe |
History 2
- 648 Change Parameters of OpenAttenuationCurveEditorSignal from (selectedCurveObjects: Objects) to (selectedCurveObjects: Instances)
- 629 Add OpenAttenuationCurveEditorSignal
OpenAudioEqualizerEditorSignal
Parameters (1) | |
---|---|
selectedEqualizerObjects | Instances |
Security | RobloxScriptSecurity |
---|---|
Thread safety | Unsafe |
History 2
- 648 Change Parameters of OpenAudioEqualizerEditorSignal from (selectedEqualizerObjects: Objects) to (selectedEqualizerObjects: Instances)
- 630 Add OpenAudioEqualizerEditorSignal
OpenDirectionalCurveEditor
Parameters (1) | ||
---|---|---|
selectedCurveObjects | Instances | |
Returns (1) | ||
null |
Security | PluginSecurity |
---|---|
Thread safety | Unsafe |
History 2
- 649 Change Security of OpenDirectionalCurveEditor from RobloxScriptSecurity to PluginSecurity
- 648 Add OpenDirectionalCurveEditor
OpenDirectionalCurveEditorSignal
Parameters (1) | |
---|---|
selectedCurveObjects | Instances |
Security | RobloxScriptSecurity |
---|---|
Thread safety | Unsafe |
History 1
PlayLocalSound
Parameters (1) | ||
---|---|---|
sound | Instance | |
Returns (1) | ||
null |
Plays a Sound locally, meaning the sound will only be heard by the client calling this function, regardless of where it's parented to. This function is most useful for playing a Sound locally in the Studio client, for instance in a Script for a Plugin.
Thread safety | Unsafe |
---|
History 3
- 573 Change ReturnType of PlayLocalSound from void to null
- 462 Change ThreadSafety of PlayLocalSound from to Unsafe
- 259 Add PlayLocalSound
RespectFilteringEnabled
Type | Default | |
---|---|---|
bool | false |
The RespectFilteringEnabled property determines whether Sound playback is replicated from the client to the server, and therefore from server. In other words, when a LocalScript calls Sound:Play() and this property is true, the sound will only play on the respective client. If the property is false, other clients will also hear the sound.
Thread safety | ReadSafe |
---|---|
Category | Data |
Loaded/Saved | true |
History 4
- 553 Change Default of RespectFilteringEnabled from to false
- 486 Change ThreadSafety of RespectFilteringEnabled from ReadOnly to ReadSafe
- 462 Change ThreadSafety of RespectFilteringEnabled from to ReadOnly
- 305 Add RespectFilteringEnabled
RolloffScale
Type | Default | |
---|---|---|
float | 1 |
Sets how fast 3D Sound volume attenuates, or 'rolls off'.
Note, this property only applies to Sounds whose Sound.RollOffMode property is set to 'Inverse' or 'InverseTapered'. 'Linear' and 'LinearSquare' RollOffMode use a different attenuation model which is not influenced by this property. This property also has no impact on 2D sounds (Sounds not parented to a BasePart or Attachment).
The higher the RolloffScale, the more rapidly a 3D sound's volume will attenuate as the distance between the listener and the sound increases.
By default the roll off scale is set to 1, which simulates the real world.
local SoundService = game:GetService("SoundService")
SoundService.RolloffScale = 1 -- attenuation simulates real world
SoundService.RolloffScale = 2 -- sound attenuates twice as fast as the real world
Developers wishing to learn more about the different settings Roblox's sound engine uses should consult the FMOD documentation.
Thread safety | ReadSafe |
---|---|
Category | Data |
Loaded/Saved | true |
History 7
- 553 Change Default of RolloffScale from to 1
- 486 Change ThreadSafety of RolloffScale from ReadOnly to ReadSafe
- 462 Change ThreadSafety of RolloffScale from to ReadOnly
- 79 Change Tags of RolloffScale from [preliminary] to []
- 78 Change Tags of RolloffScale from [] to [preliminary]
- 79 Change Tags of RolloffScale from [preliminary] to []
- 47 Add RolloffScale
SetInputDevice
Parameters (2) | ||
---|---|---|
name | string | |
guid | string | |
Returns (1) | ||
null |
Security | RobloxScriptSecurity |
---|---|
Thread safety | Unsafe |
History 2
- 573 Change ReturnType of SetInputDevice from void to null
- 550 Add SetInputDevice
SetListener
Parameters (2) | ||
---|---|---|
listenerType | ListenerType | |
listener | Tuple | |
Returns (1) | ||
null |
Sets the listener used by the client.
The first parameter is the ListenerType of the listener, the second parameter is dependent on the listener type.
- Camera ListenerType - Does not return a listener object as Workspace.CurrentCamera is always used
- CFrame ListenerType - The CFrame to be used
- ObjectPosition ListenerType - The BasePart to be used
- ObjectCFrame ListenerType - The BasePart to be used
The listener can be retrieved using SoundService:GetListener():
1 2 3 4 |
|
What is a listener?
The SoundService listener determines the point from which audio in
the game is being 'heard' by the player. For 3D Sounds
(sounds parented
to a BasePart or Attachment) the listener influences the volume
and left/right balance of a playing sound. Listeners have no influence on
the playback of 2D sounds as they have no position of emission.
By default, the listener is set to the CurrentCamera. However, a range of different types of listeners can be used.
Thread safety | Unsafe |
---|
History 3
- 573 Change ReturnType of SetListener from void to null
- 462 Change ThreadSafety of SetListener from to Unsafe
- 210 Add SetListener
SetOutputDevice
Parameters (2) | ||
---|---|---|
name | string | |
guid | string | |
Returns (1) | ||
null |
Security | RobloxScriptSecurity |
---|---|
Thread safety | Unsafe |
History 2
- 573 Change ReturnType of SetOutputDevice from void to null
- 467 Add SetOutputDevice
SetRecordingDevice
Parameters (1) | ||
---|---|---|
deviceIndex | int | |
Returns (1) | ||
bool |
Security | RobloxScriptSecurity |
---|---|
Thread safety | Unsafe |
History 2
- 462 Change ThreadSafety of SetRecordingDevice from to Unsafe
- 252 Add SetRecordingDevice
VolumetricAudio
Type | Default | |
---|---|---|
VolumetricAudio | Automatic |
Thread safety | ReadSafe |
---|---|
Category | Data |
Loaded/Saved | true |
History 3
- 553 Change Default of VolumetricAudio from to Automatic
- 538 Change Tags of VolumetricAudio from [NotScriptable, NotBrowsable] to [NotScriptable]
- 536 Add VolumetricAudio
Removed members 1
PlayStockSound
Parameters (1) | ||
---|---|---|
sound | SoundType | |
Returns (1) | ||
void |
Security | RobloxScriptSecurity |
---|---|
Thread safety | Unsafe |
History 3
- 473 Remove PlayStockSound
- 462 Change ThreadSafety of PlayStockSound from to Unsafe
- 47 Add PlayStockSound