New Audio API [Beta]: Elevate Sound and Voice in Your Experiences

I have a question.

  1. Do you need phone number verification or email verification to enable the studio voice chat setting?
  2. Is the voice studio setting specific to studio and not replicated in any other devices on the account?
  3. Can I use voice chat on studio without it affecting the others. Is studio voice chat independent from the player app or do you need verification for that feature to be enabled?
  4. Why can’t the AudioEmitters be BaseParts?
  5. With the New Audio API, can you make a Public Address system?
2 Likes

Hey all, we added a .Volume property to AudioPlayer and AudioDeviceInput, so you can now directly set the output volume of an asset or input stream, without needing to create an extra AudioFader.

Hope this makes audio design more convenient!

9 Likes

Disabling this doesn’t fix the issue. Only opting out of the new spatial API or disabling the spatial sound windows setting fixes it.

1 Like

this is cool yeah, but i would like it to work with normal “Sound” objects because i want to make like a sound stealth system but im NOT rewriting all of the sounds

2 Likes

I see… interesting. It’s definitely an audio engine issue. It could be routing the audio incorrectly to mid and side channels for a consistent stereo picture? We’ll find out soon enough/ Hopefully it will be fixed this year :pray:

4 Likes

Are engineers aware of the audio clipping issue when the audio thats played from emitters is too loud? Because it seems like unlike Sound instances which properily attenuate all other audio, here, this doesn’t seem to be the case. Is this simply limitation we have to get across or it’s gonna be addressed at some point?

4 Likes

hey @vvv331, AudioEmitters and AudioListeners can produce feedback noise if you wire the output of a listener back to an emitter that it hears – we added a clipper to prevent that scenario from becoming infinitely loud :sweat_smile:

If you are finding that threshold is too restrictive we can revisit

7 Likes

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
3 Likes

Cool update but I faced problem where when im trying to :GetSpectrum() from AudioAnalyzer Wired with AudioDeviceInput it returns empty table.

3 Likes

Hello, there doesn’t seem to be a Volume property anywhere in AudioPlayer. :slightly_frowning_face:
The property cannot be set in scripts either.
image

on a side note: It doesn’t let me update studio either, button doesn’t work

2 Likes

hey I was wondering if we could make it to where two people can speak to each other if they are in a party and not people who are not in the party with the walkie talkies?

3 Likes

Yes easly with the group property in audio listener and audio emitter

2 Likes

@thom463s Can you confirm your Roblox Studio version? You can find this by going to File > About Roblox Studio

3 Likes

Hello, my issue has been fixed now!
It turns out my studio was outdated, but there wasn’t an auto update so I just reinstalled it.

2 Likes

Theoretically, yes. People would be able to reproduce any sort of sound they want using sine waves, and this would include swear words.

I’ve experimented in this field and wasn’t able to achieve any significant results though. This may be due to issues with the current audio API such as desynchronization, and potentially more things I was unable to uncover.

Here’s a chunk from my attempt at playing 440 pairs of sine waves that were supposed to cancel themselves out:

3 Likes

Would it ever be possible for Roblox to implement a way to record audio streams and replay them at later times? (Without exposing actual audio information other than length and pitches) This could have awesome use-cases such as in-chat voice messages, recording music, etc.

6 Likes

Hey, is there any distance limit to audio emitters? Trying to make this work for a rocket but it just cuts off at a certain distance away from the audio listeners.

3 Likes

There’s an adjustable DistanceAttenuation that lets you decide at which distances the audio gets louder, quieter, cannot be heard at all, etc.

The announcement thread for that new functionality explains it in more detail:

1 Like

Yeah but the problem is no matter what we do the sound cuts off at a certain point. We’ve tried the distance attenuation and it still cuts off when it gets too far away from the listener.

Do you have StreamingEnabled turned on in the game? Maybe what’s happening is that the AudioEmitter is so far away that it’s being streamed out for the client, which would cause the sound to stop playing.

If that appears to be what is happening, try placing the parent object of the emitter into a Model and then set its ModelStreamingMode to Persistent so it is always loaded for the player.

3 Likes