Skip to content

There is a sound problem in the new version #1717

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
ycb678 opened this issue Dec 9, 2024 · 54 comments
Closed

There is a sound problem in the new version #1717

ycb678 opened this issue Dec 9, 2024 · 54 comments

Comments

@ycb678
Copy link

ycb678 commented Dec 9, 2024

The above sound problem occurs in versions after shadps4-win64-qt-fullbb-12-07-12c58e4, but there is no such problem in previous versions
win1124h2 i7-1180h 3060(6GB)

@ycb678
Copy link
Author

ycb678 commented Dec 9, 2024

QQ2024129-203812.mp4

@Missake212
Copy link
Contributor

You're on a fork, open an issue if you're having an issue on main

@ycb678
Copy link
Author

ycb678 commented Dec 9, 2024

ok

@Hermiten Hermiten closed this as completed Dec 9, 2024
@C0rn3j
Copy link
Contributor

C0rn3j commented Dec 9, 2024

@Hermiten please re-open, I can repro on this repo, immediately on the Online/Offline launch screen, this is actually the exact same issue I reported here - shadps4-emu/shadps4-game-compatibility#71 (comment)

Reposting:


Arch Linux, Plasma, Wayland, Nvidia, built from AUR/shadps4-git, using all currently wiki-recommended sys_modules on fea2593.

Had to unset $DISPLAY otherwise the game would be a black screen unset DISPLAY; shadps4 - as per #1045

The game has extremely glitchy audio, it effectively loops a random frequency related to the sound it was trying to do, EXCEPT for playing cutscenes which are crystal clear (it combines the two when both are playing, resulting in this mess + clear audio played together).

Game crashes after the first cutscene in the character creator due to #1704, working around it gets me past character creation, but the sound remains broken.

shad_log.txt with cc freeze + audio issues, without 1704 workaround

@ngoquang2708
Copy link
Contributor

@C0rn3j For sound problem, I recommend uninstall sdl3 or sdl3-git and build the emulator manually. Sound only work correctly with the bundled sdl3.

@C0rn3j
Copy link
Contributor

C0rn3j commented Dec 9, 2024

@ngoquang2708 could you link the relevant tracker with info as to why that is?

I see -DCMAKE_DISABLE_FIND_PACKAGE_SDL3=ON argument for cmake forces the submodule.

I found #999 (comment), which simply mentions that OPs version of SDL3 is too new, but no extra details, and all SDL-related issues are closed.

@ngoquang2708
Copy link
Contributor

@C0rn3j I don't have any ideas why it is like that. It just my personal experience.

@ngoquang2708
Copy link
Contributor

@C0rn3j FYI, sound problem happens for me for a long time ago, not just recently.

@C0rn3j
Copy link
Contributor

C0rn3j commented Dec 9, 2024

Nope, uninstalled system SDL3, added the CMAKE arg for good measure, added submodule init for sdl, rebuilt from latest git in a clean chroot and it still breaks audio.

Please reopen.

@Hermiten Hermiten reopened this Dec 9, 2024
@Virgula0
Copy link
Contributor

Virgula0 commented Dec 10, 2024

Had the same problem with few other games on windows too, and I can confirm the broken audio for Bloodborne on linux (arch using aur bulid) as for @C0rn3j

And the idea to build it manually does not make too much sense since aur re-builds binaries every time by itself.

@ngoquang2708
Copy link
Contributor

And the idea to build it manually does not make too much sense since aur re-builds binaries every time by itself.

We have to build manually because the AUR package use difference version of sdl3 which is incompatible with the emulator.

@C0rn3j
Copy link
Contributor

C0rn3j commented Dec 10, 2024

which is incompatible with the emulator.

Note that that is no longer the case and shad compiles and runs fine with AUR repo SDL3 (currently at latest preview version of 3.1.6).

The resolved issue above about new SDL being broken was failing in the compile stage outright, it had got fixed for current SDL3 in the meantime it seems.

The sound is broken with both bundled SDL3 and AUR/sdl3.

And the idea to build it manually does not make too much sense since aur re-builds binaries every time by itself.

AUR does not do anything by itself, it is just a recipe repository.

@C0rn3j
Copy link
Contributor

C0rn3j commented Dec 11, 2024

Is everyone here with the issue on Nvidia?

I've had someone on Arch Linux use the same package and they don't have the issue on an AMD GPU.

OP uses Intel CPU, I use AMD, so the only common denominator seems to be Nvidia, I use 4000 series, Linux and 565.77 open modules.

@ycb678
Copy link
Author

