Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
MPD and Pipewire [SOLVED]
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Multimedia
View previous topic :: View next topic  
Author Message
paulj
Guru
Guru


Joined: 30 Sep 2004
Posts: 525
Location: Wales, UK

PostPosted: Thu Oct 13, 2022 6:44 am    Post subject: MPD and Pipewire [SOLVED] Reply with quote

Good morning!

Following the informative news article in July about pipewire and pulseaudio, I decided to migrate my systems over to pipewire. This proceeded without any problem, but I have one remaining issue which I would like to fix. I use MPD to manage my music collection, and since the migration I am struggling to get it working. First of all, pipewire and wire plumber are at the unstable level:
Code:

media-video/pipewire
     Installed versions:  0.3.59(0/0.4)^t{tbz2}(06:30:36 13/10/22)(X bluetooth dbus doc pipewire-alsa sound-server ssl udev v4l -echo-cancel -extra -flatpak -gstreamer -jack-client -jack-sdk -lv2 -system-service -systemd -test -zeroconf ABI_MIPS="-n32 -n64 -o32" ABI_S390="-32 -64" ABI_X86="64 -32 -x32")

media-video/wireplumber
    Installed versions:  0.4.12(0/0.4)^t{tbz2}(22:09:38 12/10/22)(elogind -system-service -systemd -test LUA_SINGLE_TARGET="lua5-4 -lua5-3")

I made the USE flag changes as instructed in the news item (-daemon / sound-server) along with the emerge instructions.

MPD configuration - I have issues when choosing to use pulse or pipewire. Here is the relevant section of the /etc/mpd.conf file:
Code:
audio_output {
    type            "pipewire"
    name            "Pipewire Sound Server"
}

#audio_output {
#    type            "pulse"
#    name            "My pulse output"
#}

(commented out section showing the alternative pa option tested).

Here is the output of the log file from mpd - pulseaudio first, followed by pipewire:
Code:

Oct 12 20:19 : player: played "4beat6/01_Airmail_Special.mp3"
Oct 12 21:48 : exception: Failed to enable output "My pulse output" (pulse); pa_context_connect() has failed: Connection refused
...
Oct 13 06:17 : player: played "BBC_Music/Wind_Quintets/03-Carl_Nielson-Praeludium-Adagio-Tema_con_variazioni.ogg"
Oct 13 06:37 : exception: Failed to open "Pipewire Sound Server" (pipewire); Failed to connect stream: Host is down

mpd was stopped, the configuration changed from pulse to pipewire and then restarted between these two outputs.

I have tried enabling the pipewire-alsa use flag, but no change to the output. Strangely, I can't find anything on google with this "...Host is down" error message.

So I guess my questions are as follows:
  • Have any of you managed to get mpd working with pipewire?
  • Was it an "out of the box" experience, or did you have to make configuration changes? If so, what did you do?
  • Any pointers as to where I should investigate next to resolve this problem? I have it on two similarly configured gentoo systems (AMD desktop and Intel laptop), so I don't think this is a hardware issue, It seems to be more of a configuration issue.
Many thanks for reading through, and for your comments!


Last edited by paulj on Thu Oct 20, 2022 4:12 pm; edited 1 time in total
Back to top
View user's profile Send private message
CaptainBlood
Advocate
Advocate


Joined: 24 Jan 2010
Posts: 3858

PostPosted: Thu Oct 13, 2022 11:09 am    Post subject: Reply with quote

Code:
## An example of a pipewire output:                                           
audio_output {                                                                 
    type     "pipewire"                                                       
    name     "PipeWire Sound Server"                                           
    enabled  "no"                                                             
}                                                                             
#                                                                             
## An example of a local pulseaudio output:                                   
audio_output {                                                                 
    type     "pulse"                                                           
    name     "Local PulseAudio Server"                                         
    enabled  "yes"                                                             
}           
works fine here with older pipewire/wireplumber versions.
Latest not tested yet, but I don't expect big issues to raise in this respect.

Thks 4 ur attention, interest & support.
_________________
USE="-* ..." in /etc/portage/make.conf here, i.e. a countermeasure to portage implicit braces, belt & diaper paradigm
LT: "I've been doing a passable imitation of the Fontana di Trevi, except my medium is mucus. Sooo much mucus. "
Back to top
View user's profile Send private message
paulj
Guru
Guru


Joined: 30 Sep 2004
Posts: 525
Location: Wales, UK

PostPosted: Thu Oct 13, 2022 1:13 pm    Post subject: Reply with quote

Hi CaptainBlood,

CaptainBlood wrote:
works fine here with older pipewire/wireplumber versions.
Latest not tested yet, but I don't expect big issues to raise in this respect.


Thanks for your comments. Do you remember doing anything with the setup apart from the changes you shared in order to get it working?

Given the lack of people with problems, I feel there is some configuration I have made in the past which is now causing problems!
Back to top
View user's profile Send private message
paulj
Guru
Guru


Joined: 30 Sep 2004
Posts: 525
Location: Wales, UK

PostPosted: Tue Oct 18, 2022 2:18 pm    Post subject: Reply with quote

Okay, so I have this working by running mpd as a local program rather than system wide.

I will continue to see if I can get it working properly as a system wide application.
Back to top
View user's profile Send private message
paulj
Guru
Guru


Joined: 30 Sep 2004
Posts: 525
Location: Wales, UK

