3D Sound System - Realistic frequency dampening

I don’t have access to my PC for a few days, but I plan on adding this feature to the master branch.

I do plan on rewriting the code, but the API is nice. I just think creating a thread to do a repeat wait() until is not the best way to accomplish that.

1 Like

I made this for a StreamingEnabled environment, so it works pretty well for me. I use this quite often without seeing any sort of memory issues or anything related to that. I suppose you could do wait(1) if you are concerned.

1 Like

Wait a second, this won’t work. It’ll call Emitter.WorldPosition to do the angle math, which would return nil instead of a Vector3.


as said before, I have not yet tested it. I can fix that as soon as I have the vehicles properly setup in this file.


I haven’t tested it, but this may break if someone uses the system and changes a user’s listener - although I’m not sure many people use it, it can be used to change where a user ‘hears’ from.

local listenerType, listener = game:GetService("SoundService"):GetListener()

You seem to use the angle to the user’s camera to do the effects, so if the player is listening from somewhere else, it won’t work correctly. (unless you’ve changed something since I’ve last looked.)


I didn’t know that was a thing. When I have a chance, I’ll fiddle with it until that is supported. Thanks for letting me know!

1 Like

Adding a hint of reverb might help. When I created this demonstration, I had added reverb as well. It’s a little too much, but adding the perfect amount helps as well.


1 Like

Specifically on the left and right. It isn’t for realism, but for making the difference more audible.

I’ve got pretty much all of my game working with this code, and it only required a small amount of modification. Just replace the ‘RenderStepped’ function with the following function.

	for Emitter, _ in pairs(CurrentObjects) do
		if Emitter.ClassName == "Attachment" then
			Emitter.Sound.EqualizerSoundEffect.HighGain = -(-25 * cos(acos(dot(cf(Camera.CFrame.Position,v3(Camera.CFrame.LookVector.X,Camera.CFrame.Position.Y,Camera.CFrame.LookVector.Z)).LookVector.Unit,v3(Emitter.WorldPosition.Unit.X,Camera.CFrame.Position.Y,Emitter.WorldPosition.Unit.Z)))/pi * (pi / 2)) + 25)
		elseif Emitter.Sound.Parent:IsA("BasePart") then
			Emitter.Sound.EqualizerSoundEffect.HighGain = -(-25 * cos(acos(dot(cf(Camera.CFrame.Position,v3(Camera.CFrame.LookVector.X,Camera.CFrame.Position.Y,Camera.CFrame.LookVector.Z)).LookVector.Unit,v3(Emitter.Sound.Parent.Position.Unit.X,Camera.CFrame.Position.Y,Emitter.Sound.Parent.Position.Unit.Z)))/pi * (pi / 2)) + 25)

This is very cool!
Can I use this for my upcoming tactical shooter game?


You most certainly can! I have a few updates planned, so I suggest you wait a bit before implementing this.


My game isn’t really in alpha yet, so we can wait, and I can’t accept not to credit you my guy! :slight_smile:

1 Like


Changes have been pushed to GitHub and the Roblox Library.


  • Added SoundSystem:Attach(SoundObj)
  • Added support for SoundService:SetListener()
  • Cleaned up the math and actually fixed a couple issues with it


Suggested by @xXVernandoXx!

Until now, the module could only add the 3D effect to sounds it created from the :Create() function. Now, if you have a Sound created some other way, be it by another script or before runtime, you can call :Attach() on it to attach the module’s effect onto it as well.


Suggested by @lArekan!

Prior to this update, the module assumed you use the default listener: the Camera. Now, it actually gets the Listener, therefore adding support for setting your listener to various objects or CFrames.

Math changes

Big thanks to @EgoMoose’s Dot Product video!

The previous version had some odd behaviours when you left the origin, due to an oversight on my part. Forgot to test while walking around :neutral_face: Fixed that now!
Also, changed the easing aspect to -(25 * ((Angle/pi)^2)), which gives a nicer curve.


This is epic. Games like Rainbow Six Siege and Call of duty take advantage of 3-10D Audio. I can already imagine the ideas for like FPS games with the 3D Sound System.

I’m creating a sound and setting the target parameter to my boombox tool’s handle part. Everything is fine except upon testing with a friend, only I hear the sound being played, how do I get it so that everyone in the server hears it too? Does this happen because the SoundContainer is in the workspace>Camera ?

Also, how would I efficiently remove the attachment if the boombox were to be unequipped and the sound had to be stopped abruptly? Currently I use :Stop() on the sound object and :Destroy() the attachment. Is this fine?

I think for lots of types of games (mainly Shooters and Horror games) it can be small innovation. Congratulation for creator.

I was using its module and everything was fine, until I discovered that when I rotated the camera and while the sound was in front of me… the equalizer acted as if it was in front of the sound.Most likely it has to do with the attachment never changing its rotation… but i checked your code and there’s nothing wrong. What’s going on?

The only thing I did was attach the sound to an attachment and then play and stand behind it… I repeat, The equalizer acts as if the sound is behind me… And it’s the opposite… and if I position myself in front of the sound… the equalizer remains the same.

Look at this post
Maybe this has something to do with it.