I’m trying to make an obby game like “Voice Control [WORLD 2 UPDATE]” where the game detects voice inputs from the voicechatservice and runs some functions if there’s audio/voice present.
after some research I figured that the only way to do this is to use the beta AudioAPI but I couldn’t figure out how to achieve this goal. I know that it’s possible because the game I mentioned does it.
local Input = game.Players.LocalPlayer.AudioDeviceInput
local AudioAnalyzer = Instance.new("AudioAnalyzer",game.Players.LocalPlayer.Character)
local Wire = Instance.new("Wire",game.Players.LocalPlayer.Character)
Wire.SourceInstance = Input
Wire.TargetInstance = AudioAnalyzer
while wait() do
print(AudioAnalyzer.RmsLevel)
end
It’s not recommended to use wait() in today’s standards, use task.wait() instead.
Since it doesn’t require yielding you can use RunService.RenderStepped instead of a while loop.
If you want a bit unique way you can pick an average between PeakLevel and RmsLevel. i said that last sentence because i’m also working on another form of a voice-controlled movement game