-
-
Notifications
You must be signed in to change notification settings - Fork 581
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Shairport Sync and Pipewire #1970
Comments
Thanks for the post. It could be that Shairport Sync is not properly closing the pipewire backend properly so that it can't reopen. Or something. If you could find a quick and reliable way to cause it to misbehave, it would be a big help! |
Thanks for creating an issue @mikebrady. I wasnt sure what your desired workflow was so i started with a discussion. Im not 100% certain how to reproduce the issue, but all of my devices are logging that message as well as a memory allocation issue:
The devices are still for the most part performing, but there certainly is something happening with pipewire and shairport-sync. I'll take a look and see if i can come up with other ideas. |
Some additional information on another device with shairport that seems to have failed. Requires a restart in order for things to work. When i run
Its running though (as a system level service albeit):
The service
After the restart the audio works, but i get a bunch more "Is Pipewire running?" logs from shairport-sync:
Im sharing different devices here but they're all configured identically with regard to shairport-sync/pipewire/etc. |
Thanks. I’m way from machines just now, so it’ll be a few days before I can experiment. But is it at all possible that the pipewire service has actually disappeared? |
Thanks mike. it shows that its still running and enabled but there are errors:
When i try to restart shairport-sync (which is running as a user service) I get this message even though avahi is there (running as a system service):
Any ideas why that would happen? |
Thanks for the information. I’m afraid I have no real suggestions about the Avahi messages until I get to experiment a bit. |
Unsure if this is at all helpful but here is the raspinfo dump: https://paste.debian.net/hidden/e1a9513a/ Just a reminder (and this is completely my bad btw) that i have included outputs from multiple devices so when you see |
Thanks for that. I kind-of guessed that they were different machines alright, no worries. |
Just beginning to have a look at this. A quick play around with Shairport Sync using the PipeWire backend isn't yielding any particular problems. A few quick questions, please:
|
Hey @mikebrady. Snapclient is configured to output to PulseAudio but i believe pipewire controls pulse as well as alsa.
My automations dont toggle power to shairport-sync as far as i can tell and it should be left running all the time. The session interruption is something that i configured but no, it shouldnt happen all that often. Are you thinking the combination of session interruption and pipewire is a potential culprit? |
Thanks. I'm just trying to get a handle on the environment in which Shairport Sync is running... |
This guide: https://www.reddit.com/r/linux4noobs/comments/18yhs7r/success_story_using_a_raspberry_pi_with_pipewire/ is how i set up the devices. I have roughly 8 pi zero w2s, a pi 3b and a pi 4 and the 3b and 4 have a hifiberry dac while the pi zeros all have cheap usb dacs. The only difference in setup for each is that the config.txt file in pi os references my hifiberrydac-plus vs the pi zeros follow the guide settings. I replaced the settings for plexamp in the guide with snapclient but i dont seem to have issues with that install, just the shairport service. |
I documented my specific steps if that is of any help: Install Raspberry Pi OS Lite
dtparam=audio=off
dtoverlay=hifiberry-dacplus # aplay -L will tell you what your audio device is called. sudo apt update && sudo apt upgrade -y
sudo apt install -y --no-install-recommends build-essential git autoconf automake libtool
libpopt-dev libconfig-dev libasound2-dev avahi-daemon libavahi-client-dev libssl-dev
libsoxr-dev libplist-dev libsodium-dev libavutil-dev libavcodec-dev libavformat-dev uuid-
dev libgcrypt-dev xxd
sudo apt install -y jq libpipewire-0.3-dev libspa-0.2-bluetooth python3-dbus libdaemon-dev
xmltoman pipewire wireplumber pipewire-alsa pipewire-pulse nodejs libmosquitto-dev
Install NQPTP
Install Shairport-Syncgit clone https://github.com/mikebrady/shairport-sync.git
cd shairport-sync
autoreconf -fi
./configure --sysconfdir=/etc --with-pw --with-mqtt-client \
--with-soxr --with-avahi --with-ssl=openssl --with-systemd --with-airplay-2
make
sudo make install
sudo systemctl disable shairport-sync #disable the system level instance.
Configure Auto Login
|
Thanks for all this. One very slight thing is that the sequence of:
is not significant, so long as it stops after a while (on a Pi 5, after about 20 repeats...). It's a byproduct of waiting for the PipeWire client to start working after Shairport Sync initialises it. We are probably just being a bit too impatient. It doesn't move us forward though. |
Thats good to know. Curious if it should be dropped down to an
the-kitchen is a pi 3b . sorry for the huge log. |
Thanks. The log size is no problem. I see from the log above that the Process ID -- the
might work... |
In fact, there are a number of separate processes... It would be nice to see what's going on with them. |
Yeah, the entries with numbers 581 -- 668 are fine; they are separate threads running in Shairport Sync, and that is indicated by the lines showing, e.g. 658 is subsidiary to 581, the main thread. It's the processes that are generating the vm errors that are interesting. Are they disappearing? |
I'd have to check about multiple instances, I just don't know, but I'd be surprised if new instances of shairport sync are created. |
I'm wondering if there's something else running on your systems. A backup or some other utility software? |
I can look what the default pi os lite installs but the only things i've installed are the packages above in the installation guide i provided. |
Thanks -- there's no need to go digging. Just one thing, in your guide you write:
That is, with the |
Whoops. Yeah, that's a mistake. I replaced |
Thanks. If you pass in both MQTT is fine -- the remote control problem is that recent versions of Apple Music do not respond to remote control requests coming from Shairport Sync because the protocols have changed in a way that we haven't figured out. My initial tests aren't showing up any problems with Shairport Sync, so I'll have to build a system based on this and see what happens. |
Out of curiosity, what OS or installation do you typically run your shairport-sync on for raspberry pis? I initially ran picoreplayer for a long time wihtout much issues, but that was using squeezelite for most of my integrations (HASS/MASS). Installing shairport worked but there was issues with the device not switching between squeeze and airplay properly. Then i tried volumio, moode, etc all with the same outcome. I finally ended here with pipewire on pios lite so i can simultaneously play music from two different sources so i dont have to worry about losing any audio source based on what was playing first (snap/squeeze or airplay). My use case might be extremely unique but figure i'd ask. |
Good question! My needs are simply for AirPlay 2, so I only install Shairport Sync -- no other audio apps. I'm always looking for the highest fidelity -- always trying to get the audio signal to the output device with the minimum of modification or alteration. Therefore, Raspberry Pi OS Lite is my go-to choice. I make no changes to I always try to output directly to the output DAC, thus to a device beginning with PulseAudio and PipeWire can also transcode and indeed can delay audio, so I also try to avoid them. The extra complication of having to do a login is something else I'd prefer to avoid too. Having said that, I am very impressed with PipeWire lately -- it seems to be very stable as far as output delays are concerned. I don't really have any need for remote control facilities -- nice if you can get it and use it, but not vital. It's very nice to be able to incorporate the Shairport Sync device in the Apple Home; even though it's not great, it is possible to make use of it with Siri and so on. So, summarising -- I'm a bit of a purist: plain vanilla Raspberry Pi OS Lite, minimally modified, with output directly to hardware ALSA DACs. |
So, I did a setup based on your guide and that of Gwouigwoui you referenced above.
It is very interesting indeed -- thanks for bringing it to notice! I'm going to experiment some more and see what I can find. So far, though, everything seems to be behaving itself. |
Have you noticed anything in your logs like this:
I get this error a lot. It shows up in journalctl quite a bit but not in any of the shairport-sync logs. Whats odd is i dont see that process id when running |
Hi Jake. Haven’t gotten it so far, but still experimenting. |
One thing im going to experiment is swapping out snapcast with squeezelite and see if that is more stable. |
I've been experimenting with your setup and have noticed that you're installing more than is apparently needed. The line in your comment above:
is a bit puzzling. All I needed to add here was:
to get all the PipeWire runtime stuff installed, including
In particular, I don't see any need for This is a screenshot of everything that is running on the Pi 3, including SnapClient, NQPTP and Shairport Sync. ![]() This is the Shairport Sync user service file at
|
Oooooh, very interesting. My main installs were copied from the reddit article and that user wanted plexamp and bluetooth as options so i wonder if all the other stuff is unnecessary for my use case? I'll give it a try. |
Exactly -- TBH I just don't know if it'll make a difference, but if you don't need them, it would be good to be rid of them. At least it'll make it easier to debug. 🤷♂️ |
I'm running this system now for a few hours. Nothing to report, except lots of this:
I think I will disable it. |
So far so good on my installs, as well as squeezelite. Do you think that perhaps the timing error we saw earlier is due to the fact that NQPTP is running as a system level service instead of at the user level or does that not make a difference? |
Yeah, me too. It's been running -- playing a radio station from an app called Broadcast on a macOS -- for about 16 hours continuously and is absolutely fine. I've even played sounds over them with:
many times, and everything is fine. If by timing errors you mean these:
then they mean nothing when they occur at the start of a play -- they are an artefact of the debugger and will be removed in an update.
NQPTP needs access to ports 319 and 320. If it didn't have that, it would terminate. Then Shairport Sync would terminate with an error message in the log. So, if Shairport Sync continues to run, it means that NQPTP is okay. |
Just wondering if things are still okay? It's just fine here... |
Yeah for the most part things are working as expected. One final question for you wrt shairport. Is there an optimal setting that would allow the audio to start immediately? I have noticed that if i send audio to a speaker from HASS or music assistant that sometimes the first part of the audio is clipped. This certainly could be my amp auto starting slower (although i've never had this issue with squeeze), or HASS/MASS misbehaving, but i figure i'd ask if there was a setting in the configs that might make it so that there isnt any latency when sending audio to shairpot speakers. |
That's good!
The |
Ok thanks. Figured i'd check! Thanks again for all the help! I'll close this out as i think things are looking good. Oh, it shows that i dont have permissions to close the issue out so feel free to close it @mikebrady. Thanks again. |
Great stuff, thanks. |
Discussed in #1969
Originally posted by janstadt February 1, 2025
Ive looked through a lot of posts here about how Pipewire and PulseAudio is problematic, but i want to be able to push audio out of one speaker from multiple sources. I use homeassistant to push notifications and airplay to play music. if they both use airplay, the session interruption isnt reliable enough for the setup and i typically get an error where the annoucement doesnt play or is truncated. Enter pipewire. I followed this post and had it working for a while, but now i keep getting this error:
pipewire.service
is running as a --user service as well aswireplumber.service
.I had working at one point, but now it no longer works on one of my devices (pi 3b with a hifiberry dac).
Version (built with pipewire):
4.3.5-AirPlay2-smi10-OpenSSL-Avahi-pw-soxr-metadata-mqtt-sysconfdir:/etc
Config
I use snapclient as my other protocol and that works still so i can get audio from there, but not from airplay. Any help would be greatly appreciated.
The text was updated successfully, but these errors were encountered: