roblox has released the audio API, and with it comes a plethora of new features! this includes an AudioAnalyzer. what the AudioAnalyzer lets you do is detect volume and pitch changes in sounds. amazing, so i can detect volume and pitch from my microphone! one small issue… it doesn’t work. in my setup, i have this code:
local rep = game:GetService("ReplicatedStorage")
local analyzers = rep:WaitForChild("Analyzers")
local players = game:GetService("Players")
players.PlayerAdded:Connect(function(player)
local audio_device_input = player:WaitForChild("AudioDeviceInput")
local analyzer = Instance.new("AudioAnalyzer")
analyzer.Name = `{player.Name}'s Analyzer`
analyzer.Parent = analyzers
local wire = Instance.new("Wire")
wire.SourceInstance = audio_device_input
wire.TargetInstance = analyzer
wire.Parent = analyzer
end)
i tried to just grab the analyzer and use the :GetSpectrum()
method to return the frequencies (pitches). but it didn’t work? after some digging i found this:
“If any of the analyzer’s inputs come from an
AudioDeviceInput
, this method returns an empty array”. huh.
so i guess my two questions are:
- why can i not use an audiodeviceinput?
- are there are alternatives?
thanks for reading