I saw the new audio API, and saw others making a voice chat radio with it? The new API is kinda difficult to understand and I need help adding voice chat to my radio. Please help!
This is my current system:
it has a chat system with a mute button (activation) video
Please help again. I need someone to guide me through the voice api and the voice chat stuff. I just need the voice chat to not only talk from the character, but with the player as well!
From looking at the roblox api reference for a little bit, it looks like you should only need an AudioDeviceInput, and an AudioEmitter. Connect them together with a Wire.
I’ve already tried this before, and looked at many tutorials! I’m not sure as to why it doesn’t work, though I’ve looked at example places and such and tried the most simplest thing: An AudioDeviceInput connected to an AudioEmitter with a Wire. I made a testing place for this and this is the script:
function connectDevices(src, target)
local wire = Instance.new("Wire")
wire.Parent = target
wire.SourceInstance = src
wire.TargetInstance = target
end
game.Players.PlayerAdded:Connect(function(player)
-- Create a new AudioDeviceInput
local micIn = Instance.new("AudioDeviceInput")
micIn.Parent = player
micIn.Player = player
micIn.Muted = false
-- Assign a CharacterAdded event incase the player dies and respawns
player.CharacterAdded:Connect(function(character)
-- Make a new AudioEmitter with its Parent being the Character
local emitter = Instance.new("AudioEmitter")
emitter.Parent = character:WaitForChild("Head")
-- Connect the devices together
connectDevices(micIn, emitter)
connectDevices(micIn, workspace.Part.AudioEmitter) -- I added this for testing; I made a part in workspace and added an AudioEmitter
end)
end)
If I’m not mistaken, this should work in theory. Although I tested this in a live Roblox server and I don’t hear my voice coming out of that part.
This might be because of the newly added DistanceAttenuation property but i setted it to something like
this much and it still doesnt work. and I even made matching groups. I do not know what is going on and this is so confusing!
This script is a bit of a mess, but can you run this and see if it works? It works for me, and depending on if it works for you too, we’re close to pinpointing the issue for you (whether it’s in the script or an out the script configuration)
i recently got myself a system that can replay my voice and recreates the voice chat system. ill look into adding that script in a bit before i try something my own because im finally getting somewhere with this.
How did you implement that script? I have been triying to also make a radio (In this case a CB RADIO for vehicles) as i have played games that have radio between players, but i havent got anything close
uhh kinda. I used audio api to recreate voice chat using micinputs, wires, and emitters inside characters. and a specific voice chat listener inside the camera. if you could do that then maybe try wiring the output to an emitter somewhere else (like a radio part).
Hi! You probably made one by now, but if you haven’t, here is what you should do:
First things first, you have to have an AudioDeviceInput which, as the name suggests, picks up the player’s microphone input. You have to make one for every player when they join.
A radio AudioFader. This will serve as the base. You can make one in the workspace, and use that, if you are not planning on adding channels.
An AudioDeviceOutput for every player. This will forward the voice message to whatever your audio output is [headphones, speakers, etc.].
Wires for connecting inputs to the emitter and emitter to the output.
Now you have the basic instances you should have. I think you will be able to construct your system now. Just make sure you are changing on the server.
Hello! So yeah, i figured it out a while back, and in return it also let me understand a lot more of the features for the newer audio APIs that roblox released. Thanks a lot for helping though!
I was able to do this all on the client, and i essentially made it automatically wire every AudioDeviceInput from every player instance (its default with vc enabled) into the audioFader which then goes towards another audio fader then into the audio emitter (given that the client has Voice Chat Enabled)
i would make the main fader 1 or 0 depending on wether the radio is equipped, and then for each of the other faders, they will be 1 or 0 depending on wether that they have the radio tool in their character
there’s so many cool things that you can do with the newer audio instances though.
again, thanks for assisting me