ycb678 commented Dec 12, 2024

 yes  on an nvdia gpu Intel CPU

@DISREL
Copy link

DISREL commented Dec 14, 2024

I am on MacOS and this issue also persists in the latest build - https://github.com/shadps4-emu/shadPS4/releases/tag/Pre-release-shadPS4-2024-12-14-3e22622

The audio issue starts immediately on the "play online/play offline" menu on launch, just like @C0rn3j.

EDIT: Bit of an update, issue is with the game audio itself. The cutscenes just work fine.

@Virgula0
Copy link
Contributor

Is everyone here with the issue on Nvidia?

I've had someone on Arch Linux use the same package and they don't have the issue on an AMD GPU.

OP uses Intel CPU, I use AMD, so the only common denominator seems to be Nvidia, I use 4000 series, Linux and 565.77 open modules.

NVIDIA card + intel CPU here

@C0rn3j
Copy link
Contributor

C0rn3j commented Dec 14, 2024

I am on MacOS and this issue also persists in the latest build - https://github.com/shadps4-emu/shadPS4/releases/tag/Pre-release-shadPS4-2024-12-14-3e22622

The audio issue starts immediately on the "play online/play offline" menu on launch, just like @C0rn3j.

EDIT: Bit of an update, issue is with the game audio itself. The cutscenes just work fine.

What hardware is that macOS on? GPU specifically.

I recall old Macs used to have Nvidia.

@DISREL
Copy link

DISREL commented Dec 14, 2024

I am on MacOS and this issue also persists in the latest build - https://github.com/shadps4-emu/shadPS4/releases/tag/Pre-release-shadPS4-2024-12-14-3e22622
The audio issue starts immediately on the "play online/play offline" menu on launch, just like @C0rn3j.
EDIT: Bit of an update, issue is with the game audio itself. The cutscenes just work fine.

What hardware is that macOS on? GPU specifically.

I recall old Macs used to have Nvidia.

It is a Macbook Pro 14 inch (M4 Max). I am going to try a couple of different builds and see if I can find a root cause analysis.

@squidbus
Copy link
Collaborator

squidbus commented Dec 14, 2024

It is a Macbook Pro 14 inch (M4 Max). I am going to try a couple of different builds and see if I can find a root cause analysis.

I have always had this issue on Mac even before the game was properly bootable so I don't think you'll find much looking back.

@C0rn3j
Copy link
Contributor

C0rn3j commented Dec 14, 2024

A friend of mine mentioned they had this issue on Windows some months ago - no longer, however.

So it looks like it may be platform independent, both OS and GPU/CPU, and the changes in the emulator over time just make it trigger on and off on specific setups.

@ycb678
Copy link
Author

ycb678 commented Dec 15, 2024

How do I fix this, the problem still reproduces until now

@MisterNorwood
Copy link

I can confirm this is an issue on the current main branch build:
Os and Hardware: Arch Linux Ryzen 9 7900X, Radeon RX 7900 XTX
v0.4.1 WIP main v.0.4.0-213-g87773a41

@Zebouski
Copy link

Yep experiencing this too from Play Online/Offline main menu screen.

Arch linux, i7-6700K CPU, AMD Radeon RX 580
built from AUR shadps4-git, v0.4.1 WIP main v.0.4.0-213-g87773a41

@ngoquang2708
Copy link
Contributor

@C0rn3j Does sound issue happen when run withSDL_AUDIO_DRIVER=pulseaudio env set?
I believe when you build with system SDL, it will link with PipeWire which cause audio issue. Confirmed on my end.

@C0rn3j
Copy link
Contributor

C0rn3j commented Dec 20, 2024

Still happens.

% killall -9 shadps4; unset DISPLAY; export SDL_AUDIO_DRIVER=pulseaudio; SDL_AUDIO_DRIVER=pulseaudio shadps4

I believe when you build with system SDL, it will link with PipeWire which cause audio issue. Confirmed on my end.

I do have the issue on both system SDL and shad's builtin SDL version.

EDIT: Verified it is in fact applying by pw-cli ls | grep -C 10 shad | grep -e id -e alias -e name -e api -e protocol too.

@MisterNorwood
Copy link

MisterNorwood commented Dec 21, 2024

Still happens.

% killall -9 shadps4; unset DISPLAY; export SDL_AUDIO_DRIVER=pulseaudio; SDL_AUDIO_DRIVER=pulseaudio shadps4

I believe when you build with system SDL, it will link with PipeWire which cause audio issue. Confirmed on my end.

I do have the issue on both system SDL and shad's builtin SDL version.

Overriding SLD audio driver fixed the issue for me. Thank you!

@C0rn3j
Copy link
Contributor

C0rn3j commented Dec 25, 2024

I have remembered that I have custom audio settings, which are apparently triggering the issue.

Shad wouldn't be the only software that this breaks, as Tauon had to fix their PW implementation too.

Basically, Tauon expected that the buffer is of a static size, but it is in fact dynamic and can be larger than expected.

Here's an upstream PW issue about this, as apparently this isn't considered kosher handling by PW either for the values I have set - https://gitlab.freedesktop.org/pipewire/pipewire/-/issues/4334

Here is my ~/.config/pipewire directory which triggers the issue - pipewire.zip - but the relevant parts should be the edited quantum values:

# pipewire.conf
default.clock.quantum       = 2048 # 1024
default.clock.min-quantum   = 1024 # 32
default.clock.max-quantum   = 4096

EDIT4: I still manage to get the initial glitched audio on default audio configs after closing some applications hooking into the sound system, so it looks like it can still trigger the bug even on defaults.

EDIT5: This is a bit over my head, but isn't shad completely ignoring the system buffers and just hardcoding it?

constexpr int AUDIO_STREAM_BUFFER_THRESHOLD = 65536; // Define constant for buffer threshold


EDIT: Huh, actually most sounds are missing but at least it now doesn't violate my ears:

https://www.youtube.com/watch?v=0KyZZWzIsEw

On the video one can only hear the enemies in the background and wind blowing, none of the sounds my character should be making are there.

Happens on both PW+Pulse backends.

EDIT2: 60FPS patch was responsible for the remaining issue of missing sound effects
EDIT3: Reported patch issue here but it turns out to be the classic unclean shutdown issue, despite me remembering I tested for that - shadps4-emu/ps4_cheats#21

@Bettehem
Copy link
Contributor

Bettehem commented Dec 26, 2024

I am experiencing the same missing character sounds issue as @C0rn3j but for me seems to happen only on my AMD GPU when using the 60fps patch and Log Type set to async. If Log Type is set to sync, audio works even with the 60fps patch.

On my NVIDIA GPU, audio works properly when using the 60fps patch even with Log Type set to async.

If the 60fps patch is disabled, there seem to be no audio issues regardless of the Log Type or GPU.

System specs:
CPU: AMD Ryzen 7 1800X
GPU0: AMD Radeon RX Vega 64
GPU1: NVIDIA GeForce GTX 1080
RAM: Kingston HyperX Fury 32GB
OS: Arch Linux

EDIT: Seems like the audio breaks if the game is not exited cleanly as reported here. If audio is broken, in the game go to the main menu, then restart the emulator and audio works on every configuration i have tried, with or without patches

@ShaunaTheDead86
Copy link

I was just testing the fix provided @squidbus when I saw that the commit was merged around the time of this post. There isn't a new build in the release folder yet, but the fix is coming soon. If you don't want to wait for a new release then follow the build instructions.

I can confirm that the build fixes all sound issues for me. For the record, I'm running an Arch based distro called Garuda Linux on Wayland with audio support installed for ALSA, PipeWire, and JACK.

@Hermiten
Copy link
Collaborator

Hermiten commented Dec 27, 2024

Ok nice, can anyone else who has already reported the problem test again on the last main?
This: #1895 can maybe fix the problem

@C0rn3j
Copy link
Contributor

C0rn3j commented Dec 27, 2024

Glitched on cubeb too.

@squidbus
Copy link
Collaborator

Glitched on cubeb too.

Distorted audio right? Not the issue with missing sounds.

@C0rn3j
Copy link
Contributor

C0rn3j commented Dec 27, 2024

Yep yep, the ear murdering banshee screams

@bucior3
Copy link

bucior3 commented Dec 28, 2024

For me it works on latest git on archlinux, before #1895 i had to set "SDL_AUDIO_DRIVER=pulseaudio shadps4" or i heard banshee screams

@Hermiten
Copy link
Collaborator

What about you @ycb678 ?

@C0rn3j
Copy link
Contributor

C0rn3j commented Dec 28, 2024

I'd like to point out is that SDL3 is problematic for PW (but not pulse) even for Valve games, where people (including me, without the quantum changes) lose sound completely until disabling and reenabling the sound device in pwvucontrol/pavucontrol in CS2 and Dota 2, which both use SDL3.

ValveSoftware/csgo-osx-linux#3832

