kcat / dsoal

A DirectSound DLL replacer that enables surround sound, HRTF, and EAX support via OpenAL Soft
GNU Lesser General Public License v2.1
388 stars 50 forks source link

Arma: Cold War Assault - Artifacts with EAX enabled #16

Open Hiradur opened 4 years ago

Hiradur commented 4 years ago

In Arma: Cold War Assault with DSOAL and the -dsound command line argument turning on EAX causes artifacts on footsteps originating from the player character. The strength of these artifacts depend on the EAX environment of the player character. Toggling proning may also cause artifacts but I'm unsure if that is what it's supposed to sound like. Not sure what is happening but it sounds a bit like the reverb effect is much too strong for these sound effects. Sound effects not originating from the player character seem to play back with normal reverb and no artifacts.

A good place to test this is the beach at the beginning of the single mission "Ambush". Right from the start the artifacts should be audible when walking.

On YouTube there is a video of Operation Flashpoint [1] (Arma: Cold War Assault is a re-release of that game) where EAX is apparently enabled on a PC with Windows 2000 and SoundBlaster Audigy 2 ZS. There the artifacts are not audible (I tested the same mission) so I believe the fault is not in the game itself.

Tested on Ubuntu 18.04 with Arma: Cold War Assault version 1.99 from GOG running on Lutris using the lutris-5.7-5-x86_64 Wine build. Judging from the DSOAL Logfile generated with DSOAL_LOGLEVEL=3 I believe the game is using EAX 2.

I attached a short recording [2] of me walking at the beach of the mission "Ambush". The first 10 seconds are with EAX enabled, the rest is with EAX disabled.

[1] https://youtu.be/kngkmKleUo8?t=334 [2] arma_eax_bug_dsoal.zip

Hiradur commented 3 years ago

The recording linked in the inital post contained only audio. I made a video recording that hopefully better demonstrates the issue. Corresponding log files are also in the attached archive. Everything was recorded at the beginning of the 5th single mission called "Heavy Metal". As you can hear in the video, the artifacts sometimes disappear. I don't really know what's causing this.

arma_eax_bug_video.zip

ThreeDeeJay commented 3 years ago

I was also able to replicate the bug on the Steam version with a recent DSOAL + OpenAL Soft: https://i.imgur.com/WAHXRfr.mp4 Tho like you mentioned, it seems to be a DSOAL-specific issue because Creative ALchemy with an X-Fi sound card under the same conditions just works™: https://i.imgur.com/52jJXNA.mp4

Hiradur commented 2 years ago

Issue is still present with OpenAL Soft 1.22.2 official release and DSOAL commit a16c19f.

kcat commented 2 years ago

