Sound should have a volume slider that will allow sounds to play at different volumes based on the relative min and max play distances.
When I’m doing explosions, I use two sound objects. One for playing a nearby explosion, and one with more reverb and echo for distant explosions. My issue is that the distant explosion is always too quiet because of how far away it is and I’d like it to be much louder. If we had a slider that could bump up the volume based on the distance the sound object is from the player, it would let me have more realistic explosion effects. Same idea goes for gunfire.
Another use would be an ambient sound system. In Bloodfest I’m having to create a custom rig for what I’m doing but it could be done much simpler if this technology were in place. I will have explosions, gunfire, and other misc apocalypse sounds that all need to have relative directions they are coming from to be believable. If I could max out the volume at longer distances then I could place actual object sources for the sounds to come from letting developers create the realistic environments we need. In this case I’m creating a custom rig to achieve this effect but I really wish I didn’t have to.
It’s a standard game engine feature Roblox is lacking and it looks like the technology is now in place to do this. This has some very good uses and will help developers create more immersive games and environments. Every little bit helps to arrive at the final experience and this one is pretty big.
I play music in some buildings in my games. When the player goes outside of the MaxDistance of the sound, it sound goes from full volume to no volume very abruptly. I assume this is a similar problem to what you describe.
I’ve solved this before by calculating the distance of the player from the sound and changing the volume accordingly, but this is far from ideal.
For me, this doesn’t fix the issue I’m seeing. With a EmitterSize of 50, the sound at my disco (excuse the roblox classic “caramelldansen” and the fairly bad quality - I recorded this quickly) suddenly drops off at MaxDistance = 150.
I think it would be better if the sound volume decreased so it is guaranteed to be zero at max distance, as well as guaranteed to be full up to the distance of EmitterSize away.
(So in my game from 50 studs to 150 the sound would decrease)
This isn’t the general use case (hard cutoff at 150).
Since this is what you want, there’s this “secret” script-only property on Sound (.RollOffMode) that isn’t documented. Enum.RollOffMode.Linear is the one you want, most likely.
So is max distance property isn’t really supposed to be set to something that small with an EmitterSize that large?
I did try the RollOffMode (sounds like this could be useful if it were common knowledge) but it didn’t have much (noticeable) effect.
Boosting MaxDistance to 1500 and walking away did the trick eventually, but I had to walk a long, long way away from the source.
If my use case is an edge case then I can see why its probably not worth changing anything, so I’ll live with it.
RollOffMode hasn’t been tested too well so there may be a mistake with it, but glad you were able to get the results you want. An alternate thing to do that would also likely work is multiple speakers playing the same sound.
Well I didn’t really. Increasing the MaxDistance just moves the abrupt cut off further away and at a quieter volume.:
(this time with added Sandstorm)
(Also ignore the random announcement that is also playing out across the map :/)
Multiple speakers is something I’ve tried, but they don’t sync up very well when set sequentially via a script and I can forsee them being susceptible to the same problem.
Maybe it is my setup
There is a bug with MaxDistance currently that causes the sound to be cut off at the right distance, but otherwise not respect maxdistance. We will release a fix for this issue soon.
Am I correct that the volume of the sound at some distance d from the sound should be a value scaled from 0 to Volume, where the level is 0 at d > MaxDistance and the level is Volume at d < EmitterSize? This is what I was expecting and hoping for based on the description of the properties.
If this isn’t what the behavior of sounds is supposed to be, I don’t think I can achieve what I want, which is full volume in some sphere around the source, and that tapers off between that sphere and a second sphere. I think this is also what @MasterDaniel is asking for.
It depends on the RollOffMode of the sound. When the RollOffMode is set to Linear, the sound will be at 0 volume at MaxDistance and it’s max volume at MinDistance. When the RollOffMode is Inverse (the default) the sound will be max volume at MinDistance and it’s volume will follow an inverse rolloff model until MaxDistance, at which point it will be cut off.
The RollOffMode property of sounds is currently scripting only and hidden, but this will change soon.
Yes, this appears to work great now.
The default “Inverse” is what it used to be like, but after setting into to Linear the volume drops gradually and not abruptly. The drop off can be a little fast but increasing the max distance made it roll off slower.