Hello devs!
Hope this isn’t asking for too much but I am wondering how I would add voice effects/filters like the AudioPitchShifter using the new Audio API. I setup the character like below (localscript)
local players = game:GetService("Players")
local function connect(src: Instance, dst: Instance)
local wire = Instance.new("Wire", dst)
wire.SourceInstance = src
wire.TargetInstance = dst
end
local function onCharacterSpawned(from: Player, character: Model)
local emitter = Instance.new("AudioEmitter", character)
emitter.AudioInteractionGroup = "Player"
emitter.Name = "Emittah"
connect(from.MicrophoneInput, emitter)
local listener = Instance.new("AudioListener", character)
listener.AudioInteractionGroup = "Player"
local deviceOutput = Instance.new("AudioDeviceOutput", listener)
connect(listener, deviceOutput)
local analyzer = Instance.new("AudioAnalyzer", character)
connect(from.MicrophoneInput, analyzer)
end
local function onPlayerAdded(player: Player)
local input = Instance.new("AudioDeviceInput", player)
input.Name = "MicrophoneInput"
if player.Character then
onCharacterSpawned(player, player.Character)
end
player.CharacterAdded:Connect(function()
onCharacterSpawned(player, player.Character)
end)
end
players.PlayerAdded:Connect(onPlayerAdded)
for _, player in players:GetPlayers() do
onPlayerAdded(player)
end
Hopefully this isn’t asking for too much! Thank you.