/

elektronik.hfbk.net

/

Blog

/

Using MPD with Jack

  • en
  • de
  • Using MPD with Jack

    written by David Huss

    2021-03-11

    MPD is a music player deamon that can play music controlled from a various number of clients, some of which are command line front ends, some are in the browser, some have a GUI. The cool thing about MPD is, that it allows you to play music on one Linux machine and control it from a number of other devices (e.g. even via your phone). Perfect for a multiplayer-jukebox.

    0. Getting jack and the pulseaudio bridge ready

    Using mpd with jack can be a bit of a challenge however. If you are using jack the best way currently (until pipewire gets there) is to use Cadence/Catia/Claudia to with the PulseAudio Bridge. You can get the repository containing these three here. After setting up your soundcard make sure you start everything up and enable the PulseAudio Bridge:

    Cadence Window with PulseAudio Bridge started

    With the PulseAudio Bridge started you should see a source and a sink in the Catia window:

    Catia Window with PulseAudio Sink and Source
    The PulseAudio JACK Sink will be where your system loopback sound (Firefox playing youtube, mpd, …) will come from. You can route things into the PulseAudio JACK Source and use it as a microphone (e.g. in BigBlueButton, Signal Desktop, …).

    1. Installing mpd

    This is as simple as using sudo apt install mpd

    2. Configuring MPD to use the PulseAudio Sink

    The key here is to specify the pulse audio sink in the audio_output specified in the mpd config file at /etc/mpd/mpd.conf (apparently pulse audio will happily allow mpd to use a sink that leads into a dead end if you don’t do that).

    2.1 Find the sink value

    With cadence/jack/pulseaudio bridge running execute: pacmd list-sinks

    This will give you a list of availabe pulse audio sinks. Choose the one with jack somewhere in it’s text (in my case the name was “jack_out”).

    2.2 Edit the mpd.conf

    Edit the mpd config file using e.g. sudo vim /etc/mpd/mpd.conf, comment out all currently active audio_output blocks and add the following:

    1
    2
    3
    4
    5
    6
    audio_output {
            type            "pulse"
            name            "PulseAudio Jack Sink"
            server          "127.0.0.1"      
            sink            "jack_out" # find this name with pacm list-sinks
    }
    

    2.3 Restart mpd

    sudo systemctl restart mpd

    3. Test

    Use any mpd client (e.g. mpc play and mpc status). The music should now come out of your regular speakers.