AudioAnalyzer.RmsLevel/PeakLevel is Always 0 When Listening to AudioDeviceInput

I’ve been trying to use Roblox’s new audio API, but I can’t seem to actually get it to read anything from AudioDeviceInput. My microphone is functional, VoiceChatService has audio API enabled, and I can’t see any issues with my code. What am I missing?

--Server Script in ServerScriptService
Players.PlayerAdded:Connect(function(Player)
	local AudioDeviceInput = Instance.new("AudioDeviceInput")
	AudioDeviceInput.Parent = Player
	AudioDeviceInput.Player = Player
	
	local AudioAnalyzer = Instance.new("AudioAnalyzer")
	AudioAnalyzer.Parent = Player
	
	local Wire = Instance.new("Wire")
	Wire.Parent = Player
	Wire.SourceInstance = AudioDeviceInput
	Wire.TargetInstance = AudioAnalyzer

	-- AudioDeviceInput -> AudioAnalyzer
	
	while true do
		print(AudioAnalyzer.RmsLevel) -- this always prints 0
		task.wait()
	end
end)

This is currently seemingly intentional, it is true in all cases (you can’t even use AudioListener outputs if they include voice data)

Not sure exactly why, but if I had to guess, my best guess is due to differences in:

  1. Sampling rates - could potentially cause performance issues depending on their FFT implementation; not sure.

  2. No fixed timespan for sampling - Extremely likely that it’s this - FFT sampling depends on the time and frequency domain for what we’re presented with by AudioAnalyzers. Actual audios (such as songs) have lengths, and current time spots, which is not a necessity for FFT analysis, but otherwise requires buffering the audio stream, which adds latency and another complexity to the code. Likely the issue, if I had to guess.

1 Like

Is this removed functionality? When I broke down and resorted to a Youtube tutorial from 3 months ago his AudioAnalyzer connected to an AudioDeviceInput was working just fine.

Yes, unfortunately but I do not believe they removed it intentionally. If I recall correctly, it is potentially going to be added back and broke as a result of optimizations, there should be some info if you search for it on the Audio API announcement.

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.