Skip to content

Class · inherits Instance

AudioEmitter

Official docs ↗

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

Methods 9

  • GetAngleAttenuation() → DictionaryGets the angle attenuation curve that the AudioEmitter is using, or an empty table if it's using the default curve.

    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.

  • GetAudibilityFor(listener: AudioListener) → floatCalculates how audible this emitter is for a particular AudioListener.

    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.

  • GetConnectedWires(pin: string) → List<Wire>Returns an array of Wires that are connected to the specified pin.

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

  • GetDistanceAttenuation() → DictionaryGets the distance attenuation curve that the AudioEmitter is 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 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.

  • GetInputPins() → ArrayGets the list of pins that Wire can use in Wire.TargetName to connect to this instance via its Wire.TargetInstance property.

    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.

  • GetInteractingListeners() → List<AudioListener>Lists all AudioListeners that are capable of hearing this emitter.

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

  • GetOutputPins() → ArrayGets the list of pins that Wire can use in Wire.SourceName to connect to this instance via its Wire.SourceInstance property.

    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.

  • SetAngleAttenuation(curve: Dictionary) → ()Sets the angle attenuation curve that the AudioEmitter should use, or uses a constant curve of volume 1 if none is provided.

    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.

  • SetDistanceAttenuation(curve: Dictionary) → ()Sets the distance attenuation curve that the AudioEmitter should use, or uses an inverse rolloff curve if none is provided.

    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.

Events 1

  • WiringChangedAudioEmitter.WiringChanged:Connect(function(connected, pin, wire, instance))Fires when another instance is connected to or disconnected from the AudioEmitter via a Wire.

    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.

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.