You are not logged in.

#26 2020-06-10 01:09:59

mjd119
Member
Registered: 2020-05-07
Posts: 118

Re: Pulseaudio Crackling/Popping When Playing Audio

I read online (like here: https://news.ycombinator.com/item?id=23223658) that the C-states setting for power saving could be responsible. Although in that case, it's not a Linux or Arch Linux issue. The Ryzen article on the Arch Wiki doesn't mention anything about it. I can't find anything on the Arch forums about it but I thought I'd mention it. I may give it a try at some point by changing the settings in the BIOS.

Last edited by mjd119 (2020-06-10 01:10:23)

Offline

#27 2020-06-22 01:48:12

mjd119
Member
Registered: 2020-05-07
Posts: 118

Re: Pulseaudio Crackling/Popping When Playing Audio

I have tried many workarounds suggested by the archwiki and still no luck. Just moving the cursor back and forth between a termite instance to qpdfview is enough to produce consistent crackling, even when my cpu load is under 10%. I changed the default number of fragments and fragment size, turned timer-based scheduling off, tried a different kernel, set the governor profile with cpupower to performance, commented out

load-module module-suspend-on-idle

in /etc/pulse/system.pa to prevent suspension of sinks, and even created the "/etc/modprobe.d/sound.conf" file with the line

options snd-hda-intel vid=8086 pid=8ca0 snoop=0

since I noticed that the alsa.driver_name for my device is "snd_hda_intel" which I found when running "pactl list | grep intel.". I tried these potential solutions by themselves and in combination with each other. I haven't tried changing the default sample rate, but this happens when I am playing standard 16 bit 44100 Hz music anyway. Can anyone point me to other posts here or make other suggestions? I searched pulse and pulseaudio on the forums here and I couldn't find anyone with a similar problem and a solution I haven't tried already. Not sure if I should make a new thread or just continue with this somewhat old one.

Last edited by mjd119 (2020-06-22 02:06:51)

Offline

#28 2020-06-22 07:27:17

V1del
Forum Moderator
Registered: 2012-10-16
Posts: 21,731

Re: Pulseaudio Crackling/Popping When Playing Audio

Try 48000 for the heck of it, a few cards do actually have issues with certain sample rates despite claiming they support it. Did you test disabling c states now? Did you check whether a more recent UEFI firmware update is available? Something else you can try on the audio hardware level (remove the options line first, vid pid are irrelevant (and incorrectly defined, your vid is 1022 and pid 1487 ) and don't do anything on snd_hda_intel and disabling snoop leaves you with no mic but that is a good test, give enable_msi=1 a shot too) Other things you could try here is using hdajackretask and disabling unused jacks or so. Have you tried different speakers or maybe headphones or so? Did you try different music formats from FLAC?

What's your

sudo journalctl -k | grep snd

?

Last edited by V1del (2020-06-22 07:50:37)

Offline

#29 2020-06-22 15:25:34

mjd119
Member
Registered: 2020-05-07
Posts: 118

Re: Pulseaudio Crackling/Popping When Playing Audio

V1del wrote:

Try 48000 for the heck of it, a few cards do actually have issues with certain sample rates despite claiming they support it. Did you test disabling c states now? Did you check whether a more recent UEFI firmware update is available? Something else you can try on the audio hardware level (remove the options line first, vid pid are irrelevant (and incorrectly defined, your vid is 1022 and pid 1487 ) and don't do anything on snd_hda_intel and disabling snoop leaves you with no mic but that is a good test, give enable_msi=1 a shot too) Other things you could try here is using hdajackretask and disabling unused jacks or so. Have you tried different speakers or maybe headphones or so? Did you try different music formats from FLAC?

What's your

sudo journalctl -k | grep snd

?

The sample rate for mpd is set at 44100. Should that be changed? This happens most often with mpd FLAC files. I haven't tried mp3 files or other formats. It sometimes happens when I'm streaming YouTube but it's less frequent. I think I tried disabling the c states although it was hard to tell if I changed the right setting in my bios.

Offline

#30 2020-06-23 17:49:29

mjd119
Member
Registered: 2020-05-07
Posts: 118

Re: Pulseaudio Crackling/Popping When Playing Audio

mjd119 wrote:
V1del wrote:

Try 48000 for the heck of it, a few cards do actually have issues with certain sample rates despite claiming they support it. Did you test disabling c states now? Did you check whether a more recent UEFI firmware update is available? Something else you can try on the audio hardware level (remove the options line first, vid pid are irrelevant (and incorrectly defined, your vid is 1022 and pid 1487 ) and don't do anything on snd_hda_intel and disabling snoop leaves you with no mic but that is a good test, give enable_msi=1 a shot too) Other things you could try here is using hdajackretask and disabling unused jacks or so. Have you tried different speakers or maybe headphones or so? Did you try different music formats from FLAC?

What's your

sudo journalctl -k | grep snd

?

The sample rate for mpd is set at 44100. Should that be changed? This happens most often with mpd FLAC files. I haven't tried mp3 files or other formats. It sometimes happens when I'm streaming YouTube but it's less frequent. I think I tried disabling the c states although it was hard to tell if I changed the right setting in my bios.

I am now testing with the linux-zen kernel with global c-state control in my bios disabled (that's the only relevant setting I could kind in my X570 Gigabyte motherboard BIOS). The pops occur most frequently when I move the cursor between windows, even when cpu usage percentage is in the single digits. The output of  "sudo journalctl -k | grep snd" is:

Jun 23 12:45:23 Arch kernel: snd_hda_intel 0000:09:00.1: Force to non-snoop mode
Jun 23 12:45:23 Arch kernel: snd_hda_intel 0000:0b:00.4: enabling device (0000 -> 0002)
Jun 23 12:45:23 Arch kernel: snd_hda_codec_realtek hdaudioC1D0: autoconfig for ALC887-VD: line_outs=1 (0x14/0x0/0x0/0x0/0x0) type:line
Jun 23 12:45:23 Arch kernel: snd_hda_codec_realtek hdaudioC1D0:    speaker_outs=0 (0x0/0x0/0x0/0x0/0x0)
Jun 23 12:45:23 Arch kernel: snd_hda_codec_realtek hdaudioC1D0:    hp_outs=1 (0x1b/0x0/0x0/0x0/0x0)
Jun 23 12:45:23 Arch kernel: snd_hda_codec_realtek hdaudioC1D0:    mono: mono_out=0x0
Jun 23 12:45:23 Arch kernel: snd_hda_codec_realtek hdaudioC1D0:    inputs:
Jun 23 12:45:23 Arch kernel: snd_hda_codec_realtek hdaudioC1D0:      Front Mic=0x19
Jun 23 12:45:23 Arch kernel: snd_hda_codec_realtek hdaudioC1D0:      Rear Mic=0x18
Jun 23 12:45:23 Arch kernel: snd_hda_codec_realtek hdaudioC1D0:      Line=0x1a
Jun 23 12:45:24 Arch kernel: snd_hda_intel 0000:09:00.1: bound 0000:09:00.0 (ops amdgpu_dm_audio_component_bind_ops [amdgpu])

I am unsure how to make the changes on  "the audio hardware level" you mentioned. Do you suspect this is an issue with Linux, specifically Arch Linux (or at least its default settings), or hardware? I was on vanilla Debian before and I may have experienced this but I'm unsure. I know I never had this issue on Windows 10 which I still have installed on my machine. The next thing I'll try is changing the default sample rate. To do that I just uncomment

; default-sample-rate = 44100

in /etc/pulse/daemon.conf and replace the value with 48000 right? Any changes needed to "default-sample-format?" I have some 24 bit audio files but my headphone amp doesn't support 24 bit audio anyway.

Last edited by mjd119 (2020-06-23 17:50:31)

Offline

#31 2020-06-23 18:09:03

V1del
Forum Moderator
Registered: 2012-10-16
Posts: 21,731

Re: Pulseaudio Crackling/Popping When Playing Audio

Journal looks ok, I am fairly certain this is low level, whether it's the sound card driver for this particular card or the motherboard or the cpu I'm not sure yet. Maybe also try the LTS kernel (though 5.4 is not that old yet, but still) to have a bit of an older reference point in terms of kernels.

You should try other formats (and fwiw other players, it might also be some interaction with mpd...) decoding flacs on the fly is quite a bit more taxing than a mp3 or so.  It's definitely not an inherent Arch config issue (from the lack of feedback aside from myself and from the lack of results you get when searching, I'd assume it's safe to say this generally works for people) FWIW I just tested a random  FLAC and ran a stress --cpu 8 on the side and had zero drop outs, I've not really done much to deviate from the defaults.

For changing the sample-rate that's correct.  FWIW what I'm also realizing we don't know much about your mpd  setup and how you do play back here, can you post the config you are using as well as 

sudo fuser -v /dev/snd/*
pacmd list-sink-inputs

during playback of a problematic file?

Offline

#32 2020-06-23 19:57:07

mjd119
Member
Registered: 2020-05-07
Posts: 118

Re: Pulseaudio Crackling/Popping When Playing Audio

V1del wrote:

Journal looks ok, I am fairly certain this is low level, whether it's the sound card driver for this particular card or the motherboard or the cpu I'm not sure yet. Maybe also try the LTS kernel (though 5.4 is not that old yet, but still) to have a bit of an older reference point in terms of kernels.

You should try other formats (and fwiw other players, it might also be some interaction with mpd...) decoding flacs on the fly is quite a bit more taxing than a mp3 or so.  It's definitely not an inherent Arch config issue (from the lack of feedback aside from myself and from the lack of results you get when searching, I'd assume it's safe to say this generally works for people) FWIW I just tested a random  FLAC and ran a stress --cpu 8 on the side and had zero drop outs, I've not really done much to deviate from the defaults.

For changing the sample-rate that's correct.  FWIW what I'm also realizing we don't know much about your mpd  setup and how you do play back here, can you post the config you are using as well as 

sudo fuser -v /dev/snd/*
pacmd list-sink-inputs

during playback of a problematic file?

The output of "sudo fuser -v /dev/snd/*" is:

                     USER        PID ACCESS COMMAND
/dev/snd/controlC1:  matt       1041 F.... pulseaudio
/dev/snd/pcmC1D0c:   matt       1041 F...m pulseaudio
/dev/snd/pcmC1D0p:   matt       1041 F...m pulseaudio
/dev/snd/seq:        matt      15326 F.... pipewire
/dev/snd/timer:      matt       1041 f.... pulseaudio

and the output of "pacmd list-sink-inputs" is:

1 sink input(s) available.
    index: 67
	driver: <protocol-native.c>
	flags: 
	state: RUNNING
	sink: 0 <alsa_output.1.analog-stereo>
	volume: front-left: 65536 / 100% / 0.00 dB,   front-right: 65536 / 100% / 0.00 dB
	        balance 0.00
	muted: no
	current latency: 235.69 ms
	requested latency: 15.24 ms
	sample spec: s16le 2ch 44100Hz
	channel map: front-left,front-right
	             Stereo
	resample method: (null)
	module: 10
	client: 6 <Music Player Daemon>
	properties:
		media.name = "My Pulse Output"
		application.name = "Music Player Daemon"
		native-protocol.peer = "TCP/IP client from 127.0.0.1:47664"
		native-protocol.version = "33"
		media.role = "music"
		application.icon_name = "mpd"
		application.process.id = "665"
		application.process.user = "mpd"
		application.process.host = "Arch"
		application.process.binary = "mpd"
		application.language = "C"
		application.process.machine_id = "3b9bcfbf61ca4355b588d1700866593c"
		module-stream-restore.id = "sink-input-by-media-role:music"

I get a loud pop (sometimes what sounds like a few in rapid succession) when I switch to a different workspace in i3 or move the cursor between libreofficewriter and qpdfview. Also when scrolling fast through a pdf in qpdfview. It almost sounds like static electricity. I'm playing a flac file. CPU usage stays in the single digits. I think my mpd config is the same as the one posted in this thread. Right now for my settings I disabled timer-based scheduling and my "default-fragments" is set to 3 and "default-fragment-size-msec" is set to 5 (from Arch Wiki). I commented out the line Is the fact I am playing files stored on a standard HDD (WD Red) make a difference? Also, I commented out the line "load-module module-suspend-on-idle" in /etc/pulse/default.pa to prevent pulseaudio from suspending sinks.

EDIT:
Is the "system settings" sound possibly causing an interference between mpd sound and system sounds (e.g. beeps from a file manager). Pavucontrol shows a separate mpd audio stream and a separate system sounds stream. I also still hear it with a different set of headphones.
EDIT 2:
I noticed that when I use a different set of headphones (Audio Technica M50) with my Matrix M-Stage headphone amp with a line in connection to my computer case, I can easily recreate the pops even with a moderate amount of cpu load. I connected the headphones directly to my case and am trying to recreate the sound with no results. I have libreoffice writer open, qpdfview open with 5 tabs, a chromium window with 16 tabs, and foldingathome running use my GPU, and 3 termite instances open (one of which is showing the ncmpcpp visualizer for mpd). I'm rapidly switching between workspaces and windows and I don't think I've heard the sound while playing mpd. The ultimate problem might actually be either my headphone amp or the cable I'm using to connect the amp to the computer case. I'll have to run more tests, but it seems odd that either of these things could be the source of the problem, unless the headphone amp and/or cable is introducing extra latency since the motherboard has to transfer audio through the cable, to my amp, and then to my headphones. Since the audio stream doesn't change, it would seem odd that either of things could be the source of the problem if there aren't any interruptions and a new stream is not introduced. The cable I'm using is pretty cheap (I found it laying around my parent's house) since I broke an adapter a couple years ago.
EDIT 3:
Never mind it came back. AGHH! This is getting ridiculous.

Last edited by mjd119 (2020-06-23 21:11:48)

Offline

#33 2020-06-27 16:43:37

mjd119
Member
Registered: 2020-05-07
Posts: 118

Re: Pulseaudio Crackling/Popping When Playing Audio

I've been playing around with the settings in /etc/pulse/daemon.conf according to the descriptions of settings listed here https://wiki.archlinux.org/index.php/PulseAudio and looking at threads about glitch and pop free playback with high quality audio.
Here is the /etc/pulse/daemon.conf file (comments with ";" removed):

resample-method = speex-float-10
flat-volumes = no

 default-sample-format = s24le
 default-sample-rate = 192000

 default-fragments = 3
 default-fragment-size-msec = 5

These settings consume a high amount of CPU power, but it appears to limit the pops significantly. I'm not sure if they aren't there anymore or if the pops I'm hearing are just a part of the music (like with sampled audio in a song). I initially had the default-sample-format set to 32le but the cpu usage was really high and I was sometimes getting interruptions (more subtle than before). The default-sample-rate is really high but I have some audio with that sample rate. I read about the alternate-sample-rate setting on the wiki, but I'm unsure whether mpd can dynamically change the sample rate to match the native sample rate for a particular audio file. If it makes more sense to set the default-sample-rate to something like 96000 and the alternate-sample-rate to something like 192000 someone let me know. I'll continue to test these new settings by having many cpu-intensive programs open at once to see if there are consistent pops or glitches. I don't mind high cpu-usage and/or power consumption. If it makes more sense to move to something like JACK to satisfy my need for the highest quality, lowest latency (realistically) possible, let me know. I read some of the entry for it on the wiki but it's pretty confusing. I only really play high quality audio files with mpd (vlc for video with high bitrate and/or sample rate audio). I know mpd supports JACK, I'm unsure about vlc.

Offline

#34 2020-06-30 22:20:13

mjd119
Member
Registered: 2020-05-07
Posts: 118

Re: Pulseaudio Crackling/Popping When Playing Audio

I changed the settings around and I'm getting some strange results. Even when cpu usage is very low (under 10%) I will inconsistently get loud pops when I click on certain elements in a web browser (like firefox or chromium) or when dragging my cursor between windows. It's not as consistent as it was before, but it still drives me nuts, especially since it's usually a surprise when it happens. I've gone back and forth between timer-based scheduling as well setting the option to "avoid-resampling" to "no" and "yes." I have also switched the sample-rates around (default and alternate) and the resample-method (speex-float-5, speex-float-10, speex-float-1). Overall, I can't really tell which combination is best. Is this an unsolvable problem with my hardware? This only seems to happen if I'm multitasking. If I just play music from mpd and have ncmpcpp open (with or without a visualizer) I don't really get the pops.

My /etc/pulse/daemon.conf at the moment (without comments) is:

 resample-method = speex-float-5
 avoid-resampling = no

flat-volumes = no

 default-sample-format = s32le
 default-sample-rate = 48000
 alternate-sample-rate = 96000

 default-fragments = 3
 default-fragment-size-msec = 5

my /etc/pulse/default.pa (without comments) is:

#!/usr/bin/pulseaudio -nF

.fail

load-module module-device-restore
load-module module-stream-restore
load-module module-card-restore

load-module module-augment-properties

load-module module-switch-on-port-available

.ifexists module-udev-detect.so
load-module module-udev-detect
.else

load-module module-detect
.endif


.ifexists module-jackdbus-detect.so
.nofail
load-module module-jackdbus-detect channels=2
.fail
.endif

.ifexists module-bluetooth-policy.so
load-module module-bluetooth-policy
.endif

.ifexists module-bluetooth-discover.so
load-module module-bluetooth-discover
.endif

load-module module-dbus-protocol
.ifexists module-esound-protocol-unix.so
load-module module-esound-protocol-unix
.endif
load-module module-native-protocol-unix


load-module module-native-protocol-tcp auth-anonymous=true


.ifexists module-gsettings.so
.nofail
load-module module-gsettings
.fail
.endif


load-module module-default-device-restore

load-module module-rescue-streams

load-module module-always-sink

load-module module-intended-roles


.ifexists module-console-kit.so
load-module module-console-kit
.endif
.ifexists module-systemd-login.so
load-module module-systemd-login
.endif


load-module module-position-event-sounds

load-module module-role-cork

load-module module-filter-heuristics
load-module module-filter-apply

and my /etc/pulse/system.pa (without comments) is:

#!/usr/bin/pulseaudio -nF

load-module module-device-restore
load-module module-stream-restore
load-module module-card-restore


.ifexists module-udev-detect.so
load-module module-udev-detect
.else

load-module module-detect
.endif

.ifexists module-esound-protocol-unix.so
load-module module-esound-protocol-unix
.endif
load-module module-native-protocol-unix

load-module module-default-device-restore

load-module module-rescue-streams

load-module module-always-sink


load-module module-position-event-sounds

I think there may have been more pops with the tsched=0 Idisable timer based scheduling) parameter in default.pa but it's hard to tell.

Offline

#35 2020-07-11 00:06:40

mjd119
Member
Registered: 2020-05-07
Posts: 118

Re: Pulseaudio Crackling/Popping When Playing Audio

I have now noticed that the crackling and popping is especially bad when I am scrolling in the dolphin file manager. I turned tsched=0 on and off and there's not much of a difference. When I'm scrolling up and down I am still in the single digits percentage-wise for cpu usage. The crackling is enough to drive me crazy. It sound like when you pour a soda on ice cubes from an ice tray. Would adjusting real-time scheduling and high priority in /etc/pulse/daemon.conf help? Some forums I've look at elsewhere have recommend it but the Arch Wiki doesn't have a section on it for pulseaudio troubleshooting.
EDIT: I should've clarified that this happens consistently regardless of whether I am streaming from chromium (YouTube) or playing mpd. The pops are about equally as consistent and loud.

Last edited by mjd119 (2020-07-11 01:08:21)

Offline

#36 2020-07-13 23:23:29

V1del
Forum Moderator
Registered: 2012-10-16
Posts: 21,731

Re: Pulseaudio Crackling/Popping When Playing Audio

I'm fairly certain that this isn't a pulseaudio issue so no matter what you set here will help. You either need to find a kernel that doesn't have this issue or find a motherboard firmware that doesn't have the issue. FWIW I've asked you a few times but you should ensure that this is actually a pulseaudio issue by disabling it

systemctl --user --mask --now pulseaudio.{service,socket}

and try to reproduce on plain ALSA. I'm almost certain you will be able to.

Offline

#37 2020-07-15 21:00:31

mjd119
Member
Registered: 2020-05-07
Posts: 118

Re: Pulseaudio Crackling/Popping When Playing Audio

V1del wrote:

I'm fairly certain that this isn't a pulseaudio issue so no matter what you set here will help. You either need to find a kernel that doesn't have this issue or find a motherboard firmware that doesn't have the issue. FWIW I've asked you a few times but you should ensure that this is actually a pulseaudio issue by disabling it

systemctl --user --mask --now pulseaudio.{service,socket}

and try to reproduce on plain ALSA. I'm almost certain you will be able to.

When I try to run that I get the error:

systemctl: unrecognized option '--mask'

Is there another way to disable pulseaudio and just use alsa temporarily?

Offline

#38 2020-07-15 21:14:34

mjd119
Member
Registered: 2020-05-07
Posts: 118

Re: Pulseaudio Crackling/Popping When Playing Audio

mjd119 wrote:
V1del wrote:

I'm fairly certain that this isn't a pulseaudio issue so no matter what you set here will help. You either need to find a kernel that doesn't have this issue or find a motherboard firmware that doesn't have the issue. FWIW I've asked you a few times but you should ensure that this is actually a pulseaudio issue by disabling it

systemctl --user --mask --now pulseaudio.{service,socket}

and try to reproduce on plain ALSA. I'm almost certain you will be able to.

When I try to run that I get the error:

systemctl: unrecognized option '--mask'

Is there another way to disable pulseaudio and just use alsa temporarily?

EDIT:
I checked and there is an update for my Gigabyte X570 Gaming X motherboard that was released 5 days ago (7/15/20). I don't know if that will help me, but it won't hurt to update. Right now my changes are reserved to the sample rates and method and disabling sink suspension on idle. I am not using interrupt driven scheduling (tsched=0) because that seemed to be more glitchy in certain instances. I think it is most likely the firmware/hardware. I recently installed Arch on my intel laptop that's far less powerful and even with cpu usage over 50 percent I don't think I've had any significant pops. Then again, I haven't edited the systemwide pulseaudio files since I installed it.

Offline

#39 2020-07-15 23:54:10

V1del
Forum Moderator
Registered: 2012-10-16
Posts: 21,731

Re: Pulseaudio Crackling/Popping When Playing Audio

Ah whoops that should read

systemctl --user mask --now  pulseaudio.{service,socket}

Offline

Board footer

Powered by FluxBB