Roblox UtilitiesDevlHub Roblox Documentation

Class

AudioEmitter

Inherits
Instance › Object
Memory category
Internal

Emits audio streams into the world.

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 9#

AcousticSimulationEnabledbooleanDetermines whether acoustic simulation should be used for this AudioEmitter.ReadSafe
AngleAttenuationBinaryStringRepresents how the perceived volume of the emitted sound changes based on the angle between a AudioListener and the LookVector associated with the AudioEmitter.Read: RobloxEngineSecurityWrite: RobloxEngineSecurityReadSafe
AudioInteractionGroupstringControls which AudioListeners are capable of hearing this AudioEmitter.ReadSafe
DistanceAttenuationBinaryStringRepresents how the perceived volume of the emitted sound changes as the distance between a AudioListener and the AudioEmitter increases.Read: RobloxEngineSecurityWrite: RobloxEngineSecurityReadSafe
DistanceAttenuationBoundsNumberRangeThe minimum and maximum distance range used by the selected DistanceAttenuationMode preset.ReadSafe
DistanceAttenuationModeDistanceAttenuationModeDetermines how the volume of this AudioEmitter attenuates over distance.ReadSafe
PositionInstanceInstanceThe Instance whose position and orientation is used as the emitter's position if PositionType is set to EmitterPositionType.Instance.ReadSafe
PositionTypeEmitterPositionTypeDetermines how the AudioEmitter determines its 3D location.ReadSafe
SimulationFidelityAudioSimulationFidelityControls how detailed the audio simulation should be for this AudioEmitter.ReadSafe

AcousticSimulationEnabled: boolean#

ReadSafe

Determines whether sound from this AudioEmitter shoud 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 an AudioListener. Note that the AudioListener also needs its AcousticSimulationEnabled property set to true for the effects to occur.

AngleAttenuation: BinaryString#

Read: RobloxEngineSecurityWrite: RobloxEngineSecurityReadSafe

Represents a volume-over-angle curve that affects how loudly a AudioListener will hear the AudioEmitter, based on the angle between them and the LookVector associated with the AudioEmitter.

This property is internal and can't be accessed by scripts; it exists to support replication. See SetAngleAttenuation() for usage details.

AudioInteractionGroup: string#

ReadSafe

If an AudioEmitter and an AudioListener share an interaction group, then the listener is capable of hearing the emitter.

DistanceAttenuation: BinaryString#

Read: RobloxEngineSecurityWrite: RobloxEngineSecurityReadSafe

Represents a volume-over-distance curve that affects how loudly a AudioListener will hear the AudioEmitter, based on the distance between them.

This property is internal and can't be accessed by scripts; it exists to support replication. See SetDistanceAttenuation() for usage details.

DistanceAttenuationBounds: NumberRange#

ReadSafe

Specifies the NumberRange that defines the minimum and maximum distances for the distance attenuation preset selected by DistanceAttenuationMode. The emitter is at full volume when a AudioListener is within the minimum distance and fully attenuated at or beyond the maximum distance. The attenuation curve between these bounds is determined by the chosen DistanceAttenuationMode.

Defaults to a NumberRange of [4, 10000]. This property is only used when DistanceAttenuationMode is set to a preset other than DistanceAttenuationMode.Custom.

DistanceAttenuationMode: DistanceAttenuationMode#

ReadSafe

Determines which formula is used to roll off the perceived volume of this AudioEmitter as the distance from a AudioListener increases, via DistanceAttenuationMode.

When set to any value other than DistanceAttenuationMode.Custom, DistanceAttenuationBounds defines the minimum and maximum distances for the rolloff, and the custom curve set by SetDistanceAttenuation() is ignored. Defaults to DistanceAttenuationMode.Custom.

PositionInstance: Instance#

ReadSafe

This property is only functional when PositionType is set to EmitterPositionType.Instance. In that scenario, this property determines which Instance will be used to determine the position of spatial audio emitted by the AudioEmitter to be heard by AudioListeners.

If set to an instance without a position or nil, the AudioEmitter will not be heard.

PositionType: EmitterPositionType#

ReadSafe

The method by which the AudioEmitter determines its 3D location (the point from which audio can be heard by any nearby AudioListeners). Defaults to EmitterPositionType.Parent.

SimulationFidelity: AudioSimulationFidelity#

DeprecatedReadSafe

Controls how detailed the audio simulation should be for this AudioEmitter, similar to MeshPart.CollisionFidelity or MeshPart.RenderFidelity.

AudioEmitters and AudioListeners which disagree on the necessary level of detail will use the less-detailed option.

Methods 9#

GetAngleAttenuationGets the angle attenuation curve that the AudioEmitter is using, or an empty table if it's using the default curve.CustomLuaState
GetAudibilityForCalculates how audible this emitter is for a particular AudioListener.
GetConnectedWiresReturns an array of Wires that are connected to the specified pin.
GetDistanceAttenuationGets the distance attenuation curve that the AudioEmitter is using, or an empty table if it's using the default curve.CustomLuaState
GetInputPinsGets the list of pins that Wire can use in Wire.TargetName to connect to this instance via its Wire.TargetInstance property.
GetInteractingListenersLists all AudioListeners that are capable of hearing this emitter.
GetOutputPinsGets the list of pins that Wire can use in Wire.SourceName to connect to this instance via its Wire.SourceInstance property.
SetAngleAttenuationSets the angle attenuation curve that the AudioEmitter should use, or uses a constant curve of volume 1 if none is provided.CustomLuaState
SetDistanceAttenuationSets the distance attenuation curve that the AudioEmitter should use, or uses an inverse rolloff curve if none is provided.CustomLuaState

GetAngleAttenuation(): Dictionary#

CustomLuaState

Returns a table mapping angle to volume. Keys are numbers between 0 and 180 (inclusive), while values are numbers between 0 and 1 (inclusive) describing how volume attenuates depending on direction. This method returns an empty table if the default angle attenuation curve is being used.

Returns
  • Dictionary — Table mapping angle to volume, as described above.

GetAudibilityFor(listener: AudioListener): float#

Calculates how audible this emitter is for a particular AudioListener. The resulting volume, ranging from 0 to 1, accounts for distance and angle attenuation on both the emitter and listener.

NameTypeDefaultDescription
listenerAudioListenerThe AudioListener to calculate audibility for.
Returns
  • float — A number between 0 and 1 representing the combined volume after distance and angle attenuation.

GetConnectedWires(pin: string): List<Wire>#

Returns an array of Wires that are connected to the specified pin. AudioEmitter has one "Input" pin.

NameTypeDefaultDescription
pinstringAn input or output pin on this instance
Returns
  • List<Wire> — An array of Wires

GetDistanceAttenuation(): Dictionary#

CustomLuaState

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 current DistanceAttenuationMode setting. 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.

Returns
  • Dictionary — A table mapping distance to volume, as described above.

GetInputPins(): Array#

Gets the list of pins that Wire can use in Wire.TargetName to connect to this instance via its Wire.TargetInstance property.

For AudioEmitter, this is Input only.

Returns
  • Array — An array of strings representing valid pin names.

GetInteractingListeners(): List<AudioListener>#

Returns an array of AudioListeners that share an AudioInteractionGroup with the emitter.

Returns

GetOutputPins(): Array#

Gets the list of pins that Wire can use in Wire.SourceName to connect to this instance via its Wire.SourceInstance property.

For AudioEmitter, there are none.

Returns
  • Array — An array of strings representing valid pin names.

SetAngleAttenuation(curve: Dictionary): ()#

CustomLuaState

Sets a volume-over-angle curve that affects how loudly a AudioListener will hear the AudioEmitter, based on the angle between them and the LookVector associated with the AudioEmitter. 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 0 and 180 (inclusive), 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 AudioEmitter from the perspective of a AudioListener at an angle a is determined by linearly interpolating between the volume levels for the points on the curve whose angle values are directly above and below a. If there is either no point below a or no point above a, 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, the AudioEmitter defaults to using an angle attenuation curve with the constant volume value of 1.

NameTypeDefaultDescription
curveDictionaryA table mapping angle to volume. Keys are numbers between 0 and 180, values are numbers between 0 and 1.
Returns
  • ()

SetDistanceAttenuation(curve: Dictionary): ()#

CustomLuaState

Sets a volume-over-distance curve that affects how loudly a AudioListener will hear the AudioEmitter, based on the distance between them. This curve is only used for attenuation when DistanceAttenuationMode is set to DistanceAttenuationMode.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 AudioEmitter from the perspective of a AudioListener at a distance d is determined by linearly interpolating between the volume levels for the points on the curve whose distance values are directly above and below d. If there is either no point below d or no point above d, 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, the AudioEmitter defaults to using a distance attenuation curve determined by the inverse-square law.

NameTypeDefaultDescription
curveDictionaryA table mapping distance to volume. Keys are numbers greater than or equal to 0, values are numbers between 0 and 1.
Returns
  • ()

Events 1#

WiringChangedFires when another instance is connected to or disconnected from the AudioEmitter via a Wire.

WiringChanged(connected: boolean, pin: string, wire: Wire, instance: Instance)#

Event that fires after a Wire becomes connected or disconnected, and that Wire is now or was previously connected to a pin on the AudioEmitter and to some other wirable instance.

NameTypeDefaultDescription
connectedbooleanWhether the instance got connected or disconnected.
pinstringThe pin on the AudioEmitter that the Wire targets.
wireWireThe Wire between the AudioEmitter and the other instance.
instanceInstanceThe other instance that is or was connected through the Wire.

Inherited members#

Inherited from Instance 58
Inherited from Object 6
Properties (2)

ClassName, className

Events (1)

Changed