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.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I use mpd to stream music to my phone (connected to Hi-Fi) via http.

Yet, this only works for songs in my mpd database. I oftentimes want to play stuff in my browser and would like that to be streamed over mpd, too.

Is there a way to route the pulse audio output to mpd instead of the speakers?

share|improve this question
up vote 4 down vote accepted

mpd doesn't accept pulseaudio input sources, so there is no direct way to route pulseaudio through mpd.

However, what you want to accomplish is still possible, with the help of gstreamer and some cleverness. I accomplished this a few years ago.

I wrote this program which implements the "Gstreamer Pipeline Script" component of this diagram:

stream diagram

To sum up the diagram, here is what happens:

  • mpd reads music files off of the disk, decodes them, and "plays" them to a module-null-sink type audio output of pulseaudio.
  • Any other programs you want to run on your computer that output sound -- Adobe Flash, beeps from the gnome shell, the web browser, etc. also send their audio output to the module-null-sink of pulseaudio (it's made the default audio device of the system).
  • The module-null-sink output has a .monitor source, which lets you take the audio that's pushed out to a null sink and "capture" it back in as if it were an input device (like a microphone).
  • Pulseaudio performs software mixing on the fly of all the audio programs on the entire computer, including mpd, web browsers, and everything else using pulseaudio.
  • The tribblify program that I wrote uses GStreamer to capture the pulseaudio null sink monitor audio, which contains mixed audio of both mpd as well as any other programs on the system; perform MP3 encoding; then stream it to a shoutcast / icecast server. tribblify essentially becomes a "streaming source".
  • The tribblify program automatically detects when mpd changes tags of the playing audio and pushes those tags down the shoutcast stream.
  • The icecast or shoutcast server, which can be on the same computer or a different one, streams out the results to all the connected clients.
share|improve this answer
That’s an epic setup. I don’t need to stream my system sounds anymore, but I’m sure this is going to help lots of people. – Profpatsch Jan 14 '14 at 21:07

Your Answer


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.