Bug 1219282 - Distorted sound with "AMD Family 17h/19h HD Audio" in some applications, apparently occurring under system heavier load
Summary: Distorted sound with "AMD Family 17h/19h HD Audio" in some applications, appa...
Status: NEW
Alias: None
Product: openSUSE Tumbleweed
Classification: openSUSE
Component: Sound (show other bugs)
Version: Current
Hardware: x86-64 Other
: P5 - None : Normal (vote)
Target Milestone: ---
Assignee: Takashi Iwai
QA Contact: E-mail List
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2024-01-29 11:17 UTC by S B
Modified: 2024-06-24 15:27 UTC (History)
0 users

See Also:
Found By: ---
Services Priority:
Business Priority:
Blocker: ---
Marketing QA Status: ---
IT Deployment: ---


Attachments
inxi -aA (1.08 KB, text/plain)
2024-01-29 11:17 UTC, S B
Details
pactl info (503 bytes, text/plain)
2024-01-29 11:18 UTC, S B
Details
uname -a (129 bytes, text/plain)
2024-01-29 11:19 UTC, S B
Details
dmesg | grep snd (996 bytes, text/plain)
2024-01-29 11:23 UTC, S B
Details
alsa-info.sh --no-upload (42.40 KB, text/plain)
2024-01-30 22:30 UTC, S B
Details

Note You need to log in before you can comment on or make changes to this bug.
Description S B 2024-01-29 11:17:22 UTC
Created attachment 872253 [details]
inxi -aA

I'm experiencing some annoying sound problems, that are occurring only during some circumstances (apparently under heavier system load, but I don't know if this is a factor), and appeared starting from about a month ago (end of December 2023). Before that, everything was working normally.

I'm running a fully updated tumbleweed, and I can notice this problem mainly when running games under Wine.

Basically, the game starts fine, and after a while (there is not a fixed time), the audio starts crackling/scratching. Sometimes this just distorts the sound output, sometimes it is so severe to mute any sound completely.

- It does not happen with every application. At the moment, browsers, VLC, spotify, and so on play sound correctly. Games run under Wine (through flatpak) and some other Linux games (still flatpak) have this problem. When this happens, when I close an app that causes this problem, sometimes even other apps (said browsers, spotify, etc) have their sounds distorted, at least for a while.

- I'm not sure about this, but I think that I noticed this problem more often when there is a heavier system load (especially disk I/O), but to be honest, after all this time trying to figure this out without results, it may be me drawing unrelated conclusions.

- This problem occurs only with a specific audio device, that controls my laptop built-in speakers: an "AMD Family 17h/19h HD Audio". My system is also equipped with an "AMD Renoir Radeon High Definition Audio" device that controls audio from the HDMI port, which works correctly when I connect it to i.e. an external TV. Everything is also working correctly with Bluetooth headphones or wired headphones connected to the jack port.

This problem is occurring with every possible configuration that I can't test:
- Both with pipewire (my default engine, which was working correctly until a month ago) and pulseaudio
- Both with my user account and with a brand new test account that I created just for testing this
- By logging in both with Wayland and X11 (and even ICEWM)
- With every Kernel that I was able to test right now (current 6.7.x, 6.6.x, 6.5.x), but only starting from the end of December (before that, no problems even with these versions)

I'm very puzzled and mildly annoyed by my inability to find a solution.
From what I can see, this seems to be unrelated to my specific user config and I am unable to understand what should I do.

Every possible related issue that I found by googling is mainly related to not having sound at all, which is easily diagnosed, while in my case this occurs in ways that I am not able to correctly pinpoint and troubleshoot.

If it is useful, I've opened a question on Superuser, but it has received much attention. Anyway, it's here 
https://superuser.com/q/1827353/170331

I'm adding some useful info as attachments, feel free to ask for more.
Thanks!
Comment 1 S B 2024-01-29 11:18:35 UTC
Created attachment 872254 [details]
pactl info
Comment 2 S B 2024-01-29 11:19:21 UTC
Created attachment 872255 [details]
uname -a
Comment 3 S B 2024-01-29 11:23:40 UTC
Created attachment 872256 [details]
dmesg | grep snd
Comment 4 Takashi Iwai 2024-01-30 12:12:01 UTC
Hmm, it's quite strange that the problem happens only with the speaker.  So, when you use the headphone from the same built-in HD-audio device, it's working fine?

