Bad mpd audio playback with fifo enabled

4

1

I am using Music Player Daemon (mpd) with ncmpcpp on OS X. ncmpcpp has a feature, the music visualizer, that draws a realtime wave/spectrum of the music you are currently playing.

In order to use this you have to enable the fifo output in mpd.

Well, it works but while this is on the audio is terrible: It crackles and sometimes even freezes. It’s like if mpd is skipping some frame.

The mpd settings for the fifo are:

audio_output {
  type   "fifo"
  name   "FIFO"
  path   "/tmp/mpd.fifo"
  format "44100:16:2"
}

And ncmpcpp has set:

visualizer_in_stereo = "yes"
visualizer_fifo_path = "/tmp/mpd.fifo"
visualizer_output_name = "fifo"
visualizer_sync_interval = "0"
visualizer_look = "||"
visualizer_color = "blue"
visualizer_type = "spectrum"

Is there some wrong setting to change or I have found a bug?

Rnhmjoj

Posted 2015-02-04T18:36:17.840

Reputation: 848

1I can confirm this, audio begins stuttering if I enable FIFO output. ncmpcpp is not the cause of the problem, it also happens with mpdviz. – shrx – 2015-02-18T15:20:24.593

@shrx Are you also on OS X? – Rnhmjoj – 2015-02-18T16:07:25.900

Yes, OS X 10.10.2, mpd 0.19.9 installed with homebrew. – shrx – 2015-02-18T16:21:39.533

1

I filed a bug report.

– Rnhmjoj – 2015-02-19T14:41:40.683

Answers

2

I filed a bug report on the mpd bug tracker. The issue is related to the OS X audio output plugin which is unmaintained. So the only way to keep both regular audio output and FIFO is to stream to another player.

You can output through http or another fifo and stream the audio to vlc for instance. In the case of http add to your config:

audio_output {
  type "httpd"
  name "http stream"
  encoder "vorbis"
  port "8000"
  quality "2"
  format "44100:16:2"
}

then set this alias: alias cvlc='/Applications/VLC.app/Contents/MacOS/VLC --intf=rc'

and run cvlc http://localhost:8000

In case you want to use two FIFOs just duplicate the current settings and start vlc with:

cvlc --demux=rawaud --rawaud-channels 2 --rawaud-samplerate 44100 /tmp/mpd-vlc.fifo

The downsides I have noticed are that you won't be able to change output volume with mpd anymore and there is a relatively small lag.

Rnhmjoj

Posted 2015-02-04T18:36:17.840

Reputation: 848

I have the same problem but for some reason http streaming does not solve the problem -- music still interrupting - no matter if it's streaming through the http or just using CoreAudio and FIFO... The only way it works for me is having Visualizer open. If I change the tab with Tab key for example it starts interrupting until I press 8 to show the Visualizer back or until I disable FIFO visualizer leaving only CoreAudio (or http stream)… Weird… – Drew – 2015-10-28T19:37:30.253

@Andrew I had the exact same problem: if you close the visualizer the audio starts freezing. For me using the http output solved it. However I switched completely to linux so I can't work on this anymore. – Rnhmjoj – 2015-10-30T21:06:53.150

1

I notice you have visualizer_sync_interval = "0" in your config, which is almost certainly the problem. First try setting it to "30", as is recommended in the ncmpcpp docs--if that doesn't work, try out several different values for that parameter.

gajogacchati

Posted 2015-02-04T18:36:17.840

Reputation: 11

2I think the problem is with mpd, the problem persists even when ncmpcpp is not running. – Rnhmjoj – 2015-02-11T16:57:18.293