openal-soft icon indicating copy to clipboard operation
openal-soft copied to clipboard

[EAX] Hitman 2 SA (v1.01) muffled gunshots

Open Kappa971 opened this issue 2 years ago β€’ 23 comments

Hi @kcat, as described here: https://github.com/kcat/dsoal/issues/51 The sound of the gunshots becomes very muffled, when you turn and move away from the enemies. Here the log files: alsoft_log.txt dsoal_log.txt

@Phantom-Aspekt uploaded this video which perfectly reflects the problem: https://youtu.be/Mwk1VWPuXc4

Kappa971 avatar Jun 06 '22 13:06 Kappa971

I think I've found the culprit: by turning off the chorus effect in OpenAL Soft, the gunshot sound works fine. What does the chorus effect do? Is it a big loss if deactivated?

EDIT Without chorus, the sound of footsteps is louder, it seems as if the chorus effect is muffling some sounds according to the distance (incorrectly). It also seems to be the culprit of the exaggerated reverb in GTA 3, as described here: https://github.com/kcat/openal-soft/issues/706#issuecomment-1138597285

EDIT2 The chorus effect is actually messing with the reverb. Disabling it also causes the inability to use EAX in some games (this happened to me with Serious Sam The First Encounter), and it disables reverb in others (??).

Kappa971 avatar Jun 07 '22 11:06 Kappa971

The chorus effect creates pitch-shifted "echoes" that are panned to the left and right. It's typically used for music, and the general idea is to take a single music source and create a fuller and more volumetric sound (e.g. the difference between a single instrument and an ensemble of that instrument, or a person singing and a chorus singing, hence the name).