PostPosted: Thu Oct 20, 2022 4:11 pm    Post subject: Reply with quote

Ok, so now it seems I have got to the bottom of this:

You can run mpd as a system daemon, provided you use pulse as the audio type:
Code:

audio_output {
    type            "pulse"
    server          "127.0.0.1"
    mixer_control   "Master"
    name            "My pulse output"
}

and enable one of the tcp lines in /etc/pipewire/pipewire-pulse.conf:
Code:
pulse.properties = {
    # the addresses this server listens on
    server.address = [
       "unix:native"
        #"unix:/tmp/something"              # absolute paths may be used
        "tcp:4713"                          # IPv4 and IPv6 on all addresses
        #"tcp:[::]:9999"                    # IPv6 on all addresses
        #"tcp:127.0.0.1:8888"               # IPv4 on a single address
        #
        #{ address = "tcp:4713"             # address
        #  max-clients = 64                 # maximum number of clients
        #  listen-backlog = 32              # backlog in the server listen queue
        #  client.access = "restricted"     # permissions for clients
        #}
    ]
    #pulse.min.req          = 256/48000     # 5ms
    #pulse.default.req      = 960/48000     # 20 milliseconds
    #pulse.min.frag         = 256/48000     # 5ms
    #pulse.default.frag     = 96000/48000   # 2 seconds
    #pulse.default.tlength  = 96000/48000   # 2 seconds
    #pulse.min.quantum      = 256/48000     # 5ms
    #pulse.default.format   = F32
    #pulse.default.position = [ FL FR ]
    # These overrides are only applied when running in a vm.
    vm.overrides = {
        pulse.min.quantum = 1024/48000      # 22ms
    }
}

Details here: https://wiki.gentoo.org/wiki/PipeWire, under "Adding multi user support".

This only works with pulse - currently, the pipewire socket is not writable by group or other, so the option to set the MPD audio_output type to pipewire is only available if you use MPD as a user level daemon.

Edit: You need to have one of the tcp options enabled as well as the unix:native, otherwise MPD will work but nothing else will!


Last edited by paulj on Fri Oct 21, 2022 9:58 am; edited 2 times in total
Back to top
View user's profile Send private message
CaptainBlood
Advocate
Advocate


Joined: 24 Jan 2010
Posts: 3858

PostPosted: Thu Oct 20, 2022 8:07 pm    Post subject: Reply with quote

paulj wrote:
Okay, so I have this working by running mpd as a local program rather than system wide.

I will continue to see if I can get it working properly as a system wide application.
Indeed mpd isn't system wide here.
Thks 4 ur attention, interest & support.
_________________
USE="-* ..." in /etc/portage/make.conf here, i.e. a countermeasure to portage implicit braces, belt & diaper paradigm
LT: "I've been doing a passable imitation of the Fontana di Trevi, except my medium is mucus. Sooo much mucus. "
Back to top
View user's profile Send private message
acidrums4
Tux's lil' helper
Tux's lil' helper


Joined: 05 Feb 2009
Posts: 147
Location: Al otro lado del monitor

PostPosted: Thu Nov 17, 2022 2:35 pm    Post subject: Reply with quote

Maybe a bit of an extreme solution, but what let me use pipewire and mpd with its own user (aka system-wide mpd) was to make pipewire work system-wide.
Back to top
View user's profile Send private message
stebe
n00b
n00b


Joined: 14 Jun 2023
Posts: 1

PostPosted: Wed Jun 14, 2023 9:30 am    Post subject: Reply with quote

Posting this here because this answer seems to come up near the top when searching fpr MPD and pipewire. I uncommented the address= section and change restricted to allowed as well, will allow MPD to connect.

Code:

    server.address = [
        "unix:native"
        #"unix:/tmp/something"              # absolute paths may be used
        "tcp:4713"                          # IPv4 and IPv6 on all addresses
        #"tcp:[::]:9999"                    # IPv6 on all addresses
        #"tcp:127.0.0.1:8888"               # IPv4 on a single address
        #
        { address = "tcp:4713"              # address
          max-clients = 64                  # maximum number of clients
          listen-backlog = 32               # backlog in the server listen queue
          client.access = "allowed"         # permissions for clients (was restricted)
        }
Back to top
View user's profile Send private message
paulj
Guru
Guru


Joined: 30 Sep 2004
Posts: 525
Location: Wales, UK

PostPosted: Fri Oct 20, 2023 10:23 am    Post subject: Reply with quote

stebe wrote:
Posting this here because this answer seems to come up near the top when searching fpr MPD and pipewire. I uncommented the address= section and change restricted to allowed as well, will allow MPD to connect.

Code:

    server.address = [
        "unix:native"
        #"unix:/tmp/something"              # absolute paths may be used
        "tcp:4713"                          # IPv4 and IPv6 on all addresses
        #"tcp:[::]:9999"                    # IPv6 on all addresses
        #"tcp:127.0.0.1:8888"               # IPv4 on a single address
        #
        { address = "tcp:4713"              # address
          max-clients = 64                  # maximum number of clients
          listen-backlog = 32               # backlog in the server listen queue
          client.access = "allowed"         # permissions for clients (was restricted)
        }


Hi Stebe!

Thanks for sharing this. Could you please also share how you configured mpd? Did you use the audio_output type pipewire?

For anyone else looking, the above code can be found in /etc/pipewire/pipewire-pulse.conf
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Multimedia All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum