Bug 103460

Summary: Crackle and noise in sound after few hours of work
Product: PulseAudio Reporter: tantrido
Component: coreAssignee: pulseaudio-bugs
Status: RESOLVED MOVED QA Contact: pulseaudio-bugs
Severity: normal    
Priority: medium CC: domenico.iezzi.201, lennart
Version: unspecified   
Hardware: x86-64 (AMD64)   
OS: Linux (All)   
Whiteboard:
i915 platform: i915 features:
Attachments: log caputre
0001-alsa-sink-disable-rewinding.patch
pulseaudio log with using provided patch

Description tantrido 2017-10-26 01:20:38 UTC
Crackle and noise appears in sound after few hours of work mostly during video watching. Also significant delay appears in sound during this. Killing pulseaudio process (it restarting automatically after this) solves the problem.

OS: openSUSE Tumbleweed
pulse version: 11.1
Comment 1 Tanu Kaskinen 2017-11-02 09:44:48 UTC
Can you provide the log when this happens? To get the PulseAudio log, follow these steps:

1. Disable automatic starting of PulseAudio. If your distro uses
systemd's socket activation to start PulseAudio, run

    systemctl --user --now mask pulseaudio.service pulseaudio.socket

If your distro doesn't do that, put "autospawn = no" to
~/.config/pulse/client.conf.

2. Stop pulseaudio with "killall pulseaudio" (the previous systemctl
command might have stopped it already, though).

3. Start pulseaudio in a terminal with verbose logging and timestamps:

    pulseaudio -vv --log-time

4. Let it run until you encounter the crackling again. As soon as the crackling starts, quickly switch to the terminal where pulseaudio is running and press enter a few times to add empty lines marking the spot where crackling started.

5. Stop pulseaudio with ctrl-c.

6. Save the part of the log that preceded the empty lines that you added. A minute worth of logging should be enough.

7. To return things back to normal, run

    systemctl --user unmask pulseaudio.service pulseaudio.socket

if you masked the service before. And remove the "autospawn = no" line
from client.conf if you added it there.
Comment 2 tantrido 2017-11-21 17:30:18 UTC
I'll provide logs. Some more information: when noise begins sound delay appears in videos (web, youtube, smplayer, vlc, any other).
Comment 3 taiko2k 2017-12-28 05:07:43 UTC
Created attachment 136419 [details]
log caputre

I'm experiencing a similar issue. Audio randomly becomes cracked/distorted and delayed (robotic sounding). Happens with a variety of applications (Video player, music player, web browser, games etc). Restarting the source application returns the sound to normal.

OS: Arch Linux
Pulseaudio: 11.1

Attached log is from an example of it happening as per instructions.
Comment 4 Domenico Iezzi 2018-05-07 11:50:46 UTC
I have the same problem, but it triggers in a different way. In my case it starts when an application tries to access the microphone, for example entering in a channel in Discord or starting a call in Telegram Desktop. Otherwise even after hours of works pulseaudio behaves correctly.

