# AudioListener

AudioListener records an audio stream from its surrounding AudioEmitters in the 3D world. It provides a single Output pin which can be connected to other pins via Wires. If the parent is an Attachment, Camera, or PVInstance, the parent's world CFrame will be used for listening. If the parent is not one of these classes, the AudioListener effectively hears nothing.

#### Code Samples

```
local listener = Instance.new("AudioListener")
local output = Instance.new("AudioDeviceOutput")
local wire = Instance.new("Wire")
listener.Parent = workspace.Camera
wire.Parent = listener
output.Parent = wire
wire.SourceInstance = listener
wire.TargetInstance = output
```

## Summary

### Properties

Represents how the perceived volume of the emitted sound changes based on the angle between a AudioEmitter and the LookVector associated with the AudioListener.

Controls which AudioEmitters are audible to this AudioListener.

Represents how the perceived volume of emitted sounds change as the distance between AudioEmitters and the AudioListener increases.

### Methods

Gets the angle attenuation curve that the AudioListener is using, or an empty table if it's using the default curve.

Returns an array of Wires that are connected to the specified pin.

Gets the distance attenuation curve that the AudioListener is using, or an empty table if it's using the default curve.

Sets the angle attenuation curve that the AudioListener should use, or uses a constant curve of volume 1 if none is provided.

Sets the distance attenuation curve that the AudioListener should use, or uses an inverse rolloff curve if none is provided.

## Properties

### AngleAttenuation

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 AudioListener.

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

### AudioInteractionGroup

Controls which AudioEmitters are audible to this AudioListener. Emitters that share an interaction group can be heard by this Listener.

### DistanceAttenuation

Represents a volume-over-distance curve that affects how loudly the AudioListener hears any AudioEmitters, 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.

## Methods

### GetAngleAttenuation

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

Table mapping angle to volume, as described above.

### GetConnectedWires

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

#### Parameters

#### Returns

### GetDistanceAttenuation

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.

#### Returns

### GetInteractingEmitters

#### Returns

### SetAngleAttenuation

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 AudioListener.

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 a AudioEmitter from the perspective of the 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 sending AudioEmitter) 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.

#### Parameters

#### Returns

### SetDistanceAttenuation

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

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 a AudioEmitter from the perspective of the 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 sending AudioEmitter) to obtain the final audibility.

If the table is empty or nil, the AudioListener defaults to applying a constant volume of 1 everywhere.