Voice chat VAD incorrectly cuts off sustained sounds/singing

When a player holds a sustained sound (I used “eeeeeeee” for my test) Roblox’s voice chat cuts the audio output on and off rapidly, making it sound choppy to other players. Note that this happens EVEN when when the microphone is clearly still picking up signal. If this is in any way intended, my apologies.

My test:
I used AudioAnalyzer.RmsLevel for monitoring ; The RMS stays steady for most of the time (0.02-0.06) during the sustained sound, but the audio output drops to near zero (0.00006-0.009) for 70ms-170ms intervals before snapping back instantly. This must mean the mic is not cutting out, but the signal is being gated incorrectly. The script will print “NOOOOOOOOOOOOOOOOOOOOOOOOOOOOO” if the RMS is <threshold, and “detect” when RMS is >threshold.

This is my localscript in starterplayerscripts

local RunService = game:GetService("RunService")
local player = Players.LocalPlayer
local THRESHOLD = 0.01 
local deviceInput = player:FindFirstChildWhichIsA("AudioDeviceInput", true)

local function setup()
	local analyzer = Instance.new("AudioAnalyzer")
	analyzer.Parent = player

	local wire = Instance.new("Wire")
	wire.SourceInstance = deviceInput
	wire.TargetInstance = analyzer
	wire.Parent = player

	local lastState = nil

	RunService.Heartbeat:Connect(function()
		local rms = analyzer.RmsLevel
		if rms > THRESHOLD then
			print("detect | RMS:", rms)
		else
			print("NOOOOOOOOOOOOOOOOOOOOOOOOOOOOO | RMS:", rms)
		end
	end)
end


if deviceInput then
	setup()
else
	player.DescendantAdded:Connect(function(obj)
		if obj:IsA("AudioDeviceInput") then
			task.wait()
			setup()
		end
	end)
end

The logs are in reality longer, but this is one snippet of it:

 22:52:34.299  detect | RMS: 0.050791140645742416  -  Client
  22:52:34.311   ▶ detect | RMS: 0.041841574013233185 (x2)  -  Client
  22:52:34.334   ▶ detect | RMS: 0.047959595918655396 (x2)  -  Client
  22:52:34.357   ▶ detect | RMS: 0.05280432105064392 (x2)  -  Client
  22:52:34.379   ▶ detect | RMS: 0.042828332632780075 (x2)  -  Client
  22:52:34.405   ▶ detect | RMS: 0.027904702350497246 (x2)  -  Client
  22:52:34.429  NOOOOOOOOOOOOOOOOOOOOOOOOOOOOO | RMS: 0.0025535679887980223  -  Client
  22:52:34.441   ▶ NOOOOOOOOOOOOOOOOOOOOOOOOOOOOO | RMS: 0.0014048733282834291 (x2)  -  Client
  22:52:34.463   ▶ NOOOOOOOOOOOOOOOOOOOOOOOOOOOOO | RMS: 0.0006308575393632054 (x2)  -  Client
  22:52:34.488  NOOOOOOOOOOOOOOOOOOOOOOOOOOOOO | RMS: 0.002865952905267477  -  Client
  22:52:34.500   ▶ detect | RMS: 0.016754256561398506 (x2)  -  Client
  22:52:34.525   ▶ detect | RMS: 0.042630910873413086 (x2)  -  Client
  22:52:34.548   ▶ detect | RMS: 0.06120341271162033 (x2)  -  Client
  22:52:34.572   ▶ detect | RMS: 0.055911555886268616 (x2)  -  Client
  22:52:34.596   ▶ detect | RMS: 0.05204560607671738 (x2)  -  Client
  22:52:34.619  detect | RMS: 0.041877906769514084  -  Client
  22:52:34.631   ▶ detect | RMS: 0.02516060322523117 (x2)  -  Client
  22:52:34.657   ▶ detect | RMS: 0.01089626457542181 (x2)  -  Client
  22:52:34.681  detect | RMS: 0.017438475042581558  -  Client
  22:52:34.691   ▶ detect | RMS: 0.04780573397874832 (x3)  -  Client
  22:52:34.728  detect | RMS: 0.05090177059173584  -  Client
  22:52:34.740   ▶ detect | RMS: 0.03535698726773262 (x2)  -  Client
  22:52:34.765   ▶ detect | RMS: 0.05425887927412987 (x2)  -  Client
  22:52:34.790  detect | RMS: 0.04101049527525902  -  Client
  22:52:34.802   ▶ detect | RMS: 0.03754841908812523 (x2)  -  Client
  22:52:34.827  NOOOOOOOOOOOOOOOOOOOOOOOOOOOOO | RMS: 0.0004294553364161402  -  Client
  22:52:34.840   ▶ NOOOOOOOOOOOOOOOOOOOOOOOOOOOOO | RMS: 0.00006978784949751571 (x2)  -  Client
  22:52:34.863   ▶ NOOOOOOOOOOOOOOOOOOOOOOOOOOOOO | RMS: 0.00006477267015725374 (x3)  -  Client
  22:52:34.901  NOOOOOOOOOOOOOOOOOOOOOOOOOOOOO | RMS: 0.00012356984370853752  -  Client
  22:52:34.913   ▶ NOOOOOOOOOOOOOOOOOOOOOOOOOOOOO | RMS: 0.0004090918228030205 (x2)  -  Client
  22:52:34.938  NOOOOOOOOOOOOOOOOOOOOOOOOOOOOO | RMS: 0.0013990282313898206  -  Client
  22:52:34.951   ▶ NOOOOOOOOOOOOOOOOOOOOOOOOOOOOO | RMS: 0.0006292855832725763 (x2)  -  Client
  22:52:34.974   ▶ NOOOOOOOOOOOOOOOOOOOOOOOOOOOOO | RMS: 0.00007216485391836613 (x2)  -  Client
  22:52:34.998  NOOOOOOOOOOOOOOOOOOOOOOOOOOOOO | RMS: 0.0013439897447824478  -  Client
  22:52:35.010   ▶ NOOOOOOOOOOOOOOOOOOOOOOOOOOOOO | RMS: 0.00966156367212534 (x3)  -  Client
  22:52:35.048  detect | RMS: 0.04116058349609375  -  Client
  22:52:35.060   ▶ detect | RMS: 0.055716272443532944 (x2)  -  Client
  22:52:35.085   ▶ detect | RMS: 0.05740295723080635 (x2)  -  Client

Expected behavior

Sustained sounds should always have a steady RMS (considering the user keeps it steady), and should not drop to near zero when no changes in input were actually made.

Thanks for the report @kuritigu we will try to repro.

Any progress?
char limit char limit

Hi Kuritigu!
I just got to take a look at this this morning (sorry for the delay, we are working on a LOT of things!). So I was able to reproduce it relatively easily. I’ll take a deeper look at the root cause, but what I have been seeing is a sustained “eeee” eventually leads to the VAD cutting out. Realistically, this might be an issue we can’t fix because most VAD’s recognize steady state sounds as background sounds, so it’s pretty standard for VAD’s to cut out after a while.
HOWEVER, you reported the audio being choppy - or switching off and on rapidly. That indicates it isn’t a steady state and that could be a problem we can address - if we can reproduce it.
Right now all of my logs are coming though like this:

11:06:33.213  detect | RMS: 0.011015196330845356  -  Client - LocalScript:21
  11:06:33.242  detect | RMS: 0.010996868833899498  -  Client - LocalScript:21
  11:06:33.280  detect | RMS: 0.011043168604373932  -  Client - LocalScript:21
  11:06:33.310  detect | RMS: 0.010930374264717102  -  Client - LocalScript:21
  11:06:33.347  detect | RMS: 0.010927382856607437  -  Client - LocalScript:21
  11:06:33.374  detect | RMS: 0.01075725071132183  -  Client - LocalScript:21
  11:06:33.414  detect | RMS: 0.011276046745479107  -  Client - LocalScript:21
  11:06:33.442  detect | RMS: 0.011431822553277016  -  Client - LocalScript:21
  11:06:33.479  detect | RMS: 0.011158275417983532  -  Client - LocalScript:21
  11:06:33.510  detect | RMS: 0.010290228761732578  -  Client - LocalScript:21
  11:06:33.545  NOOOOOOOOOOOOOOOOOOOOOOOOOOOOO | RMS: 0.009905884973704815  -  Client - LocalScript:23
  11:06:33.582  NOOOOOOOOOOOOOOOOOOOOOOOOOOOOO | RMS: 0.009973824955523014  -  Client - LocalScript:23
  11:06:33.607  NOOOOOOOOOOOOOOOOOOOOOOOOOOOOO | RMS: 0.009588147513568401  -  Client - LocalScript:23
  11:06:33.644  NOOOOOOOOOOOOOOOOOOOOOOOOOOOOO | RMS: 0.009083126671612263  -  Client - LocalScript:23
  11:06:33.677  NOOOOOOOOOOOOOOOOOOOOOOOOOOOOO | RMS: 0.008205953985452652  -  Client - LocalScript:23
  11:06:33.714  NOOOOOOOOOOOOOOOOOOOOOOOOOOOOO | RMS: 0.008082854561507702  -  Client - LocalScript:23
  11:06:33.744  NOOOOOOOOOOOOOOOOOOOOOOOOOOOOO | RMS: 0.007893959060311317  -  Client - LocalScript:23
  11:06:33.780  NOOOOOOOOOOOOOOOOOOOOOOOOOOOOO | RMS: 0.007722657639533281  -  Client - LocalScript:23
  11:06:33.810  NOOOOOOOOOOOOOOOOOOOOOOOOOOOOO | RMS: 0.006183355115354061  -  Client - LocalScript:23
  11:06:33.848  NOOOOOOOOOOOOOOOOOOOOOOOOOOOOO | RMS: 0.004857848864048719  -  Client - LocalScript:23
  11:06:33.874  NOOOOOOOOOOOOOOOOOOOOOOOOOOOOO | RMS: 0.0038544340059161186  -  Client - LocalScript:23
  11:06:33.912  NOOOOOOOOOOOOOOOOOOOOOOOOOOOOO | RMS: 0.003091830527409911  -  Client - LocalScript:23

There’s a clear break where the VAD goes to steady state suppression. That’s behaving as expected. I will keep working with it to see if I can reproduce the choppiness you reported.

Thanks, and I’ll get back to you when I have more!

Okay, after a couple hours (and some annoyed coworkers hearing me say “Eeeeeee”) I haven’t seen any choppiness, just the cut outs. Can you give me any specifics on when/how you were able to get the choppy behavior?

So so sorry for the delay (I thought this bug had been abandoned), I simply opened a new place in Roblox Studio, pasted in the code and got those results.. There was not anything special in what I did. I first started noticing this in English Karaoke, where people singing often becomes choppy, so I decided to try it out myself in Studio. Interesting that you saw no choppy effect though…

I have re-tested, and the “choppy” effect seems to no longer be present?? So I suppose it really is just the VAD cutting out. Thank you for looking into it :slight_smile:

Glad to hear the choppy effect is gone @kuritigu!