It sounds like the Apple Music app is making the decision whether to encode the Airplay stream using lossless ALAC compression or lossy AAC compression. Even with AAC though it looks like 256 kbps compression is being used which should in theory be perceptably indistinguishable from lossless. You best bet would be search the Internet for info on what exactly is going on with Apple Music.
The Shairport-sync receiver included with moOde just decodes whatever it's sent. If it happens to be an ALAC encoded stream then the so called "Hammerton" ALAC decoder is used
https://github.com/mikebrady/shairport-s...ter/alac.h. It was written by David Hammerton and is the default ALAC decoder included with shairport-sync. After Aople eventually published its own code for ALAC as Open Source it was offered as a compile-time option for Shairport-sync but since it's simply redundant we don't use in our compile.
Here's some additional links
https://github.com/mikebrady/shairport-sync/issues/1205
https://audiophilestyle.com/ca/bits-and-...lay-r1026/
For your usage scenario where you want to stream 100% lossless from an Internet Music Streaming service to your audio devices over your local WiFi network it looks like the Apple Music solution might not be a good fit.
You could test Amazon Music HD. From what I can tell on my Mac the system-level Airplay transmitter is outputting 16/44.1K but its not explicitly showing what compression codec is used for transmission however it can infer from Shairport log below that it's using ALAC.
Code:
# Startup mode
pi@sig:~ $ cat /var/log/shairport-sync.log | grep Startup
0.000281296 "shairport.c:2248" Startup in AirPlay 2 mode, with features 0x405fca00,0x1c340 on device "dc:a6:32:02:85:04".
# Decoder used
pi@sig:~ $ cat /var/log/shairport-sync.log | grep Decoder
0.000053648 "dbus-service.c:1020" >> ALACDecoder set to "hammerton"
0.000240982 "player.c:169" Hammerton Decoder used on encrypted audio.
# Log segment
0.000029407 "player.c:2235" Play begin
0.000036167 "rtp.c:1409" Connection 1: NQPTP master clock 3ccd3660210a0008.
0.009156166 "player.c:450" Connection 1: synced by first packet, seqno 40307.
0.000240982 "player.c:169" Hammerton Decoder used on encrypted audio.
0.000126778 "player.c:1097" Accepting packet 40307 with timestamp 2567980457. Lead time is 2.008912 seconds.
0.000045166 "player.c:1171" Connection 1: Lead time for first frame 2567980457: 2.008901 seconds.
Some screenshots
In the above example the Amazon HD track is 24/192K FLAC so I think we end up with the following pipeline
# Internet
Amazon HD source track 24/192K FLAC ->
# Local MacOS (WiFi)
Amazon HD app + MacOS transcode 24/192K FLAC to 16/44.1K PCM ->
MacOS Airplay sender encodes 16/44.1 PCM using ALAC and streams to shairport-sync Airplay 2 receiver ->
# Raspberry Pi (WiFi)
Shairport-sync Airplay2 receiver decode ALAC to 16/44.1K PCM for output to audio device