Can I actually somehow simply force this package to completely rely on Qt instead of SDL, since I see that the CI has separate SDL and Qt builds?

https://aur.archlinux.org/cgit/aur.git/tree/PKGBUILD?h=shadps4-git

I've actually had my sound issue completely come back when I was testing couple days ago even on default PW config after killing whatever background apps I had turned on at the time, which were apparently managing to not cause it. (which is identical behavior to Tauon's PW buffer bug, where chromium YT window + iirc enabled mic made it stop glitching).

@FelSiq
Copy link

FelSiq commented Dec 28, 2024

I'm facing distorted audio issues on the latest release, too (I tried both w/ audio backend = cubeb and SDL).

NOTE: I'm inclined to say that some recent updates, possibly after enabling the cubed backend, has improved a little bit the audio distortion issue, but definitely hasn't solved it. It almost sounds like sound effects are played multiple times at once.

My system specs:

  • CPU: Intel Core i7-9750H CPU @ 2.60GHz (x86_64)
  • GPU: NVIDIA GeForce GTX 1650
  • RAM: Kingston DDR4 32 GB (2 x 16 GB)
  • OS: 6.1.119-1-MANJARO

UPDATE: the missing sound effects glitch triggers for me when the game session isn't properly finished. However, by loading a character and exiting the game properly fixes it for the next time.

The audio distortion still persists, thought. It is very perceptible while walking in the water, for example. It still sounds to me that it is caused by some sound effects being played multiple times and overlapping.

@ShaunaTheDead86
Copy link

Earlier I said that switching to cubeb fixed my audio issues, and it did fix the banshee scream sound but after playing Bloodborne awhile I noticed that there were many sounds that weren't playing at all.

After experimenting more, what others have suggested here works better for me. SDL_AUDIO_DRIVER=pulse or SDL_AUDIODRIVER=pulse environment variable seems to fix the sound issues.

I wonder if it has to do with the order SDL tries audio backends which goes openbsd, dsp, alsa, then pulse. The issue with SDL probably lies with openbsd, dsp, or alsa then.

@squidbus
Copy link
Collaborator

squidbus commented Dec 29, 2024

Earlier I said that switching to cubeb fixed my audio issues, and it did fix the banshee scream sound but after playing Bloodborne awhile I noticed that there were many sounds that weren't playing at all.

Did you try cubeb again after? There's a known issue where some sounds don't work properly sometimes in that game, mainly if you're using the 60FPS patch or when you get the notice that it was not closed properly on start.

@VasylBaran
Copy link
Contributor

I'm experiencing the same issue on both the latest release (v0.5.0) and latest nightly build ("Pre-release-shadPS4-2024-12-29-ac2e8c2") with both Audio backends. I'm on Arch Linux (Wayland). The problem is reproducible with multiple games not just a single game. Other applications/emulators work fine. My systemwide audio backend is pipewire.

@VasylBaran
Copy link
Contributor

Seems to be related to QUANT, RATE and WAIT values determined by shadPS4 for the audio_backend/pipewire.

In these examples when QUANT equals 256 audio is ok, when it's 1024 all I hear is a loud buzz.

I tested this on 3 different machines, two Arch Linux and one M1 Mac. One Arch Linux machine has a properly working audio (256 value), on another Arch Linux machine shadPS4 is broken (1024 value) and all I hear is a loud buzzing sound even though the output audio device is the same as before. On a 3rd machine (M1 Mac) audio is also broken (loud buzzing sound). This "randomness" complicates things...

20241230_16h57m22s_grim
20241230_17h08m36s_grim

@squidbus
Copy link
Collaborator

It's related to the amount of time sceAudioOutOutput takes and how games react to that.

@FelSiq
Copy link

FelSiq commented Dec 31, 2024

Tested again on most recent patch (nightly): audio with SDL backend is extremely distorted but using cubeb backend sounds far better to me.

@C0rn3j
Copy link
Contributor

C0rn3j commented Dec 31, 2024

Most recent version that is supposed to fix this issue lacks the cubeb backend, are you comparing against an older version with cubeb or possibly used the wrong version for testing (the dev releases are called pre-releases not nightly?)?

EDIT:

Has the patched version solved the issue for you?

Can't compile so can't test - #1994

@FelSiq
Copy link

FelSiq commented Dec 31, 2024

Comparing to a previous version, yes.

When I checked the SDL update, the cubeb option wasn't available anymore, so I believe it was the correct version.

Has the patched version solved the issue for you?


NOTE: the post-patch version spams the following warning to me:

