Skip to main content

Listening to loseless Apple Music on Linux through the Waydroid container

Categories   Linux Linux Tips
Tags   Waydroid
Table of Contents


If you have high-end headphones and insist on listening to lossless streaming music on Linux, you could use a tricky way to listen to loseless Apple Music on Linux! Runnning the Android version of Apple Music through Waydroid container on Linux.

1. Literature review

Apple Music is a subscription-based music streaming service launched by Apple. In addition to the basic AAC 256kbps, it also provides lossless sound quality streaming.

There are two so-called “lossless sound quality”:

  1. Loseless, 24bit/48kHz
  2. High-res loseless, 24bit/192kHz

The Apple Music app supports both iOS and Android. For listening to Apple Music on your computer, iTunes or Apple Music preivew is required. And iTunes only supports Windows and macOS.

What about Linux? Running iTunes thorough Wine? Latest version of iTunes is quite unstable on Linux. It does not work at all.

Use KVM Windows virtual machine to run iTunes? No no no It costs too much just to listen to music!

Use Apple Music web? Not good. It does not support lossless output.

How about Cider? That is just a “wrapper” for the Apple Music web, and it also does not support lossless output.

The funny thing is, when I was googling how to listen to Apple Music on Linux, I saw some scams. Some software manufacturers tell you to use their software to convert (record? pirate?) the music of Apple Music into mp3 so you can listen to them on Linux! …ah if I download the music then what’s the point of listening to streaming music?

Alas, it’s so painful. Even Linux Hint advertise proprietary software like TunesKit. Ha, didn’t they you know that TunesKit does not even support Linux at all?

So I thought of using the Waydroid container to run the Android version of Apple Music. Voila! Everything works great.

2. Change the sampling rate of PipeWire

OS: Arch Linux 6.5.9, KDE 5.27.9 (Wayland)

PipeWire is a new Linux audio system, backward compatible with the old PulseAudio server. The default sampling rate of PipeWire is 48kHz, and we need to increase its sampling rate to 192kHz, which is the highest sound quality of Apple Music.

It is worth noting that to have a external DAC connected while listen to music with a sampling rate of 48kHz or above.

  1. Execute the command pactl info to confirm that PipeWire is currently used. ...on PipeWire means that PipeWire is currently used.

  2. Copy pipewire.conf to /etc/pipewire and edit it

sudo cp /usr/share/pipewire/pipewire.conf /etc/pipewire
sudo vim /etc/pipewire/pipewire.conf
  1. Modify as follows, fill in default.clock.rate with 192kHz, and fill in default.clock.allowed-rates with all available sampling rates according to your preference.
default.clock.rate = 192000
default.clock.allowed-rates = [ 44100, 48000, 88200, 96000, 176400, 192000, 352800, 384000 ]
  1. Restart the PipeWire service
systemctl restart --user pipewire.service
systemctl restart --user pipewire-pulse.service
  1. Use pactl info to check whether the change has been applied.

3. Install Apple Music

  1. Install Waydroid, currently it’s on Android 11.

  2. Apple Music has an x86 version, which can be downloaded directly from the Play Store.

  3. Log in to your Apple ID and check Lossless sound quality in settings.

  4. Usepw-top command to check on the sampling rate on Linux side. Sadly, although Apple Music can have 192Hz output (ALSA), the audio sampling rate output by Waydroid to the Linux side is only 48Hz (limitation of Android SRC itself). At least this matches the standard of loseless audio (24bit/48kHz).

Other than that, everything works fine, including lyrics.

Consider enabling multi-window mode of Waydroid. In a well-supported Wayland environment, you can freely adjust the layout size of Apple Music app.

4. My attmept to remove Waydroid 48kHz limitation

Audio playback architecture:

Apple Music → (Android) Waydroid → PipeWire → DAC

Now it should be a problem of Waydroid itself.

To unblock the 48kHz limit on Android, use usb-samplerate-unlocker or lineage-audio-mod module, you can use Magisk to flash it.

Or manually modify the Waydroid vendor.img file and put the file modified by lineage-audio-mod into the Android system:

cd Downloads
git clone
sudo systemctl stop waydroid-container

# Adjust vendor.img size
sudo dd if=/dev/zero bs=1MiB of=/var/lib/waydroid/images/vendor.img conv=notrunc oflag=append count=512
sudo e2fsck -yf /var/lib/waydroid/images/vendor.img
sudo resize2fs -f /var/lib/waydroid/images/vendor.img
sudo mkdir vendor

# Mount and move files into it
sudo mount -t ext4 -o loop,rw /var/lib/waydroid/images/vendor.img vendor
sudo cp magisk-lineage-audio-mod/system/vendor/etc/* vendor/system/vendor/etc/
sudo umount vendor
sudo systemctl restart waydroid-container

After restarting Waydroid, install Sample Rate Checker and see that the supported sampling rate is 192kHz

But… pw-top still shows that Waydroid output is only 48kHz.

As a result, if you really want to listen to 192kHz loseless audio, you may still have to run iTunes in a virtual machine.

Related discussions#


How to install Linux desktop on WSL2 on Windows 11
Categories   Linux Virtual Machine and Container
Tags   Windows Subsystem for Linux KDE Plasma GNOME
ReDroid. Playing Android games in containers on Linux PC, with GPU Acclelration
Categories   Linux Virtual Machine and Container
Tags   Android Docker Linux
10+ Windows galgames that you can play on Linux (And native Linux galgames!)
Categories   Linux Gaming on Linux
Tags   Wine

Leave a comment

Choose the comment system you like. Giscus for codes, Disqus for anonymous comments.

Please login to your Github account to leave a comment. You can post codes here for discussion. For images, please upload to Imgur and copy links. Your comments would be visible to everyone on Github Discussions.

This comment system is provided by Disqus, you may see forcing Disqus ADs on this page. Sometimes your comment may need to be reviewed, resulting in delayed display. Thank you for your understanding.