MPD & RPi: gaps in music playback

Linux howto's, compile information, information on whatever we learned on working with linux, MACOs and - of course - Products of the big evil....

MPD & RPi: gaps in music playback

Postby peter_b » Sun Nov 25, 2018 7:03 pm

[PROBLEM]
On a home music player (Raspberry Pi v1, "Music Player Daemon" (MPD)) the playback sometimes stops in the middle of a song/stream/whatever MPD is playing.
These gaps might be from one second up to almost 10 seconds.
Happens arbitrarily, but seems like some buffer ain't happy.

Setup background information:
The music files are stored on a fileserver in the LAN (Debian), served over SMB/CIFS (Samba) to the RPi.
Due to workaround-reasons, the RPi is using a Ethernet-over-Power-Outlet adapter to connect to the server, which also ain't the best setup for having reliable network/streaming conditions.

[SOLUTION]
I've increased the following 2 buffer options in /etc/mpd.conf:

  • audio_buffer_size: 8192 (default: 2048)
  • buffer_before_play: "100%"

It worked! :D
No more playback gaps since then. Even works when playing online streams (online radio) URIs.

Optional information:
I've also tried increasing the ALSA setting "buffer_time" time to a higher value, but ended up reverting to its default, because it had no effect (in my case).

In case you want to adjust ALSA buffer settings, you must do it inside the "audio_output" block for alsa.

For example:
Code: Select all
audio_output {
    type        "alsa"
    name        "ALSA (bcm2835)"
    device      "hw:0,0"
    #auto_resample   "no"
    #auto_format     "no"
    #enabled     "yes"
    buffer_time     "900000"
}


With these values, the playback gaps are greatly reduced, but not fully gone yet. I suspect an unreliable network, but still have hopes to find and tune some buffer to handle even that :)

References:
https://linux.die.net/man/5/mpd.conf
  • 0

User avatar
peter_b
Chatterbox
 
Posts: 302
Joined: Tue Nov 12, 2013 2:05 am
Reputation: 3

Return to Knowledge Base

Who is online

Users browsing this forum: No registered users and 2 guests

Who is online over last 24 hours

Users browsed this forum in the last 24 hours: Google [Bot] and 24 guests

cron
Reputation System ©'