[Lib.AudioOut] <Warning> sdl_audio.cpp:Output:71: SDL audio queue backed up (38656 queued, 32768 threshold), clearing.

@VasylBaran
Copy link
Contributor

@FelSiq please take in account that it depends on the game. For example Bloodborne and Darkwood used to be have broken sound in the older build for me but the new build fixed it. However in The Binding of Isaac: Rebirth the sound is still distorted (so even in the newest build of shadPS4)

@C0rn3j
Copy link
Contributor

C0rn3j commented Jan 1, 2025

@squidbus thanks a ton for your work, what an awesome present for New Year's!

I can't reproduce the OG sound glitches anymore.

I can't reproduce the patch sounds-be-gone anymore. I can but so far only on a failed exit load, before it randomly triggered without it too.

I also happen to not freeze anymore on fighting the initial enemy with the patches enabled. Still do, but it's just that specific one enemy...

The only things I've done is switched to clang to avoid the recently introduced gcc build failure and updated shad.

Sound is mildly cut-offy and I do have the queue overflow issue too, but this is SO MUCH BETTER.

I hope this isn't just me having a couple lucky launches - once again - thank you, and thanks to everyone else who works on this project!

@VasylBaran
Copy link
Contributor

@squidbus thanks a ton for your work, what an awesome present for New Year's!

I can't reproduce the OG sound glitches anymore.

I can't reproduce the patch sounds-be-gone anymore. I can but so far only on a failed exit load, before it randomly triggered without it too.

I also happen to not freeze anymore on fighting the initial enemy with the patches enabled.

The only things I've done is switched to clang to avoid the recently introduced gcc build failure and updated shad.

Sound is mildly cut-offy and I do have the queue overflow issue too, but this is SO MUCH BETTER.

I hope this isn't just me having a couple lucky launches - once again - thank you, and thanks to everyone else who works on this project!

I second this, thank you @squidbus for all your work. Happy New Year! 🥳

@Hermiten
Copy link
Collaborator

Hermiten commented Jan 1, 2025

Can I close this one ?
If there is still some problem but different from this issue, maybe open a new issue with a good description of what happens, etc...

@C0rn3j
Copy link
Contributor

C0rn3j commented Jan 1, 2025

It looks like the only person in here who had a better experience on the short-lived cubeb backend was @FelSiq - does the audio sound anything like #1717 (comment) for you, or does it sound like a different issue?

@FelSiq
Copy link

FelSiq commented Jan 2, 2025

@C0rn3j definitely different - in this video it is much more extreme of an issue.

If the audio has improved in general and we can agree that it varies across games, I believe it is fair to close this issue since the original problem appears to be solved and take a look into possibly other audio issues in future ones.

Thank you all for sharing your experience here.

@C0rn3j
Copy link
Contributor

C0rn3j commented Jan 2, 2025

Then I suppose this can be closed and a new issue should be created about your issues + the overflows (if it isn't even the same one, which it really looks like it may be)

EDIT: I've created #2015 to track the new issue

@Valrravn
Copy link

I have the same issue, but instead of audio cut off my game freezes dead altogether. Clicking a window causes Windows to throw "not responding: close or wait" warning. I choose to wait and it unfreezes eventually. The console is spammed with the yellow "SDL backed up X in queue" warnings while it hangs. In Event Viewer, the following message appears:

"Fault bucket , type 0
Event Name: AppHangTransient
Response: Not available
Cab Id: 0

Problem signature:
P1: shadPS4.exe
P2: 0.0.0.0
P3: 677f70b4
P4: unknown
P5: unknown
P6: unknown
P7: unknown
P8:
P9:
P10:

Attached files:
\?\C:\ProgramData\Microsoft\Windows\WER\Temp\WER.b09d219c-ed5c-461f-9ba7-37c6ac4b0823.tmp.WERInternalMetadata.xml
\?\C:\ProgramData\Microsoft\Windows\WER\Temp\WER.ae459302-5327-4679-9f57-1a5a799ae4a9.tmp.csv
\?\C:\ProgramData\Microsoft\Windows\WER\Temp\WER.0bd8015b-ea06-41ab-8744-a0a252599779.tmp.txt

These files may be available here:
NULL

Analysis symbol:
Rechecking for solution: 0
Report Id: 061051f9-62df-4c81-b587-d7605a18e86f
Report Status: 2049
Hashed bucket:
Cab Guid: 0"

Funnily enough, this happens when I attempt to play on regular output devices (main monitor + external Creative sound card). When I launch it on my TV, it runs smoothly and this issue never occurs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests