[3.5.0] Sound Roll off and reverb

Post bugs that have to do with sound and/or in-game music here.

Moderator: GZDoom Developers

Forum rules
Please construct and post a simple demo whenever possible for all bug reports. Please provide links to everything.

If you can include a wad demonstrating the problem, please do so. Bug reports that include fully-constructed demos have a much better chance of being investigated in a timely manner than those that don't.

Please make a new topic for every bug. Don't combine multiple bugs into a single topic. Thanks!
User avatar
Enjay
 
 
Posts: 26517
Joined: Tue Jul 15, 2003 4:58 pm
Location: Scotland
Contact:

[3.5.0] Sound Roll off and reverb

Post by Enjay »

An area with a reverb effect can make sounds fade-out much more quickly than they would do without the reverb effect.

Example attached.

Load the map (best with -nomusic) and your ears will be assaulted with a fairly loud water-rushing sound (placed in the FWATER pool in front of the player start).

If you go down the corridor to the right (default sound environment), after a while, the sound starts to fade and is completely inaudible by the time you get to the GRAYVINE walls.

If you go down the left corridor (reverb item with args 30, 8), the sound fadeout is far more abrupt. The effect is much more like switching the sound off just before you reach the GRAYVINE wall rather than it fading smoothly to nothing.

These exact sounds and sound environments are making wandering around a cave system that I am making sound very weird. :lol:
User avatar
Chris
Posts: 2940
Joined: Thu Jul 17, 2003 12:07 am
Graphics Processor: ATI/AMD with Vulkan/Metal Support

Re: [3.5.0] Sound Roll off and reverb

Post by Chris »

As far as I can tell, this is the result of two conflating details. First is essentially just how reverb works. When you're in a reverb environment, there's actually two distinct things you're listening to: the sound itself (the direct or dry path), and the reverb (the room or wet path). The dry path follows the same rolloff regardless of the set environment. It's the sound you hear direct from the sound source (though GZDoom doesn't implement occlusion or obstruction or anything, so walls don't block it). The reverb rolls off at a different rate dependent on the environment properties. A more echo-y room changes less with distance compared to a less echo-y room, since the reflections are more "lively" in the former and carry farther.

The second detail is that GZDoom only handles one environment at a given time. Whichever room the player (listener) is in is what determines which reverb is applied. Changing environments happens relatively abruptly when moving across a reverb zone boundary. A proper fix for this would be for GZDoom to support multiple active reverb environments, generating the appropriate link data (which environments connect to which other environments, where the connections are, and what size the opening is) for OpenAL to pan and mix multiple effects. That way, when you move from an echo-y room to a dull one it doesn't abruptly change, but instead the echoes move off in the direction of the area they come from and get quieter as the area they come from gets smaller.
User avatar
Enjay
 
 
Posts: 26517
Joined: Tue Jul 15, 2003 4:58 pm
Location: Scotland
Contact:

Re: [3.5.0] Sound Roll off and reverb

Post by Enjay »

I follow the explanation of the dry path/wet path thing and why it relates to the bug.

I also follow the explanation of the one environment at a time paragraph, but I'm not sure how it relates to this particular issue because the sudden reduction of how audible the sound is doesn't coincide with crossing a reverb boundary. I'm not saying you are wrong (obviously I know that you know far more about the sound setup in GZDoom that I ever will); I just mean that I don't follow why the second part is having an impact in this particular case.
User avatar
Chris
Posts: 2940
Joined: Thu Jul 17, 2003 12:07 am
Graphics Processor: ATI/AMD with Vulkan/Metal Support

Re: [3.5.0] Sound Roll off and reverb

Post by Chris »

Enjay wrote:I also follow the explanation of the one environment at a time paragraph, but I'm not sure how it relates to this particular issue because the sudden reduction of how audible the sound is doesn't coincide with crossing a reverb boundary.
Hmm, my mistake. Toward the back of the hallway with reverb it sounded like the reverb was being changed/removed, and that behavior coincided with the change in wall texture, which looked like a sector (zone) boundary. A closer look seems to show that's not it.

Looking at the sound definition, I presume it's using the Doom-style rolloff? In that case, the issue may be a result of the sound distance warping. OpenAL doesn't natively support (GZ)Doom's default style of distance attenuation for the dry path, so to replicate it, the OpenAL renderer calculates the intended volume it should have with the Doom-style rolloff, calculates the distance needed to get that volume from the default logarithmic rolloff OpenAL uses, and changes the distance between the listener and sound source as appropriate. As it happens, the Doom-style rolloff reaches 0 gain at a pre-specified point. Logarithmic rolloff would need to go out to infinity to reach 0 gain, and so as a result, when the sound reaches the max distance for Doom-style rolloff the effective sound distance flies way off to the distance (internally clamped to about 100,000 units, still more than enough to knock out the reverb with the sound itself).

