Class · inherits Instance
AudioEmitter
Emits audio streams into the world.
About AudioEmitter
AudioEmitter emits audio streams into the world. It provides a single
Input pin that can be connected to by one or more Wires. Any
streams wired to an AudioEmitter get broadcasted into the world from
the emitter's parent's position. If the parent is an Attachment,
Camera, or PVInstance, the parent's world-position will be
used. If the parent is not one of these classes, the AudioEmitter is
effectively silent.
AudioEmitters are heard by
AudioListeners in order to implement 3D spatialization.
Properties 6
AcousticSimulationEnabled
: booleanDetermines whether acoustic simulation should be used for thisAudioEmitter.Determines whether sound from this
AudioEmittershoud automatically implement features of acoustic simulation, such as occlusion (being muffled through walls), diffraction (bending around corners), and reverberation (echoing off of walls), when being heard by anAudioListener. Note that theAudioListeneralso needs itsAcousticSimulationEnabledproperty set totruefor the effects to occur.AudioInteractionGroup
: stringControls whichAudioListenersare capable of hearing thisAudioEmitter.If an
AudioEmitterand anAudioListenershare an interaction group, then the listener is capable of hearing the emitter.DistanceAttenuationBounds
: NumberRangeThe minimum and maximum distance range used by the selectedDistanceAttenuationModepreset.Specifies the
NumberRangethat defines the minimum and maximum distances for the distance attenuation preset selected byDistanceAttenuationMode. The emitter is at full volume when aAudioListeneris within the minimum distance and fully attenuated at or beyond the maximum distance. The attenuation curve between these bounds is determined by the chosenDistanceAttenuationMode.Defaults to a
NumberRangeof[4, 10000]. This property is only used whenDistanceAttenuationModeis set to a preset other thanDistanceAttenuationMode.Custom.DistanceAttenuationMode
: DistanceAttenuationModeDetermines how the volume of thisAudioEmitterattenuates over distance.Determines which formula is used to roll off the perceived volume of this
AudioEmitteras the distance from aAudioListenerincreases, viaDistanceAttenuationMode.When set to any value other than
DistanceAttenuationMode.Custom,DistanceAttenuationBoundsdefines the minimum and maximum distances for the rolloff, and the custom curve set bySetDistanceAttenuation()is ignored. Defaults toDistanceAttenuationMode.Custom.PositionInstance
: InstanceTheInstancewhose position and orientation is used as the emitter's position ifPositionTypeis set toEmitterPositionType.Instance.This property is only functional when
PositionTypeis set toEmitterPositionType.Instance. In that scenario, this property determines whichInstancewill be used to determine the position of spatial audio emitted by theAudioEmitterto be heard byAudioListeners.If set to an instance without a position or
nil, theAudioEmitterwill not be heard.PositionType
: EmitterPositionTypeDetermines how theAudioEmitterdetermines its 3D location.The method by which the
AudioEmitterdetermines its 3D location (the point from which audio can be heard by any nearbyAudioListeners). Defaults toEmitterPositionType.Parent.
Methods 9
GetAngleAttenuation
() → DictionaryGets the angle attenuation curve that theAudioEmitteris using, or an empty table if it's using the default curve.Returns a table mapping angle to volume. Keys are numbers between
0and180(inclusive), while values are numbers between0and1(inclusive) describing how volume attenuates depending on direction. This method returns an empty table if the default angle attenuation curve is being used.GetAudibilityFor
(listener: AudioListener) → floatCalculates how audible this emitter is for a particularAudioListener.Calculates how audible this emitter is for a particular
AudioListener. The resulting volume, ranging from0to1, accounts for distance and angle attenuation on both the emitter and listener.GetConnectedWires
(pin: string) → List<Wire>Returns an array ofWiresthat are connected to the specified pin.Returns an array of
Wiresthat are connected to the specified pin.AudioEmitterhas one "Input" pin.GetDistanceAttenuation
() → DictionaryGets the distance attenuation curve that theAudioEmitteris using, or an empty table if it's using the default curve.Returns a table mapping distance to volume. Keys are numbers greater than or equal to 0, while values are numbers between 0 and 1 (inclusive) describing how volume attenuates over distance. This method returns an empty table if the default distance attenuation curve is being used.
Note that this method always returns the custom curve set by
SetDistanceAttenuation(), regardless of the currentDistanceAttenuationModesetting. When a preset mode is active, the custom curve is not used for attenuation and this return value may not reflect the active rolloff behavior.GetInputPins
() → ArrayGets the list of pins thatWirecan use inWire.TargetNameto connect to this instance via itsWire.TargetInstanceproperty.Gets the list of pins that
Wirecan use inWire.TargetNameto connect to this instance via itsWire.TargetInstanceproperty.For
AudioEmitter, this isInputonly.GetInteractingListeners
() → List<AudioListener>Lists allAudioListenersthat are capable of hearing this emitter.Returns an array of
AudioListenersthat share anAudioInteractionGroupwith the emitter.GetOutputPins
() → ArrayGets the list of pins thatWirecan use inWire.SourceNameto connect to this instance via itsWire.SourceInstanceproperty.Gets the list of pins that
Wirecan use inWire.SourceNameto connect to this instance via itsWire.SourceInstanceproperty.For
AudioEmitter, there are none.SetAngleAttenuation
(curve: Dictionary) → ()Sets the angle attenuation curve that theAudioEmittershould use, or uses a constant curve of volume1if none is provided.Sets a volume-over-angle curve that affects how loudly a
AudioListenerwill hear theAudioEmitter, based on the angle between them and theLookVectorassociated with theAudioEmitter. Use this to model directional audio sources — for example, making an avatar's voice project more strongly in front of them, or having a monster's growl serve as a gameplay cue that it is facing the player.The curve is represented by a table mapping angle keys to volume values. Keys are expected to be unique numbers between
0and180(inclusive), while values are expected to be numbers between0and1(inclusive). Tables containing up to 400 key-value pairs are supported.The volume of the
AudioEmitterfrom the perspective of aAudioListenerat an angleais determined by linearly interpolating between the volume levels for the points on the curve whose angle values are directly above and belowa. If there is either no point belowaor no point abovea, the volume level of the other point is chosen. Essentially, the curve is a sequence of points connected by straight lines, and beyond its left and right endpoints the curve extends outward at their respective volume levels.This volume will be multiplied with the volumes from all other attenuation curves (including the ones on the receiving
AudioListener) to obtain the final audibility.If the table is empty or
nil, theAudioEmitterdefaults to using an angle attenuation curve with the constant volume value of1.SetDistanceAttenuation
(curve: Dictionary) → ()Sets the distance attenuation curve that theAudioEmittershould use, or uses an inverse rolloff curve if none is provided.Sets a volume-over-distance curve that affects how loudly a
AudioListenerwill hear theAudioEmitter, based on the distance between them. This curve is only used for attenuation whenDistanceAttenuationModeis set toDistanceAttenuationMode.Custom.The curve is represented by a table mapping distance keys to volume values. Keys are expected to be unique numbers greater than or equal to 0, while values are expected to be numbers between 0 and 1 (inclusive). Tables containing up to 400 key-value pairs are supported.
The volume of the
AudioEmitterfrom the perspective of aAudioListenerat a distancedis determined by linearly interpolating between the volume levels for the points on the curve whose distance values are directly above and belowd. If there is either no point belowdor no point aboved, the volume level of the other point is chosen. Essentially, the curve is a sequence of points connected by straight lines, and beyond its left and right endpoints the curve extends outward infinitely at their respective volume levels.This volume will be multiplied with the volumes from all other attenuation curves (including the ones on the receiving
AudioListener) to obtain the final audibility.If the table is empty or
nil, theAudioEmitterdefaults to using a distance attenuation curve determined by the inverse-square law.
Events 1
WiringChanged
AudioEmitter.WiringChanged:Connect(function(connected, pin, wire, instance))Fires when another instance is connected to or disconnected from theAudioEmittervia aWire.Event that fires after a
Wirebecomes connected or disconnected, and thatWireis now or was previously connected to a pin on theAudioEmitterand to some other wirable instance.
AudioEmitter 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.