It almost sounds like there's two instances of each sound, creating a slight "phasy" effect, and sometimes the reverb becoming very strong temporarily. I don't see why this would be happening, though. The log shows the only EAX calls being made are first to query support, then very occasionally switches back and forth between the City and Plain presets. There is an oddity that every time it switches presets, it then sets the environment size to 0 when the range is 1 to 100. Older DSOAL I think would clamp the range (which could've accounted for it, since reducing the size to the minimum would increase the reverb gain and reduce the delays), but newer DSOAL/OpenAL Soft should error when given a size of 0 and leave the presets unchanged.

Hiradur commented 2 years ago

It almost sounds like there's two instances of each sound, creating a slight "phasy" effect, and sometimes the reverb becoming very strong temporarily.

While the recording indeed sounds a bit phasy (and I can't notice that phasiness in the X-Fi recoding linked by @ThreeDeeJay), the issue I was referring to is the loud noise coming from the left speaker while moving. It can be heard in the video recording I uploaded as part of the zip file in https://github.com/kcat/dsoal/issues/16#issuecomment-868982808.

kcat commented 2 years ago

While the recording indeed sounds a bit phasy (and I can't notice that phasiness in the X-Fi recoding linked by @ThreeDeeJay), the issue I was referring to is the loud noise coming from the left speaker while moving.

Yes, my thinking was these may be related. It seems like there's two instances of the sound timed very close to each other, which could've been the result of the game setting a reverb preset followed by setting the environment size to 0. On older DSOAL versions, this would result in the environment size being clamped to the minimum value of 1. By reducing the environment size to such a small value from the preset's original value, it would modify the initial reflections and late reverb delays to very small values, along with increasing the gains (and shortening the decay times). This would result in a sound being heard more clearly multiple times very closely in time, creating that phasiness.

Since the game occasionally swaps between two reverb presets, City and Plain, it made me think the "loud noise coming from the left speaker" is one of these reverbs having its environment size reduced to minimum and becoming much louder than the other, which goes away when it switches back to the other preset.

If that were the case, though, then newer DSOAL/OpenAL Soft should behave differently. With the native EAX functions, setting the environment size to 0 should error and leave the preset unchanged. The phasiness and loud noise should've stopped happening since it would be using the presets as-is without the size alteration. If it didn't change anything though, then that would mean the environment size change isn't causing these artifacts, or some other change is still happening.

It would be helpful if you're able to make updated logs with the newer versions, so I can check that DSOAL and OpenAL Soft are behaving as hypothesized.

Hiradur commented 2 years ago

Sorry, I just realized that the doubling of sound effects probably was an artifact caused by incorrect settings in OBS for the recording. The phasiness probably was not present in the game at the time I made the recording.

Anyway, the loud noise is still present with OpenAL Soft 1.22.2 and DSOAL commit a16c19f. I attached a new recording, this time with correct OBS settings, hopefully...

2022-07-03-arma_eax_bug.zip

kcat commented 2 years ago

This is still using an older DSOAL:

0124:trace:dsound:DSShare_Create Found ALC_EXT_EFX

The newer version doesn't check for this extension anymore, and should instead be checking for EAX5.0, which it isn't. The logs are also showing the old traces for the EAX->EFX wrapper functions that don't exist anymore.

Hiradur commented 2 years ago

This is still using an older DSOAL

You are right and I'm sorry for that. The game apparently is hard-coded to look for dsound.dll in the Windows\System32 directory and I forgot about that. I put the newer build in the game folder but not in Windows\System32, where I had an older build still lying around.

Anyway, here is another recording. With the new DSOAL build, it sounds different. The noise is still audible but much less obtrusive. In the second mission called Ambush (not recorded) it's much closer to the recordings of real hardware 1 and 2. In fact, I can hear some low level rumbling there too while they are walking. However, in the 5th single mission called Heavy Metal it's more pronounced and I'm wondering whether it's the game's fault or not. @ThreeDeeJay Should you have real hardware available for making comparisons, could you test the 5th mission and post your impressions or a recording?

2022-07-04-arma_eax_bug.zip

ThreeDeeJay commented 2 years ago

The game apparently is hard-coded to look for dsound.dll in the Windows\System32 directory and I forgot about that. I put the newer build in the game folder but not in Windows\System32, where I had an older build still lying around.

@Hiradur I've read dropping the DSOAL DLL in the system folders can cause issues so it's not recommended. If the game looks for the DLL in system32/syswow64, you gotta manually apply a registry tweak, or just run the script I posted in https://github.com/kcat/dsoal/issues/34#issuecomment-1139239755 to force loading the DLL from the game folder.

Anyhow, I made new recordings and I can confirm the loud running noise is gone (or at least toned way down). Ambush - DSOAL https://github.com/kcat/dsoal/commit/a16c19fdbb6c56bbd40a011362da0742a49f6f35 And here's the 5th mission: Heavy Metal - DSOAL https://github.com/kcat/dsoal/commit/a16c19fdbb6c56bbd40a011362da0742a49f6f35 Heavy Metal - Creative ALchemy: Software emulation on Windows 10 Heavy Metal - CMSS-3D: Real hardware X-Fi on Windows XP

kcat commented 2 years ago

DSOAL's reverb seems to actually be quieter compared to ALchemy and real hardware (there's more apparent reverb during the reload sound, for example), and the heart pumping(?) sound when running is less pronounced with DSOAL.

Hiradur commented 2 years ago

The noise that I considered to be an artifact is also present when disabling EAX, it's just much more quiet. It is so quiet in fact that it is difficult to notice in the beginning of the 5th single mission since there are environmental sounds which are much louder. It also only appears when walking, not when standing still. The noise slighty changes its acoustical characteristics depending on whether one is walking slowly, walking at normal speed or running. I wonder if it's supposed to represent the noise that air makes in one's ears caused by one owns movement. With older DSOAL builds, EAX effects in ARMA were pretty much unenjoyable due to the excessive level of that noise. However, with build a16c19f it's mostly acceptable, although in comparison to the recording on X-Fi (thanks @ThreeDeejay for the quick response!), I think it's still too loud. On another note, I have the feeling that the reverb sounds more natural on X-Fi hardware in comparison to DSOAL in this game.

Hiradur commented 2 months ago

Revisting this issue, I´d like to summarize my observations from listening:

Here are the traces using fresh build using the commits mentioned above: arma_dsoal_eax_artifact_202409.zip

Since only one sound seems to be problematic and it is very close to the listener but not listener-local, I wonder if there are unintended side effects with how OpenAL Soft handles very close sounds and EAX together. However, the heart-pumping and breathing sounds are also 3D sounds close to the listener and don't show the same problem :thinking: .

kcat commented 2 months ago

Here are the traces using fresh build using the commits mentioned above: arma_dsoal_eax_artifact_202409.zip

This seems to be using the latest master of DSOAL, not the c++-rewrite with that commit (it's showing C function names and using old extensions).

Since only one sound seems to be problematic and it is very close to the listener but not listener-local, I wonder if there are unintended side effects with how OpenAL Soft handles very close sounds and EAX together. However, the heart-pumping and breathing sounds are also 3D sounds close to the listener and don't show the same problem 🤔 .

Unfortunately the game seems to set parameters using SetAllParameters, so it doesn't show what values are being set. It's possible DSound has some kind of "deadzone" for nearby sounds, so a sound that's ever-so-slightly to the left should be centered instead if left-panned. Alternatively, maybe there's some issue with how DS3DMODE_DISABLE and/or DSBCAPS_CTRLPAN is handled if that sound is using that mode.

Hiradur commented 2 months ago

This seems to be using the latest master of DSOAL, not the c++-rewrite with that commit (it's showing C function names and using old extensions).

Right, sorry. I fell into the same trap I already fell into in https://github.com/kcat/dsoal/issues/16#issuecomment-1174367811. Nevertheless, the issue still exists with the c++-rewrite. FWIW here are the logs of DSOAL c++-rewrite commit 14a8ca57: arma_eax_issue_20240918.zip

I tried to listen closely to this recording on original hardware, but I was unable to hear the problematic sound in this case. A longer recording of just walking (not running and shooting) around would be helpful. @ThreeDeeJay , could you please check if you can hear the problematic sound toward the left with EAX enabled on real hardware while walking? Might it be centered in this configuration instead? I suggest that you test using the 5th single mission "heavy metal" since there are two different EAX environments close at the spawn point, which simplifies testing. The border of the EAX environments lies ca. 2m behind the town signs of Levie at the spawn point.