DynamicAudioV2 - My second (bad) attempt at real-time reverb

Edit: Uploaded the video to youtube so that streamable wouldn’t pummel out of existence after 2 days.

To begin, I would like to mention that I didn’t come up with this idea in a vacuum, and it was heavily inspired by this post by PysephDEV.

This is mostly a recreation of what I saw from the few videos that they posted of it.

Things that it does

  • Material Reflectiveness/Density
  • Weighted Distance Calculations
  • Smooth Interpolation between Values
  • Debug Mode for you to stare at

Things that it doesn't

  • Accurate Occlusion
  • Parallelized Raycasting
  • Diffuse Reflections
  • Support for all materials (although this can easily be fixed)

The hardest part was just trying to figure out how to use the data I collected from the raycasts, and apply that to the sound effect. I swear I went through hundreds of equations before I settled on one that “worked”.

I’m gonna be honest, I don’t recommend that you use this, it’s way too convoluted for something so simple and there are better solutions out there anyways (you can just set AmbientReverb whenever you enter a new region instead of all this nonsense).

Performance is… not good. It updates on heartbeat and with 40 rays able to be reflected up to 8 times, it averages ~1.8ms on my R5 5600x without drawing any of the debug rays. This can be to your advantage, as you only have to calculate it once for a single position and you can apply it to as many sounds as you want that are coming from the same place, but it’s still abysmal.

You can download the module and test place here if you’d like to mess around with it though:
DynamicAudioV2.rbxm (13.9 KB)
DynamicAudioV2Test.rbxl (90.6 KB)

Green Ray == Reflected
Purple Ray == Absorbed
Red Ray == Missed

12 Likes

Interesting. Lower frequencies travel through objects more easily. Did you ever consider using an equalizer effect?

1 Like

It’s there, but I only ever use it for muffling audio if your camera cant see the audio’s source position.
The test place is still up for download if you want to mess with it. It’s in ReplicatedStorage I believe.

I know this is old, but:
This is a great module, Would love updates! I will definitely be using this in my game, Although i have a few nitpicks:

  1. How would you replicate the audio to other players (with reverb and muffled audio if too far or can’t see emitter)
  2. The denser the room the player is inside of, the less reverb the sound gets? (I don’t know if this is realistic or not)

Too bad this will eventually be useless with roblox’s own audio emitters and listeners coming around the corner : p

You’d have to set up a new emitter at every source and simulate their reverb, then put the sounds you want to have reverbed under them which is super resource intensive (unless you turn the ray count wayy down) which is why I kinda gave up on this.

Idk i dont remember why I did it like that it’s just the way it is

2 Likes

That’s sad, Well. Do you have plans on making another one of these modules with roblox’s new Audio API? It has great features that the API doesn’t have (reverb, etc.)? This has great potential.

Maybe, I haven’t looked into what the new system entails but it really depends on if roblox fleshes out their own reverb systems. If not, and if I feel the need to update this, then I will.

2 Likes

If that’s the case then, I’m looking forward to it! :+1: