Apple Music Automix Issues With Shairport Sync
Apple Music Automix Problems with Shairport Sync: Stuttering, Clicking, and Skipping
Hey guys, have you ever experienced frustrating audio glitches while streaming Apple Music through Shairport Sync? If so, you're not alone. I've been wrestling with some issues myself, and I'm here to share my experience and the details of the problem. Specifically, I'm encountering stuttering, clicking sounds, and even complete skips when using the Automix feature in Apple Music with Shairport Sync. This happens when I stream from my iPhone to my Raspberry Pi running Shairport Sync, but the audio plays flawlessly on my HomePods or Denon AVR.
I'll dive deep into the specifics of the problem, the system setup, the troubleshooting steps I've taken, and, of course, the relevant log output. I hope that by sharing this information, we can hopefully find a solution or, at the very least, shed some light on what's happening and what might be causing these annoying interruptions. Let's get started!
The Problem: Apple Music Automix and Shairport Sync
Let's cut to the chase, shall we? The central issue revolves around Apple Music's Automix feature on iOS and its interaction with Shairport Sync. Since Apple rolled out Automix (which provides seamless transitions between songs) in iOS, I've been getting these annoying audio issues. Instead of a smooth listening experience, I'm met with clicks, short dropouts, stuttering, or, even worse, skipping over parts of a song. This is quite frustrating, especially when you want to enjoy the seamless transitions that Automix is supposed to provide.
The issue is quite specific. When I stream directly to my HomePods or my Denon AVR, everything works perfectly fine. However, when I try to stream from my iPhone to Shairport Sync (running on my Raspberry Pi 5), the problems start. This suggests that there's a compatibility issue or a bug specifically related to how Shairport Sync handles the Automix stream from Apple Music.
I've also encountered a related issue mentioned in a GitHub issue [https://github.com/mikebrady/shairport-sync/issues/2077], which further suggests that these problems might be interconnected and related to Apple Music updates since iOS 26. More on that later!
Relevant Log Output
Okay, now let's get into the nitty-gritty. I've analyzed the logs from Shairport Sync to see if they can shed some light on what's going on. Here's a snippet of the log output that seems to capture some of the key issues:
8.004522958 "player.c:2656" 2.04 -59.5 59.5 7505 46 3697k 44107.77 44107.58
8.007577662 "player.c:2656" 2.02 -53.8 53.8 7499 46 3756k 44107.50 44107.30
4.266714497 "player.c:2883" Large positive (i.e. late) sync error of 6507 frames (0.147551 seconds), at frame: 430201585.
0.190850630 "audio_alsa.c:1823" alsa: recovering from a previous underrun.
0.040233926 "audio_alsa.c:1823" alsa: recovering from a previous underrun.
0.000243777 "player.c:2908" Large negative (i.e. early) sync error of -7963 frames (-0.180567 seconds), at frame: 430216721.
3.620394017 "player.c:2656" -0.76 691.1 770.4 0 46 3791k 44116.60 44116.41
7.988522569 "player.c:2656" -1.80 5.7 5.7 7328 46 3844k 44116.13 44115.93
8.026787273 "player.c:2656" -1.32 0.0 0.0 7344 46 3778k 44115.66 44115.46
....
8.007109014 "player.c:2656" 2.03 -65.1 65.1 7502 46 556k 44108.38 44108.19
8.007153976 "player.c:2656" 2.02 -48.2 48.2 7503 46 297k 44108.22 44108.03
6.407011274 "player.c:2883" Large positive (i.e. late) sync error of 6876 frames (0.155918 seconds), at frame: 441244778.
0.191042111 "audio_alsa.c:1823" alsa: recovering from a previous underrun.
0.040213741 "audio_alsa.c:1823" alsa: recovering from a previous underrun.
0.000258796 "player.c:2908" Large negative (i.e. early) sync error of -8044 frames (-0.182404 seconds), at frame: 441260266.
1.453024814 "player.c:2656" 0.53 433.4 569.3 0 46 68k 44113.42 44113.23
3.750819054 "audio_alsa.c:1823" alsa: recovering from a previous underrun.
0.000334926 "player.c:2908" Large negative (i.e. early) sync error of -5904 frames (-0.133878 seconds), at frame: 441487978.
4.600630719 "player.c:2656" -3.55 1011.2 1011.2 0 0 0 44096.01 44095.82
8.027506717 "player.c:2656" -1.69 0.0 0.0 7324 46 3146k 44096.03 44095.83
7.996788959 "player.c:2656" -1.12 0.0 0.0 7358 46 2969k 44096.06 44095.85
Based on the logs, we can see some crucial details that might be contributing to the problem. The "player.c:2883" and "player.c:2908" lines show sync errors. These errors indicate that the audio stream is experiencing timing inconsistencies. There are "Large positive" (late) and "Large negative" (early) sync errors. These errors are often associated with dropouts, stuttering, and clicking. In addition, the "audio_alsa.c:1823" lines show that ALSA (the Advanced Linux Sound Architecture, used for audio output) is recovering from underruns. Underruns occur when the audio device doesn't receive data fast enough, resulting in audio interruptions. This seems to corroborate our observations of the stuttering and dropouts.
The player.c:2656 lines provide more insights into the playback performance, including frame rates and other related details. However, the sync errors and underruns seem to be more directly correlated with the observed audio issues.
System Information and Setup
Here's the setup I'm using: This is very important! Let's see how things are connected!
- Hardware: Raspberry Pi 5. This tiny but powerful single-board computer is handling the Shairport Sync streaming.
- Software: I'm running the latest mikebrady/shairport-sync:latest Docker image. Docker containers help to package and run applications consistently across different environments, in this case, the Raspberry Pi.
- DAC: The Digital-to-Analog Converter is a HiFiBerry DAC+DSP. This DAC is designed for high-quality audio playback and is connected to the Raspberry Pi. It adds a layer of complexity since it's responsible for converting the digital audio data to an analog signal.
Configuration Information
Unfortunately, I am unable to provide the configuration details because it doesn't seem to work in the Portainer console. However, my Shairport Sync setup is pretty standard. My guess is that the problem is not related to the configuration. Usually, incorrect configurations can cause problems but this one I am not sure about.
PulseAudio or PipeWire
My system isn't using a sound server. It's a rather straightforward setup with ALSA handling the audio output. This setup is designed to be lightweight and efficient, but it can sometimes be sensitive to timing issues and variations in the audio stream.
Shairport Sync Installation
I installed Shairport Sync through Docker. Docker makes deployment easier, but it also introduces another layer of complexity, as the Docker image needs to be correctly configured to communicate with the hardware.
Previous Issues
I've confirmed that the problem persists and have checked previous similar issues in Shairport Sync's issue tracker and other forums. Unfortunately, I haven't found a direct solution yet, but I'm continuing to look for one.
Troubleshooting Steps and Thoughts
Here are a few troubleshooting steps and things I've considered, to try and solve this issue, and my thinking behind them:
-
Check Network Stability: One of the first things I did was to make sure my network was stable. I've checked for any network congestion or dropouts on my Wi-Fi network, because a bad network can introduce interruptions to the audio stream. However, my network seems to be working fine, so I'm starting to doubt that's the root cause.
-
Update Everything: Then, I tried updating everything! This involved updating the Docker image for Shairport Sync to the latest version, updating the Raspberry Pi's operating system, and making sure that all the dependencies were up-to-date. Sometimes, updates can resolve compatibility issues or fix bugs.
-
Investigate Shairport Sync Settings: I've looked into the Shairport Sync settings, trying to find the right parameters for the best audio quality. I tried different buffer sizes and latency settings to find the sweet spot. Still, no luck!
-
Hardware Considerations: The Raspberry Pi, and the HiFiBerry DAC+DSP are crucial, but I haven't been able to find the source of the problem from those pieces of hardware. I have confirmed that they are both working correctly, based on other successful streaming experiments.
-
Apple Music Automix: This function seems to be the main trigger. Since the problem began after I started using Automix, I'm increasingly convinced that the Automix functionality of Apple Music is a key factor. It's possible that the way Automix generates or transmits the audio stream is not entirely compatible with Shairport Sync.
Next Steps and Potential Solutions
Alright, where do we go from here? Here are the steps I'm considering:
- Experimenting with different Shairport Sync versions: The issue may be tied to the specific version of Shairport Sync I'm using, so I'll experiment with some older and beta versions to see if that solves the issue.
- Investigating ALSA configuration: Although my setup is relatively simple, I'll dig deeper into ALSA configuration to verify everything is set up optimally. It is possible that some ALSA settings are not aligned with Shairport Sync, leading to inconsistencies.
- Submitting an Issue: If I can't resolve the issue, I'll submit a detailed bug report to the Shairport Sync development team. Hopefully, they can identify the problem and create a fix.
Conclusion
This whole problem with Apple Music, Automix, and Shairport Sync has been a real headache, right? If you're reading this, you've probably experienced this too. It's a bummer to have a perfect setup ruined by these audio glitches. I hope the details I've shared are helpful and that together, we can find a solution. Stay tuned! I will update this post with any developments!