DynamicSoundHandler module!

Introduction

This module is designed for sounds to play in a realistic way depending on the environment the sound is on. This is dynamic too! in which you don’t have to set up zones in your map manually for something like a reverb. It is all handled by the module itself.

Features

  • Sound Delay
  • Dynamic Reverb
  • Realistic Frequency Dampening

Video demo

Source

API is listed in the github, check it out!

Credits to Sleitnick for his sound delay implementation and BoatBomber for his 3D sound implementation!. I only created the dyanmic sound reverb.

34 Likes

if the module can only be required on the client will this make the sound only be heard by the client or also other players?

the sound when im walking it gets in my right or left ear. its not following the gun.

1 Like

Requiring on a client usually means it’s not replicated, but you can use RemoteEvents for that.

To prevent lag (delay in hearing sound):

  1. Play the sound on the client that did an action, like shooting.
  2. Send an event to all other clients (so excluding the shooter)
  3. They’ll hear the sound now too.

I assume that you might be playing the sound using the position in the target parameter in which it makes the sound to your left ear while you move, try to put in an instance (part or an attachment) in the parameter that is with the assembly of your gun.

Do you have any benchmarks or performance tests? Because at present, the code seems to be firing multiple Raycasts per frame for each sound, which imo doesn’t sound like the most performant-friendly method.

1 Like

Sadly I never did any benchmarks or performance test, and even with that I’m quite sure that this is not the most performant module.

In all honesty I think using this would be bad for performance of a game and I believe this ought to not be used in games where audio is not an important part of the gameplay.

1 Like

Hey Robert!

You don’t have to accept any of the changes I made to your repo, but I’ve gone ahead and made a pull request if you’d like to see.

I added:

  • Debug Rays

  • Ability to add SoundID as strings

  • Added more destroy events

  • Cleaned the module up a tad

if this is accepted ill go ahead and start working on :Stop(), :Pause() and :Resume

1 Like

Oh my, thank you for the contribution! you added a lot of improvements on your forked version! I’ll merge it to the main since lots of this improvements makes the module much better.

though i do hope you dont feel forced to start working on the other features when i accept this. It is your choice to work on those if you want. Again, thank you :pray:

2 Likes

Hey there! I noticed a problem with your reflections! you were reflecting them the wrong way :sweat_smile:, I fixed this by just multiplying it by -2 and not 2 as in your original code.

Now it works and Its awesome!

Updated Dynamic sounds, fixed reflections and added colors to debug by Universeds · Pull Request #4 · RobertStevey/Roblox · GitHub for the pull if you want to merge :slight_smile:

3 Likes

Sorry for the slow response but again, thank you! you’ve done a lot of contributions to this module

1 Like

No problem Robert! I’ve made one final pull request to fix some issues with the reverb, the module now also returns the sound instance and the emitter to be destroyed, stopped and etc. Pause support isn’t a thing (and I don’t think it should really be a thing) so for now I’m done!

I had a lot of fun working on this module, thanks for doing all this work and I appreciate it all!

image

for anyone wondering, on default settings this module is semi performant

8 rays and 3 bounces every frame.

Features of this module include:

  • Dynamic Reverb
  • Debug Rays
  • Sound Delay
  • Realistic Frequency Dampening

Last update will most likely be using actors for multi threading

2 Likes

Does it also have sound occlusion?

Doesn’t roblox already has this with the volumetric audio update?, either way this is so cool, the way the sound bounces is so cool.

Love it! I think I might implement this into my game in the future :slight_smile:
If possible, could you also make a game featuring this module with guns/footsteps/music?

I’ll quickly try to make a “showcase” place file later, I’ll notify you if I finish making it

Thanks! I’m excited for it! :slight_smile:

hey its been awhile and i’m still keen about the place demo

Oh my i completely forgot about this, i am very sorry for forgetting about this. Currently im on vacation now so i’ll most likely make the place demo tommorow. Again im sorry for forgetting about this :pray:

1 Like

Hey there, here is the demo. I know its not much due to the limited time i have, and it only shows a footstep sound. but im sure that this can show you the basics on how to use it
SoundDemo.rbxl (58.5 KB)