I'm not sure the appropriate course of action, here. The sound cuts out when it reaches the max distance defined by the sound using Doom-style rolloff. Generally when a sound reaches some predefined max distance, you expect it to go totally quiet. However, the abruptness that the reverb response drops out with (at least for certain reverb presets) is far more noticeable than the direct response the Doom-style rolloff applies to. Additionally, with OpenAL Soft's AL_EXT_source_distance_model, the linear-style rolloff does the "right thing" of applying the linear rolloff to the direct response, and uses the actual sound distance for the reverb response even after the direct response goes quiet. So I guess it depends if what you want is for a sound outside of its max distance to be totally quiet, or if it should retain a more natural reverb response even with non-logarithmic rolloff styles.
User avatar
Enjay
 
 
Posts: 26517
Joined: Tue Jul 15, 2003 4:58 pm
Location: Scotland
Contact:

Re: [3.5.0] Sound Roll off and reverb

Post by Enjay »

OK, thanks, that certainly makes more sense in the context of what I'm hearing in this case.

The sound definition is doing nothing particularly special (and the SNDINFO entry was originally written some years ago) so it will just be using default standard Doom-style roll off.

As far as what I want - or certainly what I was expecting - is that the sound would become inaudible beyond a certain distance but that its fade to inaudibility would be much smoother. In the particular setup where I first noticed this, I had a curved cave. Outside the cave is a waterfall. It just so happened that the curve of the cave takes the player past and back into the linear distance where the sound can be heard. So, as you wind your way along the cave, it sounds like the ambient sound object is being deactivated/activated repeatedly. The map itself is quite old and, of course, this didn't happen with the older sound engine (fmod) - or rather, it did but it was much less noticeable, and perfectly fine, because the sound faded in and out gently rather than (almost) instantly flipping between audible and inaudible. If I load the test map into ZDoom 2.7.1 the sound starts to fade around half way along the GRAY7 portion of the corridor and is completely inaudible by the time it changes to GRAYVINE. Whether that can be replicated, or approximated in OpenAL is way beyond what I would be able to figure out. ;)

For what it's worth, I had already started to get the impression that, these days, sounds do seem to be stopping very abruptly as I move away from them in many of the maps that I have been playing and working on. It's just that this particular combination showed it more obviously and readily than some of the others.


Just as a complete aside (and not trying to throw this thread off topic). I'm almost certainly making a completely spurious connection here, but when you mentioned that the effective distance "flies way off to the distance (internally clamped to about 100,000 units...)" it got me wondering if this might be in any way connected to the problem of errors being printed about sounds playing well outside the map boundaries. (As far as I can tell, it actually seems to be more to do with actors somehow getting outside the map - like a projectile that has managed to get through a wall and keep going - and then trying to play a sound. At least that's what seemed to be happening when I encountered the problem ( I mentioned it on page two of this thread viewtopic.php?f=15&t=61420 )
User avatar
Chris
Posts: 2940
Joined: Thu Jul 17, 2003 12:07 am
Graphics Processor: ATI/AMD with Vulkan/Metal Support

Re: [3.5.0] Sound Roll off and reverb

Post by Chris »

Enjay wrote:The map itself is quite old and, of course, this didn't happen with the older sound engine (fmod) - or rather, it did but it was much less noticeable, and perfectly fine, because the sound faded in and out gently rather than (almost) instantly flipping between audible and inaudible. If I load the test map into ZDoom 2.7.1 the sound starts to fade around half way along the GRAY7 portion of the corridor and is completely inaudible by the time it changes to GRAYVINE. Whether that can be replicated, or approximated in OpenAL is way beyond what I would be able to figure out. ;)
It's just a tricky thing to get right, making something that sounds "good" using something fundamentally inaccurate. Doom-style rolloff is not how sound works IRL, while the reverb's auto-rolloff is a statistical approximation meant to fit with the dry path having a realistic logarithmic rolloff -- so trying to get a good sounding reverb rolloff that fits with an inaccurate dry path rolloff is grounds for lots of fun. I'm sure something can be worked out, there are various knobs and switches available with OpenAL, it will just be a large amount of trial and error to get something that sounds good enough (I may also look through the old FMOD renderer code to see what it was doing in this regard too, maybe there's things there I missed).
Just as a complete aside (and not trying to throw this thread off topic). I'm almost certainly making a completely spurious connection here, but when you mentioned that the effective distance "flies way off to the distance (internally clamped to about 100,000 units...)" it got me wondering if this might be in any way connected to the problem of errors being printed about sounds playing well outside the map boundaries.
No, the effective sound distance is purely as applied to OpenAL, which has no issue with these values. They don't translate back into the engine.
User avatar
Enjay
 
 
Posts: 26517
Joined: Tue Jul 15, 2003 4:58 pm
Location: Scotland
Contact:

Re: [3.5.0] Sound Roll off and reverb

Post by Enjay »

Thanks for your continued responses and attention to this, they're much appreciated and help me understand the difficulties involved. I hope you get an opportunity to look at this at some point and maybe figure out something that sounds a bit nicer. Thanks again. :)
Post Reply

Return to “Audio/Music Bugs”