Posted: . At: 10:29 AM. This was 1 year ago. Post ID: 17695
Page permalink. WordPress uses cookies, or tiny pieces of information stored on your computer, to verify who you are. There are cookies for logged in users and for commenters.
These cookies expire two weeks after they are set.


A tip to fix the delayed audio playback when using Pulseaudio.


Pulseaudio on Linux can be very buggy, the audio is sometimes delayed by a second or so when you begin playback. This can be fixed though. I found a method that seems to work. Just block the loading of a certain Pulseaudio module and this seems to fix the issue of the sound being shut down on idle and taking a second or so to load again.

Edit the /etc/pulse/default.pa file and edit this line to fix the problem.

/etc/pulse/default.pa
114
115
### Automatically suspend sinks/sources that become idle for too long
#load-module module-suspend-on-idle

Just comment out the load-module line and then restart Pulseaudio using the pulseaudio -k command.

Find the appropriate file this way.

┌──[jason@11000000.10101000.00000001.00000010][~/Documents/bdoom]
└──╼  ╼ $ grep module-suspend-on-idle /etc/pulse/*
grep: /etc/pulse/client.conf.d: Is a directory
/etc/pulse/default.pa:load-module module-suspend-on-idle
grep: /etc/pulse/default.pa.d: Is a directory
/etc/pulse/system.pa:load-module module-suspend-on-idle

I am using HDMI sound with Pulseaudio and the songs I play with Audacious now start instantly. This seems to be a very effective fix. Seems to be power-saving gone mad. At least it can be alleviated with a simple config edit.

This edit to the /etc/pulse/daemon.conf should also help. I enabled real-time scheduling, this should further help with the performance of Pulseaudio.

/etc/pulse/daemon.conf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
┌──[jason@11000000.10101000.00000001.00000010][/etc/pulse]
└──╼  ╼ $ cat daemon.conf 
# This file is part of PulseAudio.
#
# PulseAudio is free software; you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# PulseAudio is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with PulseAudio; if not, see <http://www.gnu.org/licenses/>.
 
## Configuration file for the PulseAudio daemon. See pulse-daemon.conf(5) for
## more information. Default values are commented out.  Use either ; or # for
## commenting.
 
; daemonize = no
; fail = yes
; allow-module-loading = yes
; allow-exit = yes
; use-pid-file = yes
; system-instance = no
; local-server-type = user
; enable-shm = yes
; enable-memfd = yes
; shm-size-bytes = 0 # setting this 0 will use the system-default, usually 64 MiB
; lock-memory = no
; cpu-limit = no
 
high-priority = yes
nice-level = -11
 
realtime-scheduling = yes
realtime-priority = 5
 
exit-idle-time = 0
scache-idle-time = 0
 
; dl-search-path = (depends on architecture)
 
; load-default-script-file = yes
; default-script-file = /etc/pulse/default.pa
 
; log-target = auto
; log-level = notice
; log-meta = no
; log-time = no
; log-backtrace = 0
 
; resample-method = speex-float-1
; avoid-resampling = false
; enable-remixing = yes
; remixing-use-all-sink-channels = yes
; remixing-produce-lfe = no
; remixing-consume-lfe = no
; lfe-crossover-freq = 0
 
; flat-volumes = no
 
; rescue-streams = yes
 
; rlimit-fsize = -1
; rlimit-data = -1
; rlimit-stack = -1
; rlimit-core = -1
; rlimit-as = -1
; rlimit-rss = -1
; rlimit-nproc = -1
; rlimit-nofile = 256
; rlimit-memlock = -1
; rlimit-locks = -1
; rlimit-sigpending = -1
; rlimit-msgqueue = -1
; rlimit-nice = 31
; rlimit-rtprio = 9
; rlimit-rttime = 200000
 
default-sample-format = s16le
default-sample-rate = 48000
alternate-sample-rate = 48000
default-sample-channels = 2
default-channel-map = front-left,front-right
 
; default-fragments = 4
; default-fragment-size-msec = 25
 
; enable-deferred-volume = yes
deferred-volume-safety-margin-usec = 1
; deferred-volume-extra-delay-usec = 0

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.