I already documented the problem and provided logs in a separate bug https://bugs.freedesktop.org/show_bug.cgi?id=104862
Comment 5 tantrido 2018-05-07 12:29:53 UTC
Bug happen every time after few ours of work playing video from different intensively using sources: multiple opened Firefox tabs with Youtube playing simultaneously, sites with HTML5 or embedded video, playing long sound or video with audacious, vlc or smplayer, etc, etc
Comment 6 Tanu Kaskinen 2018-05-07 14:47:37 UTC
I suspect that it's a kernel driver issue. Might be related to rewinds. If I make a patch that disables all rewinding in the alsa sink, do you know how to apply the patch and build pulseaudio from source?
Comment 7 Domenico Iezzi 2018-05-07 18:19:35 UTC
Sure, I can test your patch.
Comment 8 tantrido 2018-05-07 19:08:52 UTC
(In reply to Tanu Kaskinen from comment #6)
> I suspect that it's a kernel driver issue. Might be related to rewinds. If I
> make a patch that disables all rewinding in the alsa sink, do you know how
> to apply the patch and build pulseaudio from source?

Not sure I'll have time. It happens on NVidia HMDI sound output. Can check if it is reproducible on other PCI sound card.
Comment 9 Tanu Kaskinen 2018-05-16 17:08:57 UTC
Created attachment 139598 [details] [review]
0001-alsa-sink-disable-rewinding.patch

Sorry for the delay!

Here's a patch that disables rewinding for alsa sinks. The maximum latency is also lowered from 2 seconds to 300 milliseconds, because without rewinding things like volume changes take longer time (300 ms is still quite much).

The patch is meant to be applied on top of PulseAudio 11.1, because you're probably using that. It may or may not apply to other versions too.
Comment 10 Domenico Iezzi 2018-05-30 22:31:17 UTC
I tried your patch, together with patch from Bug 104733 to fix compilation with latest glibc.

The problem is still there, the only difference is that now the delay of the crackle/distorted echo is much shorter (probably due to your patch). I'll add another debug log if needed.
Comment 11 Domenico Iezzi 2018-06-08 18:49:53 UTC
Created attachment 140100 [details]
pulseaudio log with using provided patch

I attached the log from pulseaudio running with your patch. The sound was crackling through all the log recording.
Comment 12 Tanu Kaskinen 2018-06-12 13:55:14 UTC
The log doesn't show anything that would explain the crackling. Does it happen if you just play something with a music player and then start "parec > /dev/null"? Can you attach the output of "pactl list sinks" and "pactl list sources"?
Comment 13 Domenico Iezzi 2018-06-12 16:47:52 UTC
The strange thing is that this happens almost exclusively after joining a channel in Discord (or starting a call in Discord). If I use other apps like parec, hangouts or talky.io in chromium everything works ok.

Moreover, If I use discord from the browser (chromium), it works correctly almost always. Only one time I had crackling after joining a channel using discord on chromium.

I think this is not related to Discord standalone app since it happened sometimes also with telegram-desktop, but I don't use this app anymore so the only software that triggers the crackling is discord for now.
Comment 14 Domenico Iezzi 2018-06-21 19:27:55 UTC
After some hours of use and test, the problem seems to have gone with latest pulseaudio v12. If other people can confirm, I think we can close the issue (and the related Bug 104862)
Comment 15 tantrido 2018-06-21 20:24:27 UTC
Yes, I saw there are some fixes for HDMI, sound synchronization, etc. Can tell if the issue is fixed when v12 available in openSUSE. Thanks!
Comment 16 Tanu Kaskinen 2018-06-27 07:31:45 UTC
I actually have no idea what might have fixed this in v12 - I'll leave this bug open until tantrido has tested v12 and reported if it helps or not. The Intel HDMI LPE fixes shouldn't affect NVidia, and the sync improvements don't affect HDMI.
Comment 17 tantrido 2018-07-20 02:15:37 UTC
Seems not reproducible for now with v12. Works fine! Thanks!
Comment 18 GitLab Migration User 2018-07-30 10:26:45 UTC
-- GitLab Migration Automatic Message --

This bug has been migrated to freedesktop.org's GitLab instance and has been closed from further activity.

You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.freedesktop.org/pulseaudio/pulseaudio/issues/425.
Comment 19 tantrido 2018-07-31 20:25:41 UTC
So bug is still here! There is noise and crackle but video/audio  	unsynchronization starts after few hours of work, different multiple video played, etc.
Comment 20 Tanu Kaskinen 2018-08-01 10:30:32 UTC
As we've moved to GitLab, further comments should be submitted here:
https://gitlab.freedesktop.org/pulseaudio/pulseaudio/issues/425
Comment 21 tantrido 2018-10-26 17:22:13 UTC
No answers on Gitlab, posting question here:

>When it will be fixed? Happen every day: crackle, noise and sound delay - very annoying.

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.