https://bugs.winehq.org/show_bug.cgi?id=45311
Bug ID: 45311 Summary: Skyrim Special Edition: ambient sounds do not attenuate with distance Product: Wine Version: 3.9 Hardware: x86-64 OS: Linux Status: UNCONFIRMED Severity: normal Priority: P2 Component: xaudio2 Assignee: wine-bugs@winehq.org Reporter: forestcode@ixio.org Distribution: ---
In Skyrim SE, ambient sounds are supposed to attenuate based on the camera's distance from the source, so that distant sounds will be barely perceptible, nearby sounds will be loud and clear, and moving closer or farther from the source will gradually change the sound's volume accordingly.
When running on wine with builtin xaudio, distance attenuation does not work; any time the camera enters a certain (fairly distant) radius from a sound source, that sound will suddenly start playing at full volume, as if the source was in the player's ear. This results in disturbing situations like startlingly loud footsteps and voices produced by distant NPCs, or a sudden roar of water rushing the moment the player crosses an invisible threshold in the vicinity of a river.
When running with Microsoft's native 64-bit xaudio libs, distance attenuation works properly.
Note: While winetricks xact is probably the easiest way to install the native xaudio libs for testing purposes, recent versions of winetricks do not install the 64-bit versions. (See wine bug 41618#c5.) Reverting this commit is therefore necessary in order to get the libs needed for Skyrim SE's 64-bit executable: https://github.com/Winetricks/winetricks/commit/f2b3d268d941120d13b4c3c3960b...
I have identified a few locations in the early part of game where this bug is prominent:
1. A point on the road from Helgen to Riverwood where the rumbling of a nearby river cuts in suddenly as the player approaches it. 2. A point on the same road, closer to the river, where the whooshing of rushing water cuts in suddenly as the player approaches. 3. A point in Riverwood where the creaking of the wooden water wheel cuts in at full volume as the player approaches.
When standing at any of these points, one can hear the ambient sounds cut in and out either by walking closer/farther from the sound source, or by zooming out to third-person view and rotating the camera around the player, such that the camera enters/exits the sound's radius.
I will attach screen shots showing these locations.
https://bugs.winehq.org/show_bug.cgi?id=45311
--- Comment #1 from Forest forestcode@ixio.org --- Created attachment 61584 --> https://bugs.winehq.org/attachment.cgi?id=61584 map of general area where these locations can be found
https://bugs.winehq.org/show_bug.cgi?id=45311
--- Comment #2 from Forest forestcode@ixio.org --- Created attachment 61585 --> https://bugs.winehq.org/attachment.cgi?id=61585 sound threshold 1: river water rumbling
https://bugs.winehq.org/show_bug.cgi?id=45311
--- Comment #3 from Forest forestcode@ixio.org --- Created attachment 61586 --> https://bugs.winehq.org/attachment.cgi?id=61586 sound threshold 2: river water rushing
https://bugs.winehq.org/show_bug.cgi?id=45311
--- Comment #4 from Forest forestcode@ixio.org --- Created attachment 61587 --> https://bugs.winehq.org/attachment.cgi?id=61587 sound threshold 3: water wheel creaking
https://bugs.winehq.org/show_bug.cgi?id=45311
Andrew Eikum aeikum@codeweavers.com changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |aeikum@codeweavers.com
https://bugs.winehq.org/show_bug.cgi?id=45311
Olivier F. R. Dierick o.dierick@piezo-forte.be changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |o.dierick@piezo-forte.be
--- Comment #5 from Olivier F. R. Dierick o.dierick@piezo-forte.be --- I don't have Skyrim but I'm experiencing the same issue with at least two other games: Orion Prelude and Far Cry 3.
Environment sounds (river/water, wind, fire, etc.) are full volume and cuts in and out when walking towards/away from the source. Normally, the sound volume should decrease/increase smoothly with distance.
commit b747d6f6ccdf1699a9242a570d681fa246de592e is the culprit. It makes xaudio2 default to builtin.
The workaround is to set xaudio2_7 to "native, builtin". Does it work with Skyrim?
https://bugs.winehq.org/show_bug.cgi?id=45311
--- Comment #6 from Olivier F. R. Dierick o.dierick@piezo-forte.be --- (In reply to Olivier F. R. Dierick from comment #5)
The workaround is to set xaudio2_7 to "native, builtin". Does it work with Skyrim?
I mean without installing xact with winetricks.
https://bugs.winehq.org/show_bug.cgi?id=45311
--- Comment #7 from Andrew Eikum aeikum@codeweavers.com --- (In reply to Olivier F. R. Dierick from comment #5)
commit b747d6f6ccdf1699a9242a570d681fa246de592e is the culprit. It makes xaudio2 default to builtin.
The workaround is to set xaudio2_7 to "native, builtin". Does it work with Skyrim?
Many games include the redist stuff themselves, so you will still get the native xaudio2 components without using winetricks. This is why you are able to work around this by using native xaudio2_7 without using winetricks. The commit you mention means we always use Wine's xaudio2 even when a native xaudio2 is available. This is to work around Bug 38668. As you found, you can override this setting in order to use native to get the old behavior from before b747d6. If it doesn't crash for you, using native is a fine workaround.
I'm working on a fix for the Skyrim bug mentioned here. I haven't looked at Orion or FarCry 3, so I don't know if this fix will help them.
https://bugs.winehq.org/show_bug.cgi?id=45311
--- Comment #8 from Olivier F. R. Dierick o.dierick@piezo-forte.be --- (In reply to Andrew Eikum from comment #7)
(In reply to Olivier F. R. Dierick from comment #5)
Does it work with Skyrim?
Many games include the redist stuff themselves, so you will still get the native xaudio2 components without using winetricks. This is why you are able to work around this by using native xaudio2_7 without using winetricks. The commit you mention means we always use Wine's xaudio2 even when a native xaudio2 is available. This is to work around Bug 38668. As you found, you can override this setting in order to use native to get the old behavior from before b747d6. If it doesn't crash for you, using native is a fine workaround.
Ok, thanks. I was just trying to help the OP with a workaround. I didn't know about bug 38668 and the crash with native xaudio2. Shouldn't this bug 'Depends on' bug 38668?
I'm working on a fix for the Skyrim bug mentioned here. I haven't looked at Orion or FarCry 3, so I don't know if this fix will help them.
I will test and report back.
https://bugs.winehq.org/show_bug.cgi?id=45311
zzzzzyzz@hacari.org changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |zzzzzyzz@hacari.org
https://bugs.winehq.org/show_bug.cgi?id=45311
Mike Matis mpmatis@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |mpmatis@gmail.com
--- Comment #9 from Mike Matis mpmatis@gmail.com --- I am experiencing the distance attenuation issue exactly as described by Forest. I'm using the xaudio2_7 patch from Bug #39402 by Andrew Eikum that makes sound work in builtin mode. I get no sound at all on native. Is it possible the problem is actually caused by another dll, like x3daudio?
https://bugs.winehq.org/show_bug.cgi?id=45311
--- Comment #10 from Olivier F. R. Dierick o.dierick@piezo-forte.be --- (In reply to Mike Matis from comment #9)
I am experiencing the distance attenuation issue exactly as described by Forest. I'm using the xaudio2_7 patch from Bug #39402 by Andrew Eikum that makes sound work in builtin mode.
The patch from bug 39402 fixes sound conversion for a few formats. It is unrelated to the attenuation of sound.
(In reply to Mike Matis from comment #9)
I get no sound at all on native.
Skyrim does not ship native xaudio2 DLLs. You'll have to install xact with winetricks to get native xaudio2 DLLs in Skyrim. See the note from Forest in comment 0 about installing 64-bit xact with winetricks.
(In reply to Mike Matis from comment #9)
Is it possible the problem is actually caused by another dll, like x3daudio?
If setting xaudio2_7 to native does fix the issue (with proper native xaudio2 DLLs installed), then the issue is with builtin xaudio2_7. If you still have sound attenuation issue with native xaudio2_7 then you may have another issue and you should report that separately, but try installing native xaudio2 first.
https://bugs.winehq.org/show_bug.cgi?id=45311
--- Comment #11 from Mike Matis mpmatis@gmail.com ---
Skyrim does not ship native xaudio2 DLLs. You'll have to install xact with winetricks to get native xaudio2 DLLs in Skyrim. See the note from Forest in comment 0 about installing 64-bit xact with winetricks.
I can't believe I missed that. I completely misunderstood it the first time I read it. Got a winetricks from prior to that commit, installed native xact libs and the sound is working perfectly. Thank you!
https://bugs.winehq.org/show_bug.cgi?id=45311
alasky@codeweavers.com changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |alasky@codeweavers.com
https://bugs.winehq.org/show_bug.cgi?id=45311
Andrew andrew.mrolko@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |andrew.mrolko@gmail.com
--- Comment #12 from Andrew andrew.mrolko@gmail.com --- (In reply to Mike Matis from comment #11)
Skyrim does not ship native xaudio2 DLLs. You'll have to install xact with winetricks to get native xaudio2 DLLs in Skyrim. See the note from Forest in comment 0 about installing 64-bit xact with winetricks.
I can't believe I missed that. I completely misunderstood it the first time I read it. Got a winetricks from prior to that commit, installed native xact libs and the sound is working perfectly. Thank you!
Correct me if I'm wrong, based on Oliver's comment does this mean that this ticket is a duplicate of https://bugs.winehq.org/show_bug.cgi?id=39402 ?
Or is there something specific to Skyrim to manifest this bug in xaudio?
Furthermore, Oliver would you be interested in writing a how-to to post on the wineappdb page found here? https://appdb.winehq.org/objectManager.php?sClass=version&iId=34366
I would really appreciate that as I'm the maintainer for this game but have issues with audio as well.
https://bugs.winehq.org/show_bug.cgi?id=45311
--- Comment #13 from Forest forestcode@ixio.org ---
Correct me if I'm wrong, based on Oliver's comment does this mean that this ticket is a duplicate of https://bugs.winehq.org/show_bug.cgi?id=39402 ?
Not a duplicate. That other bug is about supporting different audio formats/encodings. This one is about playing sounds at the correct volume.
https://bugs.winehq.org/show_bug.cgi?id=45311
--- Comment #14 from Andrew andrew.mrolko@gmail.com --- (In reply to Forest from comment #13)
Correct me if I'm wrong, based on Oliver's comment does this mean that this ticket is a duplicate of https://bugs.winehq.org/show_bug.cgi?id=39402 ?
Not a duplicate. That other bug is about supporting different audio formats/encodings. This one is about playing sounds at the correct volume.
Ah, you are correct. The reason I got that flubbed up was because of some similar issues with audio that have affected the Wolfenstein games.
This Skyrim SE ticket describes in detail test results that a user had posted on the Wolfenstein: The New Order page a while back, have a read: https://appdb.winehq.org/objectManager.php?sClass=version&iId=31803
I'm curious if the root cause of the audio attenuation problem in Skyrim will fix some of the crashing issues noted in Wolfenstein. Some input from a developer would be appreciated.
https://bugs.winehq.org/show_bug.cgi?id=45311
--- Comment #15 from Andrew Eikum aeikum@codeweavers.com --- (In reply to Andrew from comment #14)
I'm curious if the root cause of the audio attenuation problem in Skyrim will fix some of the crashing issues noted in Wolfenstein. Some input from a developer would be appreciated.
Native (Microsoft's) xaudio2 has a crash bug in Wine on 64-bit. This is Bug 38668. You can read the analysis of the problem there.
Built-in (Wine's) xaudio2 does not yet do volume mixing correctly, which is what this bug is about.
I'm not aware of any crashes in Wolfenstein or Skyrim due to built-in xaudio2. If there are crashes due to built-in xaudio2, those should be filed as separate bugs.
Hope that clears things up.
https://bugs.winehq.org/show_bug.cgi?id=45311
--- Comment #16 from Andrew Eikum aeikum@codeweavers.com --- I should add, built-in xaudio2 also does not support WMA audio. This can result in some game audio missing, or in crashes. This is bug 39402. There is a patch available to use ffmpeg to work around this, and the patch is in wine-staging.
https://bugs.winehq.org/show_bug.cgi?id=45311
Joel Holdsworth joel@airwebreathe.org.uk changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |joel@airwebreathe.org.uk
https://bugs.winehq.org/show_bug.cgi?id=45311
~J~ funtimeschaos@rocketmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |funtimeschaos@rocketmail.co | |m
--- Comment #17 from ~J~ funtimeschaos@rocketmail.com --- *** Bug 45781 has been marked as a duplicate of this bug. ***
https://bugs.winehq.org/show_bug.cgi?id=45311
C0rn3j spleefer90@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |spleefer90@gmail.com
https://bugs.winehq.org/show_bug.cgi?id=45311
Kai Krakow kai@kaishome.de changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |kai@kaishome.de
--- Comment #18 from Kai Krakow kai@kaishome.de --- Maybe this is due to the following functions not being implemented at all?
004a:trace:xaudio2:XA2SRC_SetOutputMatrix 0x7f7d63036500, 0x3a11a728, 1, 6, 0x7f7e14d663d8, 0x0 004a:trace:xaudio2:XA2SRC_SetOutputMatrix 0x7f7d63036500, 0x3a161d48, 1, 2, 0x3af5fb10, 0x0 004a:trace:xaudio2:XA2SRC_SetOutputFilterParameters 0x7f7d63036500, 0x3a11a728, 0x3af5fb00, 0x0
Shouldn't it say "fixme...: stub" then instead?
https://bugs.winehq.org/show_bug.cgi?id=45311
--- Comment #19 from Kai Krakow kai@kaishome.de --- Continuing my previous comment, I've played with this a little bit:
It's part of the solution. Skyrim uses the output matrix to upmix mono samples to the computer audio system (6 channels here). Voice samples will upmix to two channels, ambient sound upmix to 6 channels. They are played non-directional.
004b:trace:xaudio2_matrix:XA2SRC_SetOutputMatrix -- *pLevelMatrix = {0.250206,0.000000,0.000000,0.000000,0.368162,0.000000} 004b:trace:xaudio2_matrix:XA2SRC_SetOutputMatrix -- *pLevelMatrix = {0.573172,0.573172}
It's always the same values per sample no matter which direction I'm facing. So it's also not really handling the volume. Calculating an RMS from the values to prevent hard cut-offs and attenuation to the "main volume" has some effect: Ambient sounds now don't simply pop in and out but they attenuate with decreasing distance, strange is: This happens in steps, it's not smooth.
So actually Skyrim puts some volume information here. But it also sets an output filter which is also not implemented.
Ambient voices from NPCs tho still have the same issue: You can hear all talking NPC nearby as if talking face to face. Skyrim also tries to apply an output filter here.
What I think the filter should be doing is: After upmixing, the filter will arrange the sample spatially across your speakers. Voices would always use two virtual speakers so voice would come from the front. Ambient sounds always distribute the sound around you with attenuation from one direction. The filter probably should position the sound source spatially and also apply some filters for volume and some frequency pass filters (sounds farther away should fade out in the lower spectrum later).
Upmixing is a problem with OpenAL (which is used by xaudio2): It simply has no interface for that (only downmixing via spatial extensions). But we could probably infer an attenuation direction from the output matrix, and then set a direction of the sound source - but I'm pretty sure this won't be easy... That's more or less where my skills end currently.
https://bugs.winehq.org/show_bug.cgi?id=45311
--- Comment #20 from Kai Krakow kai@kaishome.de --- Created attachment 62499 --> https://bugs.winehq.org/attachment.cgi?id=62499 NOT A FIX: patch for toying around
Please do not apply if you don't want to use it for further debugging. It doesn't fix anything and probably has bad side-effects in other games.
https://bugs.winehq.org/show_bug.cgi?id=45311
Steven Noonan steven@valvesoftware.com changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |steven@valvesoftware.com
https://bugs.winehq.org/show_bug.cgi?id=45311
pattietreutel katyaberezyaka@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |katyaberezyaka@gmail.com
https://bugs.winehq.org/show_bug.cgi?id=45311
Ethan Lee flibitijibibo@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |flibitijibibo@gmail.com
--- Comment #21 from Ethan Lee flibitijibibo@gmail.com --- Wine 4.3 has a new XAudio2 and X3DAudio implementation that should include proper attenuation.
As far as Wine's concerned this should be RESOLVED FIXED, but FAudio's 3D math may not be 100% accurate and the game uses xWMA extensively, and we can only support that with special FAudio builds that link to FFmpeg.
https://bugs.winehq.org/show_bug.cgi?id=45311
--- Comment #22 from Forest forestcode@ixio.org --- Thanks, Ethan! Thanks, Andrew! <3
https://bugs.winehq.org/show_bug.cgi?id=45311
Anya animegirl@stronzi.org changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |animegirl@stronzi.org
--- Comment #23 from Anya animegirl@stronzi.org --- Still a problem with latest faudio from proton.
https://bugs.winehq.org/show_bug.cgi?id=45311
mirh mirh@protonmail.ch changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |mirh@protonmail.ch
--- Comment #24 from mirh mirh@protonmail.ch --- Is it good now? Or it could be one of the few things still left I guess. https://github.com/FNA-XNA/FAudio/issues/42
https://bugs.winehq.org/show_bug.cgi?id=45311
tinozzo123@tutanota.com changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |tinozzo123@tutanota.com
https://bugs.winehq.org/show_bug.cgi?id=45311
soredake broaden_acid002@simplelogin.com changed:
What |Removed |Added ---------------------------------------------------------------------------- CC|broaden_acid002@simplelogin | |.com |