[Fixed] Playsound volume discrepancy between OpenAL and FMOD EX

Bugs that have been investigated and resolved somehow.

Moderator: GZDoom Developers

Playsound volume discrepancy between OpenAL and FMOD EX

Postby Gez » Thu Jun 11, 2015 3:22 pm

Something I have noticed when playing through the Golden Souls mod, MAP07: Ghost House. In OpenAL mode, the map is unbearably noisy and loud, and sounds as if it was on fire. In FMOD EX it sounds as it always did. I quickly discovered the issue came from the candles that have this line of code:
Code: Select allExpand view
A_PlaySound("DSCHAFIR", CHAN_BODY, 0.1, 1)


Her's a minimal example map. With the FMOD EX backend, the fire sound from the candle is very faint though you can still hear it (especially with music off). In the OpenAL backend, it's played at full volume.
You do not have the required permissions to view the files attached to this post.
Gez
 
 
 
Joined: 06 Jul 2007

Re: Playsound volume discrepancy between OpenAL and FMOD EX

Postby VoidMage » Fri Jun 12, 2015 7:55 am

This is just a guess, but there seems to be a slight inconsistency in openal code.
Change in OpenALSoundRenderer::StartSound3D
alSourcef(source, AL_GAIN, SfxVolume);
to
alSourcef(source, AL_GAIN, SfxVolume*vol);
User avatar
VoidMage
 
Joined: 02 Dec 2010

Re: Playsound volume discrepancy between OpenAL and FMOD EX

Postby Csonicgo » Fri Jun 12, 2015 9:42 am

VoidMage wrote:This is just a guess, but there seems to be a slight inconsistency in openal code.
Change in OpenALSoundRenderer::StartSound3D
alSourcef(source, AL_GAIN, SfxVolume);
to
alSourcef(source, AL_GAIN, SfxVolume*vol);


The same issue also came up when testing DemonSteele in OpenAL. I had assumed it was the sound format, but looks like I was incorrect.
User avatar
Csonicgo
OPL Goddess
 
Joined: 15 Apr 2004
Location: Leeds

Re: Playsound volume discrepancy between OpenAL and FMOD EX

Postby unknownna » Thu Jun 18, 2015 12:57 pm

Here's an example WAD requested by Edward-san:

complex_sound_01.zip

It contains a monster (PlasmaGunner) from Complex Doom. It seems that you can hear the weapon sounds at full volume from any distance. For some reason it doesn't seem to happen when using vanilla sounds.
You do not have the required permissions to view the files attached to this post.
unknownna
 
Joined: 06 Oct 2007

Re: Playsound volume discrepancy between OpenAL and FMOD EX

Postby Edward-san » Thu Jun 18, 2015 1:46 pm

The fix mentioned by VoidMage does not work with the complex example wad, though it helps with the candle one.
Edward-san
Mathematics is the language with which God has written the universe. (Galilei)
 
Joined: 17 Oct 2009

Re: Playsound volume discrepancy between OpenAL and FMOD EX

Postby VoidMage » Sat Jun 20, 2015 11:26 am

...OK, this part is a bit nasty and I don't have a good solution yet...
The problem with that wad is that those sounds are both 3D and stereo.
Once I've downmixed those two sound to mono, they were played at correct volume.
Even FMOD doesn't deal with it quite correctly on its own - FMODSoundRenderer::StartSound3D has a workaround for that case where it halves the volume of each channel (I wonder how good that works while the sound has more than two channels).
OpenAL backend doesn't have any workaround for this yet and my initial googling says it won't be pretty.
It seems that people tend to solve this in a similar way, that FMOD seems to do, that is play each channel independently...
Yuck.
User avatar
VoidMage
 
Joined: 02 Dec 2010

Re: Playsound volume discrepancy between OpenAL and FMOD EX

Postby Chris » Mon Jun 22, 2015 10:02 pm

3D positioning and non-mono sounds don't mix. Most 3D audio APIs don't handle this (dsound even explicitly removed it after dx7), or can only handle it in limited capacity (either applying only attenuation with no 3D positioning, or effectively down-mixing to mono). I have considered adding a toggle in OpenAL Soft to do one of these, but really, if the sound is meant to be played in 3D it should be mono, rather than having the engine or audio API second-guess how to play the sound.
User avatar
Chris
 