In anyway, please give alsa-info.sh output.  Run with --no-upload option and attach the output.
Comment 5 S B 2024-01-30 22:30:30 UTC
Created attachment 872327 [details]
alsa-info.sh --no-upload
Comment 6 S B 2024-01-31 19:38:47 UTC
Thanks for your reply Takashi

I've tested again, and I must correct myself: even with wired headphones the distortion is still there, but less severe (maybe that's why I didn't notice before).
Comment 7 Takashi Iwai 2024-02-02 10:13:48 UTC
If this is a regression, you can try to downgrade the stuff.
For example, try to boot with the older kernels (6.6, 6.5, etc) and see whether the problem persists or not.  You can find some old (unofficial) kernel packages in my OBS repos, e.g. home:tiwai:kernel:6.6
  http://download.opensuse.org/repositories/home:/tiwai:/kernel:/6.6/standard/
and 6.5
  http://download.opensuse.org/repositories/home:/tiwai:/kernel:/6.5/standard/

It's a pity that the issue was reported so late.  Otherwise you had a chance for testing the older packages in TW history repo
  http://download.opensuse.org/history/
Comment 8 S B 2024-02-04 14:37:37 UTC
Thanks for sharing the repository with the old kernels, I tried already but I can do some more extensive testing if this could help.

For not reporting before, I regret this as well, but initially I was convinced that it was some Pipewire misconfiguration on my part. So I spent a lot of time trying testing with different bitrates, frequencies and configurations, before realizing that (apparently) that was not the source of the problem :(
Comment 9 S B 2024-02-07 22:04:11 UTC
I tried to test with the latest available kernels from both the 6.5.x and 6.6.x branches, and these issues are still there.

I'm not really sure about what's going on, but I think we can reasonably assume that the problem does not lie in the kernel (it started about the last days of December like I said, and I had those kernel versions before when everything was working ok).

If there are more things that I need to investigate or info that I can collect, let me know.
Comment 10 Takashi Iwai 2024-02-08 11:19:22 UTC
Then the rest part can be some update of sound backend.  Do you use pipewire, or still pulseaudio?

And such a distortion might depend on the sample rate or the sample format.
You can try to change the configuration to use another rate, either 48kHz or 44.1kHz.  Or use 16bit format or such.
Comment 11 S B 2024-02-08 13:47:47 UTC
I use pipewire. And I have tried to play with different configuration values, without any success at the moment.

I'm planning a fresh install after KDE Plasma will be released at the end of this month, to have a full cleanup of my current system configuration and home. 

I think I will put this on hold until that, and see if it will happen also afterward.

I will keep you updated anyway. Thanks for your help!
Comment 12 S B 2024-02-08 13:49:00 UTC
Anyway, I also had this problem with pulseaudio. The only thing that I have not tested (mostly because I'm not that experienced) is the ALSA configuration itself.
Comment 13 S B 2024-02-12 20:25:37 UTC
In the end I had to reinstall my system.

This problem is happening again, so it was not related to my previous configuration.
Comment 14 Takashi Iwai 2024-02-13 06:51:51 UTC
So the question is what broke things, supposing it was working in the past.
Since you tested various old kernels and they didn't work, it's something else, such as pipewire.  I guess you'd need to rebuild pipewire from the old version and check whether it works or not.
Comment 15 S B 2024-06-19 19:19:53 UTC
I am still experiencing this issue, but I am unable to provide more information, besides what I have already tried to collect before.

I can say that my laptop is the "Slimbook KDE 15 gen II", from 2020, the same exact model that was reviewed here: https://pointieststick.com/2020/07/23/the-superfast-ryzen-powered-kde-slimbook/

The tech specs as fare as I know are the same for all laptops of this model (except maybe RAM and SSD size, that should not be related to the present issue), so maybe there can be the chance that somebody else with the same laptop could provide more info or test this.
Comment 16 Takashi Iwai 2024-06-24 15:27:45 UTC
Unfortunately this kind of problem is pretty difficult to diagnose.

You can try different period and buffer sizes as well as sample formats (either 16 or 32bit) via aplay with the direct device access, e.g. 
  aplay -Dplughw:1 foo.wav

Provide a different wav file for 16bit and 32bit (you can convert it via sox, for example).  And play with various parameters --buffer-size and --period-size, check whether the symptom appears consistently.