Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I'm using mpc/mpd on Raspbian (debian). Running MPD it starts:

sudo mpd --no-daemon --stdout --verbose  /etc/mpd.conf
config: loading file /etc/mpd.conf
path: path_set_fs_charset: fs charset is: UTF-8
database: reading DB
disabling the last.fm playlist plugin because account is not configured
daemon: opening pid file
daemon: writing pid file
avahi: Initializing interface
avahi: Client changed to state 101
avahi: Client is CONNECTING
state_file: Loading state file /var/lib/mpd/state
decoder_thread: clearing mixramp tags
decoder_control: mixramp_start = NULL
decoder_control: mixramp_prev_end = NULL
playlist: queue song 1:"http://mp3channels.webradio.rockantenne.de/classic-perlen"
input_curl: icy-metaint=16000
decoder: audio_format=44100:24:2, seekable=false
output: opened plugin=pulse name="Pulse" audio_format=44100:16:2
output: converting from 44100:24:2

But playing stream from playlist fails:

mpc play 1
error: Timeout

Logfile says:

client: [3] opened from 127.0.0.1:55768
client: [3] process command "status"
client: [3] command returned 0
client: [3] process command "play "0""
playlist: play 0:"http://mp3.webradio.rockantenne.de:80"

The URL itself is reachable from the device.

Any clues how to diagnose/ fix the timeout error?

Update:

It hangs on various other occasions, too:

pi@raspberrypi ~ $ sudo mpd --no-daemon --stdout --verbose  /etc/mpd.conf
config: loading file /etc/mpd.conf
path: path_set_fs_charset: fs charset is: UTF-8
database: reading DB
disabling the last.fm playlist plugin because account is not configured
daemon: opening pid file
daemon: writing pid file
avahi: Initializing interface
avahi: Client changed to state 101
avahi: Client is CONNECTING
state_file: Loading state file /var/lib/mpd/state
decoder_thread: clearing mixramp tags
decoder_control: mixramp_start = NULL
decoder_control: mixramp_prev_end = NULL
playlist: queue song 1:"http://mp3channels.webradio.rockantenne.de/classic-perlen"
input_curl: icy-metaint=16000
decoder: audio_format=44100:24:2, seekable=false
icy_metadata: unknown icy-tag: 'StreamUrl'
client: [0] opened from 127.0.0.1:55789
client: [0] process command list
client: command_process_list: process command "status"


ROCK ANTENNE: Heroes Del Silencio - Entre dos tierras
[paused]  #1/5   4:43/0:00 (0%)
volume: 30%   repeat: off   random: off   single: off   consume: off
ERROR: problems opening audio device
share|improve this question

1 Answer 1

up vote 0 down vote accepted

From your log

  • you launch mpd as super user
  • you use pulseaudio
  • mpd doesn't seem to be allowed to connect to pulseaudio

Basically, launching mpd as super user is probably a bad idea. If you are logged in as a user and use it as a simple music player, you should launch mpd as a normal user. In this case, if pulseaudio is not running, it is launched as a normal user process. You can check that using ps aux | grep pulse. Beware that to be able to launch the pulseaudio server, your user should belong to the pulse-access group.

If you are using your raspberry pi as an audio server, reachable from the network, you may however need to have mpd running independently of any user logged in, started automatically at boot time. To control the daemons started at boot time, use sysv-rc-conf. In such a case, mpd should be launched as a daemon, and the user to whom the process will belong is configured in /etc/mpd.conf. Make sure also to uncomment in this file the configuration lines to make the server reachable from your network. Then you have to make sure the mpd user is allowed to launch and access pulseaudio, and therefore also belongs to the pulse-access group. I'm not sure though that mpd will be allowed to launch the server without an X session, this tutorial states that, in which case you may have to consider the following solution.

A problem you might have in this last setup is that if you are logged in as a user and mpd is running as its own user, it could be difficult for two pulseaudio servers to coexist, and the first one may grab access to the audio device, preventing the other one from being able to play a sound. I ended up running pulseaudio as a systemwide daemon for that, since I found no other straight solution, and I would be pleased to have one, since the documentation of pulseaudio states everywhere that it is a bad idea, and I believe they have a good reason for that.

share|improve this answer
    
Thank you for the detailed comment. The things that are confusing/trouling me are: 1) I'm typically running MPD as daemon, running directly is only for debugging. 2) running directly only works as root- otherwise it's files are not accessible (might be a config issue) 3) upon startup, audio output is often working but randomly hangs with the timeout errors when using MPC. 4) I've seen some hints that pulseaudio could be the cause and have reverted to alsa which doesn't seem to have the problem. Your hint of pulse-access is very valuable, I'll verify that! –  andig Apr 6 '13 at 15:07
    
@andig for 1) you can also read /var/log/mpd.log for debug 2) you can have a .mpd.conf in your home folder to provide settings for mpd launched as normal user 3) I believe the « randomly hangs » comes from an other application grabbing the audio device, see this question to find out who 4) about the groups, pulse and audio are also often mentioned on tutorials. –  Vincent Nivoliers Apr 6 '13 at 15:34
    
@Vincenet: ok, I found mpd is using the device: /dev/snd/controlC0: mpd 3792 F.... pulseaudio I've added mpd to the pulse-access group now. It does seem to work for now- no hangs. I'll need to have it go through reboot and some testing though- thought it fixed before.. –  andig Apr 6 '13 at 15:48
    
after playing with this for an hour now without any freezes I'm beginning to feel that the pulse-audio group (which wasn't mentioned in any of the tutorials I've read) did the trick. Thanks! Moving on to make it play with shairport now: raspberrypi.stackexchange.com/questions/6826/… –  andig Apr 6 '13 at 16:27

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.