Service · inherits Instance
SoundService
A service that determines various aspects of how the audio engine works. Most
of its properties affect how Sounds play in the experience.
About SoundService
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.
Properties 12
AcousticSimulationEnabled
: booleanDetermines whether acoustic simulation is enabled globally in the advanced audio system.Determines at a global level whether sound from
AudioEmittersandAudioListenersshould 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 individualAcousticSimulationEnabledsettings.AmbientReverb
: ReverbTypeThe ambient sound environment preset applied to allSounds.A reverb preset that should be applied to all
Soundsin the experience.Each
ReverbTypeoption for this property corresponds to a preset available in the FMOD sound engine. For example, whenAmbientReverbis set toReverbType.Hangar,Soundswill have reverb applied to simulate being in a large enclosed space.Note that this only affects
Soundsand not instances in the advanced audio system such asAudioPlayersandAudioEmitters. SeeAudioReverbfor a way to apply reverb in that system.CharacterSoundsUseNewApi
: RolloutStateDetermines whether the default character sounds will use instances in the advanced audio system vs.Sounds.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 asAudioPlayersandAudioEmitters. If set toRolloutState.Disabled, it will use instances in the legacy sound system such asSounds.DefaultListenerLocation
: ListenerLocationPluginDetermines where (if anywhere) to place anAudioListenerby default.Determines where to place an
AudioListenerby default. TheAudioListenerwill automatically be wired to aAudioDeviceOutputand will have an emptyAudioListener.InteractionGroupset.See
ListenerLocationfor detailed descriptions of each option.DistanceFactor
: floatThe number of studs to be considered a meter bySoundServicewhen simulating the Doppler effect forSounds.The number of studs to be considered a meter by
SoundServicewhen simulating the Doppler effect forSounds. This impacts anySoundparented to aBasePartorAttachment.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 theDistanceFactor, the faster the listener has to travel relative toSoundsin 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
AudioPlayerorAudioEmitter.DopplerScale
: floatDegree to which the pitch of aSoundvaries due to the Doppler effect.This property determines the degree to which the pitch of a
Soundvaries due to the Doppler effect. This impacts anySoundparented to aBasePartorAttachment.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.DopplerScaleexaggerates the impact of this effect, whereas decreasing it minimizes it. By default, the value of this property is1.Note that this does not impact the behavior of instances in the advanced audio system, such as
AudioPlayerorAudioEmitter.ListenerCFrame
: CFrameTheCFramethat is used as the listener's position ifListenerTypeis set toListenerType.CFrame.This property is only functional when
ListenerTypeis set toListenerType.CFrame. In that scenario, this property determines the world space position from which 3DSoundsare heard by the player.ListenerObject
: InstanceTheInstancewhose translation or coordinate frame is used as the listener's position ifListenerTypeis set toListenerType.ObjectPositionorListenerType.ObjectCFrame.This property is only functional when
ListenerTypeis set toListenerType.ObjectPositionorListenerType.ObjectCFrame. In that scenario, this property determines whichInstancewill be used to determine the position from which 3DSoundsare heard by the player. This property can only be set toInstanceswith a position, such as aBasePartor anAttachment. If it is set tonil, 3DSoundswill not be heard by the player.ListenerType
: ListenerTypeThe current listener type used by 3DSoundsto determine where they will be heard from.The listener type for any 3D
Soundsin the experience, effectively the point from which 3DSoundaudio in the experience is heard by the player. ForSoundsparented to aBasePartorAttachment, the listener influences the volume and left/right balance of a playing sound. By default, this listener is set toWorkspace.CurrentCamera.Note that this does not affect the listener location when using the advanced audio system; see
AudioListenerfor 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.GetListenerandSoundService.SetListenerinstead.RespectFilteringEnabled
: booleanSets whetherSoundplayback from a client will replicate to the server.This property determines whether
Soundplayback is replicated from the client to the server, and therefore from the server. In other words, when aLocalScriptcallsPlay()and this property istrue, the sound will only play on the respective client. If this property isfalse, other clients will also hear the sound.Default is
true, meaning filtering is enabled.RolloffScale
: floatDetermines how fast the volume of aSoundattenuates beyond itsSound.RollOffMinDistance.Determines how fast the volume of a spatialized
Soundattenuates. This impacts anySoundparented to aBasePartorAttachment.A higher
RolloffScalemeans the volume of aSoundwill attenuate more rapidly as the distance between the listener and theSoundgrows. More precisely, the volume of theSoundwill still start attenuating at a distance equal toSound.RollOffMinDistance, but the attenuation curve will be steeper or more gradual based on the value ofRolloffScale. Note that theSoundwill still be inaudible past its theSound.RollOffMaxDistanceregardless of the value ofSoundService.RolloffScale.Note that this property does not affect the behavior of instances in the advanced audio system, such as
AudioEmitter. SeeAudioEmitter.SetDistanceAttenuationfor a way to apply custom attenuation in that system.VolumetricAudio
: VolumetricAudioNotScriptableDetermines whether certain spatializedSoundsemit volumetrically, throughout the space of their parent object.Determines whether any
Soundsparented to aPartemit volumetrically. If set toVolumetricAudio.Enabled, theSoundwill simulate being emitted from every point in the interior of thePart. If set toVolumetricAudio.Disabled, theSoundwill only emit from a single point in the center of thePart.Note that this does not impact
Soundsparented to other objects, such asAttachmentsorMeshParts. This also does not impact the behavior of instances in the advanced audio system such asAudioEmitter.
Methods 6
GetListener
() → TupleReturns the current listener type used bySounds, as well as what that listener is currently set to.Returns the current listener type used by
Soundsand what object or position that listener is currently set to. This is the point from whichSoundaudio in the experience is heard by the player. By default, the listener is set toWorkspace.CurrentCamera. The listener can be changed usingSetListener().Note that this does not affect the listener location when using the advanced audio system. See
AudioListenerfor a way to set the listener location in that system.GetMixerTime
() → doubleReturns a number in seconds which increases as the audio engine mixes.Returns a number in seconds that increases as the audio engine produces output. Because this clock is derived from the number of audio samples the mixer has processed, it is stable, sample-accurate, and monotonically increasing, which makes it suitable for scheduling audible changes at precise moments.
Use this value as the basis for the
atTimeargument of methods that support scheduling playback to begin or end at an exact point in the future, such asPlay()andStop(). Those methods expect times derived fromGetMixerTime().Note,
GetMixerTime()starts at an arbitrary value, and can differ between machines. It is not suitable for synchronizing audio across sessions or networks.OpenAttenuationCurveEditor
(selectedCurveObjects: Instances) → ()PluginOpens the attenuation curve editor in Studio for the providedAudioEmitterorAudioListenerinstances.OpenDirectionalCurveEditor
(selectedCurveObjects: Instances) → ()PluginOpens the directional curve editor in Studio for the providedAudioEmitterorAudioListenerinstances.Opens the directional curve editor in Studio for the provided
AudioEmitterorAudioListenerinstances. This method is intended for use by Studio plugins that need to programmatically surface the editor, in the same way a user would open it from the Properties window.PlayLocalSound
(sound: Instance) → ()Plays a copy of aSoundlocally, such that it will only be heard by the client calling this method.Plays a copy of a
Soundlocally. TheSoundwill only be heard by the client calling this method, regardless of where it's parented to.Some properties of the
Soundwill be carried over into the copy. These include itsSound.Volume,Sound.TimePosition,Sound.PlaybackSpeed, and any spatialization and effects that are applied to it, including throughSoundGroups. Properties that do not affect the copy includeSound.LoopedandSoundService.AmbientReverb.SetListener
(listenerType: ListenerType, listener: Tuple) → ()Sets the listener used bySounds.Sets the listener type for any
Soundsin the experience, which defines the point from whichSoundaudio in the experience is heard by the player. ForSoundsparented to aBasePartorAttachment, the listener influences the volume and left/right balance of a playing sound. By default, this listener is set toWorkspace.CurrentCamera.Note that this does not affect the listener location when using the advanced audio system. See
AudioListenerfor a way to set the listener location in that system.
SoundService also has every member of Instance. Deprecated and Roblox-only members are hidden.
Reference text from the Roblox Creator Documentation, licensed CC BY 4.0, reorganized by rbxtoolshub.com · Studio 0.743.0.7431133.