That’s something that should be implemented with AudioFaders
, too, if it isn’t already.
When trying to help out another developer with increasing Voice Chat volume, I accidentally found out that it’s possible to output pretty loud sounds through chaining multiple AudioFaders
together.
I revisited it today after reading your post and found out that I had originally set up the code incorrectly (it wasn’t connecting all of the AudioFaders
that were created). After editing it, half a dozen AudioFaders
made it possible for the RmsLevel
to reach the 100+ range.
- It’s probably already being clipped to a certain degree but I haven’t dared to turn up the volume of my speakers beyond the lowest settings to find out for sure. It’s still very loud on low speaker settings, even if it’s being clipped.
In the example code below, replace the value of the numberOfAudioFadersToCreate
variable with however many AudioFaders
you want it to create.
With 3 or more AudioFaders
set to the max volume, it is pretty intense, so make sure to lower your volume before testing anything.
Here’s an example that can be tested out in a solo playtest:
(Note for anyone testing this: Because the standard voice chat UI does not appear in solo playtests, make sure to manually go into the Players service and enable the “Active” property for your player’s AudioDeviceInput via the client-side. Otherwise, you can enable Team Create and run a “Team Test” and the voice chat UI that you would typically see in a live server should appear):
Script #1 (Server Script in ServerScriptService
)
local Players = game:GetService("Players")
---
local numberOfAudioFadersToCreate = 0 -- Replace the number with how many AudioFaders you want to use
---
local function connectWires(source, destination)
local wire = Instance.new("Wire")
wire.SourceInstance = source
wire.TargetInstance = destination
wire.Parent = destination
end
local function onPlayerAdded(player)
local audioDeviceInput = Instance.new("AudioDeviceInput")
audioDeviceInput.Name = "AudioDeviceInput_VolumeTesting!"
audioDeviceInput.Player = player
audioDeviceInput.Parent = player
local audioDeviceOutput = Instance.new("AudioDeviceOutput")
audioDeviceOutput.Name = "AudioDeviceOutput_VolumeTesting!"
audioDeviceOutput.Player = player
audioDeviceOutput.Parent = player
-- Note: The RmsLevel of the AudioAnalyzer will need to be read from a client-sided script
local audioAnalyzer = Instance.new("AudioAnalyzer")
audioAnalyzer.Name = "AudioAnalyzer_VolumeTesting!"
audioAnalyzer.Parent = player
local function createAudioFaders(numberToCreate)
if numberToCreate == 0 then
warn("Not creating any AudioFaders")
connectWires(audioDeviceInput, audioAnalyzer)
connectWires(audioDeviceInput, audioDeviceOutput)
return
end
local lastAudioFader
for currentCount = 1, numberToCreate do
local audioFader = Instance.new("AudioFader")
audioFader.Name = "AudioFader"..currentCount.."_VolumeTesting!"
audioFader.Volume = 3
local previousAudioFader = audioDeviceInput:FindFirstChild("AudioFader"..(currentCount - 1).."_VolumeTesting!", true) -- Edit: Updated to include recursive search
if previousAudioFader then
connectWires(previousAudioFader, audioFader)
audioFader.Parent = previousAudioFader
else
connectWires(audioDeviceInput, audioFader)
audioFader.Parent = audioDeviceInput
end
lastAudioFader = audioFader
print(currentCount)
end
connectWires(lastAudioFader, audioAnalyzer)
connectWires(lastAudioFader, audioDeviceOutput)
warn("Done")
end
createAudioFaders(numberOfAudioFadersToCreate)
end
Players.PlayerAdded:Connect(onPlayerAdded)
for _, player in Players:GetPlayers() do
task.spawn(onPlayerAdded, player)
end
Script #2 (LocalScript in StarterPlayerScripts
)
local Players = game:GetService("Players")
local player = Players.LocalPlayer
local audioAnalyzer = player:WaitForChild("AudioAnalyzer_VolumeTesting!")
print("Starting audio analysis")
task.wait(5)
while true do
task.wait()
print(audioAnalyzer.RmsLevel)
end