Joined: 17 Jul 2003

Re: Playsound volume discrepancy between OpenAL and FMOD EX

Postby Graf Zahl » Tue Jun 23, 2015 12:48 am

It should do what the previously used API does with it in order to ensure compatibility. Having FMod and OpenAL do different things is the worst outcome of all.
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
 
Joined: 19 Jul 2003
Location: Germany

Re: Playsound volume discrepancy between OpenAL and FMOD EX

Postby Chris » Tue Jun 23, 2015 3:45 am

Graf Zahl wrote:It should do what the previously used API does with it in order to ensure compatibility. Having FMod and OpenAL do different things is the worst outcome of all.

Sure. The easiest thing to do would be to use manual gain handling when StartSound3D tries to play a non-mono sound, and change the manual gain to set the source's gain instead of its distance. That won't do 3D positioning for multi-channel sounds, but it should fix the volume. I'll see what I can do tomorrow.
User avatar
Chris
 
Joined: 17 Jul 2003

Re: Playsound volume discrepancy between OpenAL and FMOD EX

Postby VoidMage » Tue Jun 23, 2015 1:46 pm

Just my opinion, but in this context, position is about as important as volume, so 'the easiest way' would probably be also wrong.

Downmixing at load for 3d sounds sounds the best, but might be hard to implement, as it seems it's unknown at load we'll be playing that particular sound as 3d.
User avatar
VoidMage
 
Joined: 02 Dec 2010

Re: Playsound volume discrepancy between OpenAL and FMOD EX

Postby Chris » Tue Jun 23, 2015 2:39 pm

VoidMage wrote:Downmixing at load for 3d sounds sounds the best, but might be hard to implement, as it seems it's unknown at load we'll be playing that particular sound as 3d.

Right, and it's a possibility (at least from the backend's POV) for a multichannel buffer to be played in 3D and non-3D, so you'd potentially have to manage two separate buffers.
User avatar
Chris
 
Joined: 17 Jul 2003

Re: Playsound volume discrepancy between OpenAL and FMOD EX

Postby VoidMage » Tue Jun 23, 2015 5:36 pm

...unless alBufferData was moved from Load stage (LoadSound/LoadSoundRaw) to Play stage (StartSound{,3D}), but that could result is some noticeable delays...

...or so it seems...
User avatar
VoidMage
 
Joined: 02 Dec 2010

Re: Playsound volume discrepancy between OpenAL and FMOD EX

Postby ibm5155 » Sun Jul 19, 2015 10:55 am

Can confirm the same problem with cursed maze, I can hear the monster heart beat from everywhere.
Also there's a weird sound happening over the teleport time, idk how to describe, but it sounds different from fmod
User avatar
ibm5155
Just Spooky
 
Joined: 20 Jul 2011

Re: Playsound volume discrepancy between OpenAL and FMOD EX

Postby ReedtheStrange » Mon Aug 31, 2015 2:56 am

I'm also having some similar issues with OpenAL. It makes it very confusing and frustrating when trying to figure out where an enemy is, and that's even when it's a map that I made. I have noticed that spawn and attack sounds attenuate properly, but sounds using the A_Playsound function don't attenuate no matter what I change the DECORATE values to.

FMod Ex does not have this problem however. One difference that I've noticed with Fmod, however, is that sounds cut each other off (which makes some of my longer machinegun sounds sound very awkward). Any rapid-fire weapon with and echo to the firing sound loses a lot of its effect.
User avatar
ReedtheStrange
 
Joined: 11 Sep 2011

Re: Playsound volume discrepancy between OpenAL and FMOD EX

Postby edward850 » Mon Aug 31, 2015 2:58 am

ReedtheStrange wrote:One difference that I've noticed with Fmod, however, is that sounds cut each other off (which makes some of my longer machinegun sounds sound very awkward). Any rapid-fire weapon with and echo to the firing sound loses a lot of its effect.

That's not FMOD, that's Doom. Actors will only play one sound per channel.
User avatar
edward850
[netcode intensifies]
 
Joined: 20 Jul 2005
Location: New Zealand

Next

Return to Closed Bugs

Who is online

Users browsing this forum: No registered users and 0 guests