Disabling chorus probably breaks EAX support, since EAX has chorus running by default on the second effect slot (not sure why since it couldn't be controlled in EAX1/2/3, although I know Sound Blaster cards as far back as the AWE32 had reverb and chorus effect options for MIDI playback; maybe a quirk of the older hardware EAX started with).

I don't know why having chorus on would cause this bug, though. The effects are additive, so whatever chorus does is added on top of reverb and the normal/dry sound. Having chorus on shouldn't cause the dry sound to go silent or become heavily filtered.

kcat avatar Jun 07 '22 22:06 kcat

I don't know why having chorus on would cause this bug, though. The effects are additive, so whatever chorus does is added on top of reverb and the normal/dry sound. Having chorus on shouldn't cause the dry sound to go silent or become heavily filtered.

Unfortunately this is what is happening, maybe there is a bug somewhere in the chorus effect? It would appear (but I haven't personally tested it) that the Hitman 2 demo is working fine. This would suggest a bug in the game in the final version, but with ALchemy it works well...

The other weird thing is that the chorus is also affecting the reverb... If I disable the chorus, the reverb seems to turn off but it could be a bug of games not detecting the chorus effect (for example some games without chorus effect do not allow EAX to be enabled at all).

However, the bug seems limited to the chorus effect even though it probably doesn't help much πŸ˜…

Kappa971 avatar Jun 08 '22 00:06 Kappa971

Disabling chorus probably breaks EAX support, since EAX has chorus running by default on the second effect slot (not sure why since it couldn't be controlled in EAX1/2/3, although I know Sound Blaster cards as far back as the AWE32 had reverb and chorus effect options for MIDI playback; maybe a quirk of the older hardware EAX started with).

Even the chorus is initially loaded into the second FX slot it should not be used in processing by default, since initial active FX slot settings on a source enables only the first FX slot (or a primary FX slot in EAX5 which effectively is the first one by default).

bibendovsky avatar Jun 08 '22 05:06 bibendovsky

I await further developments, I'm available to test and close this issue πŸ™‚

Kappa971 avatar Jun 08 '22 14:06 Kappa971

It probably won't help in resolving this problem, but this bug in Hitman 2 is also present with the DSOAL build prior to the new EAX extensions of OpenAL Soft (https://github.com/kcat/dsoal/tree/e7a82d4fda8502eef9f8aacaa207199917d94167) with the latest build of OpenAL Soft. In this case, however, disabling the chorus effect has no change (maybe it's using a chorus effect built into DSOAL in this old build?).

Kappa971 avatar Jun 10 '22 17:06 Kappa971

I think chorus is just a red-herring. It can't even be used prior to EAX4, there's nothing with it that can affect the dry path or reverb path, and disabling it breaks EAX in unexpected ways causing unknown behavior.

What stumps me is that it seems to work fine for some people, meaning it's not something like an incorrect algorithm or an incorrect conversion from DSound to OpenAL. And being that OpenAL Soft's code is largely system-agnostic, it's not some hardware difference. It's more subtle, more like an improperly initialized (or uninitialized) variable that's sometimes the wrong value. Though even in that case, I'd expect the issue to be more intermittent, not consistently bad for one person and consistently good for another.

kcat avatar Jun 11 '22 06:06 kcat

I think chorus is just a red-herring. It can't even be used prior to EAX4, there's nothing with it that can affect the dry path or reverb path, and disabling it breaks EAX in unexpected ways causing unknown behavior.

This make sense.

What stumps me is that it seems to work fine for some people, meaning it's not something like an incorrect algorithm or an incorrect conversion from DSound to OpenAL. And being that OpenAL Soft's code is largely system-agnostic, it's not some hardware difference. It's more subtle, more like an improperly initialized (or uninitialized) variable that's sometimes the wrong value. Though even in that case, I'd expect the issue to be more intermittent, not consistently bad for one person and consistently good for another.

In this case no, I'm the second person who notices this bug with this game. I think this can be reproduced by everyone (unless using headphones with HRTF produces a different result, but I have no headphones to try with).

Kappa971 avatar Jun 11 '22 06:06 Kappa971

This issue is also present with OpenAL Soft 1.20 and an old build of DSOAL from October 2020, so we can at least say that Hitman 2 never worked well with DSOAL. Could it be a problem like Max Payne? Not the same obviously but maybe the game is giving invalid values which somehow ALchemy and the old Creative drivers accepted while with DSOAL it is causing weird behavior, but this is just a guess with no basis...

Anyway I noticed that the last commit makes sure that when you deactivate the chorus effect, EAX is deactivated. I will change the title since we have ascertained that the chorus effect has nothing to do with the bug encountered.

EDIT Anyway which of the effects could be the culprit of causing muffled audio in distant gunshots? As further information, the game uses EAX 3. Information taken from Wikipedia: Immagine 2022-06-13 174840

Kappa971 avatar Jun 11 '22 12:06 Kappa971

Anyway which of the effects could be the culprit of causing muffled audio in distant gunshots?

If it's EAX related (that is, EAX parameters are the cause, not just having EAX enabled in the game is causing it), the issue would likely be with the occlusion/obstruction and filter properties since those apply high-frequency attenuation to sources. I'm not seeing anything wrong with them, though. The context's air absorption property had an issue in the 1.22.0 release, but that's been fixed in Git.

kcat avatar Jun 14 '22 17:06 kcat

I can confirm that with ALchemy and X-Fi there is no such bug, and if the problem is not OpenAL Soft, maybe it is DSOAL? (even older versions of DSOAL have this bug with this game). I also noticed that the volume of the sound effects is different than the X-Fi (on the X-Fi the sounds are louder)... for example the sound of this door opening (first mission): Hitman 2  Silent Assassin Screenshot 2022 06 21 - 16 13 03 96 in DSOAL it is inaudible, the volume is too low. Maybe the same thing is happening with gunshots?

Kappa971 avatar Jun 21 '22 14:06 Kappa971

I also noticed that the volume of the sound effects is different than the X-Fi (on the X-Fi the sounds are louder)... for example the sound of this door opening (first mission): ... in DSOAL it is inaudible, the volume is too low. Maybe the same thing is happening with gunshots?

Perhaps, if the door sound is a 3D/world sound like gunshots, it may be triggering the same issue as the gunshot sounds.

kcat avatar Jun 21 '22 19:06 kcat

~~I just tested the full game (v1.01) with the current latest https://github.com/kcat/dsoal/commit/0e8792cecdcd8aca4d6c659f4e0bbc502ea6a6fb and OpenAL Soft seems to be the culprit variable: 1.22.0 was the last (stable) build that worked. βœ…OpenAL Soft 1.21.1 βœ…OpenAL Soft 1.22.0 ❌OpenAL Soft 1.22.1 - Upgrading eax.dll to v4.0.1.0 makes no difference ❌OpenAL Soft 1.23.0 Hitman 2 Silent Assassin DSOAL log+files.zip Can anyone else replicate these results on their end?~~

~~If there was an easy way to get every git DLL between 1.22.0 and 1.22.1, I could track down the exact commit that caused the issue, but I'm not sure if that's available anywhere since artifacts from 1.22.1 and older are already expired on Github and Appveyor. Perhaps there's some github actions voodoo I don't know about πŸ€”~~

Check out https://github.com/kcat/openal-soft/issues/714#issuecomment-1486235832

ThreeDeeJay avatar Mar 27 '23 08:03 ThreeDeeJay

Are you able to try the latest Git version of OpenAL Soft? There has been some work to improving EAX compatibility with it over 1.23.0.

kcat avatar Mar 27 '23 08:03 kcat

Well, I'll be damned. The 1.23.0-9fd9fee3 build I used was just from a couple weeks ago so I didn't think it'd be fixed since then but sure enough, as luck would have it, seems fixed as of https://github.com/kcat/openal-soft/commit/ac01cbf7a518df913b3c9e45565a4ab7a8653bc7 πŸ‘ https://youtu.be/ytaJznB2tpw 1.23.0-ac01cbf-EAX.dllV4.zip

ThreeDeeJay avatar Mar 27 '23 08:03 ThreeDeeJay

On a side note, @kcat do you know if there's any benefit in upgrading eax.dll (EAX Unified)? I've noticed that using v4.0.1.0 makes EAX 3.0 and lower games query EAX 4 support in both the DSOAL and ALchemy logs (these are from Prince of Persia: The Two Thrones), though it never gets used which isn't surprising, but I wonder if certain versions (or even the presence) of EAX Unified is known to cause issuesπŸ€”

ThreeDeeJay avatar Mar 27 '23 09:03 ThreeDeeJay

On a side note, @kcat do you know if there's any benefit in upgrading eax.dll (EAX Unified)?

I don't know. Honestly, I'm surprised a DLL like that (closed/propriety, provided with the games that use it) is upgradable. I'd expect ABI breaks, at least on occasion, to handle new features and functionality since it isn't intended to be perpetually upgradable like OpenAL/OpenGL/etc. Updates to the DLL would be controlled by the developer to ensure a compatible version (or they could rebuild the executable for an updated API/ABI). Though I'm not too familiar with eax.dll to know the ins and outs of it, maybe Creative did design it with a stable ABI.

Presuming there is ABI compatibility, upgrading the DLL can fix bugs, improve performance, or provide other benefits. Though software isn't perfect, so if the game relies on the specific behavior of a particular version of the DLL, or if a newer version of the DLL introduces a bug in something the game uses, it can create new problems. It would have to be tested on a case-by-case basis.

kcat avatar Mar 27 '23 09:03 kcat

Fair enough. I guess I'll just stick with just upgrading within the same major version number to check if it fixes known bugs to minimize/avoid the unnecessary risks. πŸ‘Œ

ThreeDeeJay avatar Mar 27 '23 10:03 ThreeDeeJay

I compiled the latest OpenAL Soft and DSOAL builds and the problem is not solved. I don't have headphones, I tried with stereo speakers. These are the settings of OpenAL Soft (for safety I disabled CMSS-3D and set OpenAL Soft to "stereo"):

[General]
sample-type=float32
channels=stereo
frequency=48000
stereo-mode=speakers
drivers="wasapi,"

[decoder]
hq-mode=true

DSOAL + OpenALSoft: Hitman 2 Silent Assassin 2023.03.27 - 16.46.27.02.zip

X-Fi TiHD ALchemy + Creative OpenAL + CMSS-3D: Hitman 2 Silent Assassin 2023.03.27 - 16.53.00.03.zip

Kappa971 avatar Mar 27 '23 14:03 Kappa971

I compiled the latest OpenAL Soft and DSOAL builds and the problem is not solved.

Double-check that dsoal-aldrv.dll was updated with the latest DLL. Can you provide logs using the latest OpenAL Soft and DSOAL builds?

kcat avatar Mar 28 '23 04:03 kcat

D*ng it, my bad, @Kappa971 is right. I jumped the gun here. EAX must've gotten disabled at some point for some reason, so DSOAL HRTF was active but the bug didn't happen since only EAX On is affected. Also, turns out something similar happened in 1.22.0 and earlier: EAX was "Enabled" in the settings, but actually greyed out so it wasn't active either, so no bug.

9cc Sorry for the false alarm everyone, looks like we're back to square one πŸ˜…

ThreeDeeJay avatar Mar 28 '23 05:03 ThreeDeeJay

I compiled the latest OpenAL Soft and DSOAL builds and the problem is not solved.

Double-check that dsoal-aldrv.dll was updated with the latest DLL. Can you provide logs using the latest OpenAL Soft and DSOAL builds?

scr1

alsoft_log.txt dsoal_log.txt

Kappa971 avatar Mar 28 '23 11:03 Kappa971

(or even the presence)

Please, forget my misplaced blame/hope. In a very very narrow sense with blinkers, it's not even technically wrong to say that it's only with unified that games break. But it's not really its fault (and I'm not sure what you could miss without it altogether?) and it's not like COM loading couldn't bite you even in other cases anyway.

since it isn't intended to be perpetually upgradable like OpenAL/OpenGL/etc.

All versions before 4.0.1.0 (if not even that, who knows what may have gotten lost from creative's developer ftp server) had a redist that updated the system-wide dll in the system32 folder. Of course its entire purpose seems kind of that.

mirh avatar Apr 14 '23 22:04 mirh

Is this problem still present with the latest versions of OpenAL Soft? If so, any ideas on how to resolve this strange dilemma before all the Sound Blaster cards die? πŸ˜…

Kappa971 avatar May 10 '24 23:05 Kappa971