AudioDeviceInput

Show Deprecated

AudioDeviceInput produces audio streams from physical devices, such as microphones. It provides a single Output pin which can be connected to other pins via Wires. AudioDeviceInput has properties for selecting which Player is producing the stream, and controlling whether or not they are muted.

Summary

Properties

Methods

Events

Properties

Read Parallel

Determines whether the list of user IDs provided to SetUserIdAccessList is treated as an allow-list or deny-list.

If AccessType is Enum.AccessModifierType.Allow, then only the supplied user IDs are permitted to hear this AudioDeviceInput. If AccessType is Enum.AccessModifierType.Deny, then only the supplied user IDs are blocked from hearing this AudioDeviceInput.

Since player voices are networked, this property should only be assigned from the server in order to replicate properly.

Active

Roblox Script Security
Read Parallel

Controls whether the physical device is actively recording. This property is only set by Roblox core scripts, but it may be read by user scripts. Generally, an AudioDeviceInput may only be producing sound if Active is true and Muted is false.

IsReady

Read Only
Not Replicated
Roblox Script Security
Read Parallel

Denotes whether this AudioDeviceInput is ready to produce sound, meaning all network connections have been established.

Muted

Read Parallel

Controls whether this AudioDeviceInput is muted. Unlike Active, this property is publicly scriptable.

Generally, an AudioDeviceInput may only be heard if Active is true and Muted is false.

Code Samples

Push-to-talk

local players = game:GetService("Players")
local userInput = game:GetService("UserInputService")
local audioIn : AudioDeviceInput = players.LocalPlayer:WaitForChild("AudioDeviceInput")
audioIn.Muted = true
local pushToTalkKey = Enum.KeyCode.V
userInput.InputBegan:Connect(function(input: InputObject)
if input.KeyCode == pushToTalkKey then
audioIn.Muted = false
end
end)
userInput.InputEnded:Connect(function(input: InputObject)
if input.KeyCode == pushToTalkKey then
audioIn.Muted = true
end
end)

MutedByLocalUser

Not Replicated
Roblox Script Security
Read Parallel

Player

Read Parallel

Determines whose device is producing sound. In order to replicate properly, this should only be assigned from the server. Assigning this property locally generally does not work, unless Player is Players.LocalPlayer.

Volume

Read Parallel

Volume level which is multiplied onto the output audio stream. Ranges from 0 to 3.

Methods

GetConnectedWires

Instances

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

Parameters

pin: string

Returns

Instances

GetUserIdAccessList

Returns a list of user IDs that are either permitted to hear or blocked from hearing this AudioDeviceInput, depending on the AccessType.


Returns

SetUserIdAccessList

void

Sets a list of user IDs that are either permitted to hear or blocked from hearing this AudioDeviceInput, depending on the AccessType.

Note that this method replicates from server to client; in general, it should only be called from the server in order to replicate properly.

Parameters

userIds: Array

Returns

void

Events

WiringChanged

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

Parameters

connected: bool

Whether the instance got connected or disconnected.

pin: string

The pin on the AudioDeviceInput that the Wire targets.

wire: Wire

The Wire between the AudioDeviceInput and the other instance.

instance: Instance

The other instance that is or was connected through the Wire.