Voice Chat Calling/Radios

Hello

With the new audio api, it’s possible to make voice chat calls and radios, but I’m struggling to use it :man_facepalming:

I’ve tried connecting AudioDeviceInput and AudioEmitter together with wires n stuff but it’s not transmitting any sound through.

Mostly just want help understanding how it works.

This is the code I’ve tried

game.ReplicatedStorage.Events.VoiceConnectEvent.OnServerEvent:Connect(function(plr: Player, target: Player)
	local p1VoiceInput = Instance.new("AudioListener")
	local p1VoiceOutput = Instance.new("AudioEmitter")
	p1VoiceInput.Parent = plr.Character.Head
	p1VoiceOutput.Parent = plr.Character.Head

	local p2VoiceInput = Instance.new("AudioListener")
	local p2VoiceOutput = Instance.new("AudioEmitter")
	p2VoiceInput.Parent = target.Character.Head
	p2VoiceOutput.Parent = target.Character.Head

	local p1ListenWire = Instance.new("Wire")
	local p2ListenWire = Instance.new("Wire")

	p1ListenWire.SourceInstance = p1VoiceInput
	p1ListenWire.TargetInstance = p2VoiceOutput
	p1ListenWire.Parent = p1VoiceInput

	p2ListenWire.SourceInstance = p2VoiceInput
	p2ListenWire.TargetInstance = p1VoiceOutput
	p2ListenWire.Parent = p2VoiceInput
end)

What I’ve seen so far from the documentation, audioDeviceInput should be connected to an AudioEmitter connected by a wire. Then, you set the player in the audioDeviceInput to the person you want to record the voice of. the AudioEmitter should be the child of the radio that you want to receive the sound of. You can apply effects as well to make it sound like a radio