Hi Creators!
Today, we’re excited to close out the year with some more updates to the new Audio API:
- AngleAttenuation (Beta)
- AudioLimiter
- AudioPlayer:GetWaveformAsync
- AudioEcho.RampTime
- SoundService.DefaultListenerLocation
A big thanks to everyone who is experimenting and giving us feedback on it - your contributions help drive our feature development!
AngleAttenuation (Beta)
As promised, we’re excited to deliver our new AngleAttenuation API, which controls how loudly a sound is emitted or heard based on direction, rather than distance. This takes the custom rolloff curves from our previous distance attenuation API and extends them to work for listening angles as well. It allows you to simulate highly directional sound sources, like loudspeakers, megaphones, and sonar, or directionally sensitive listeners, emulating realistic microphone patterns (e.g. shotgun, figure-8, etc), or any other custom shape you can imagine.
With this update, both AudioEmitter and AudioListener now include the methods GetAngleAttenuation()
and SetAngleAttenuation()
which allow you to adjust the volume of AudioEmitters or the sensitivity of AudioListeners depends upon the angle. You can use these tools to improve realism or invent new, innovative gameplay mechanics.
Similar to DistanceAttenuation, we’re providing a visual editor to help you easily create and adjust AngleAttenuation curves. Here’s a quick preview:
More detailed information can be found in our documentation:
- AudioEmitter: AngleAttenuation
- AudioEmitter: SetAngleAttenuation
- AudioListener: AngleAttenuation
- AudioListener: SetAngleAttenuation
AudioLimiter
We’ve heard your requests for a way to constrain audio stream volumes that’s stronger and more immediate than our AudioCompressor. For this, we’ve added AudioLimiter, a new instance that sets a hard volume cap on a sound. Unlike an AudioCompressor, the AudioLimiter responds instantly, ensuring an audio stream is always quieter than the set ‘MaxLevel’.
AudioPlayer:GetWaveformAsync
Have you ever wanted to visualize or preview the waveform of an audio asset before it plays? Now you can with the new GetWaveformAsync()
method in AudioPlayer. This way, you can now access a visual representation of the waveform to enhance your audio tools and visualizations.
AudioEcho.RampTime
We’re also enhancing AudioEcho with a new RampTime
property. AudioEcho is now an interpolating delay line, meaning that when RampTime
is greater than 0, any changes to AudioEcho.DelayTime
or AudioEcho.Feedback
are smoothly updated over a specified number of seconds instead of instantaneously changing.
This means that adjusting DelayTime
will temporarily and cleanly alter pitch instead of creating unpleasant crackling. You can use this to simulate acoustic travel time with just a few lines of code:
Sample code for acoustic travel time
local RunService = game:GetService(“RunService”)
local echo = script.Parent
echo.RampTime = 0.1
RunService.Heartbeat:Connect(function()
echo.DelayTime = script:GetAttribute(“Distance”) / script:GetAttribute(“SpeedOfSound”)
end)
And if RampTime is larger than 0, this comes with the doppler effect for free:
SoundService.DefaultListenerLocation
Finally, SoundService now includes a DefaultListenerLocation
property. This property automatically spawns an AudioListener and attaches it to the camera or the player’s head, without the need for additional scripting. This change should make your sound design workflow a bit easier!
We’re thrilled to wrap up 2024 with these exciting new features and are eager to bring you even more improvements early in the new year! A huge thanks to @Doctor_Sonar, @cognitivetest_306, @ReallyLongArms, and @therealmotorbikematt for their ongoing support in gathering feedback and helping make audio creation on Roblox easier and more accessible. Keep sharing your feedback and demos; we’re inspired by hearing what you create!
Sincerely,
The Roblox Audio Team