Skip to content

Instantly share code, notes, and snippets.

@timrichardson
Last active February 18, 2024 12:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save timrichardson/a8694b5984a34f703c8f6b7196032a37 to your computer and use it in GitHub Desktop.
Save timrichardson/a8694b5984a34f703c8f6b7196032a37 to your computer and use it in GitHub Desktop.
Amazon Music Linux External DAC high bit rates

Amazon Music streams different tracks at different rates, many above the default bit rate that pipewire ships with. This is how to fix it.

Firstly, I am running the Windows Amazon Music app via Crossover, a user-friendly version of wine. It works, it's stable. Ubuntu 22.04. Getting the app can annoying. Once you have the download file, keep it. The app automatically updates and amazingly this works in Linux too. here are some tips: https://uk.amazonforum.com/s/question/0D56Q0000CMRC0dSQH/amazon-music-desktop-app-deletedmissing

Reduce CPU use: I get much, much lower CPU by turning on the DXVK Advanced Option in the Crossover Bottle setting, which keeps the PC fans almost silent for me. The app has an option to use Hardware Accelarated Rendering. I doubt this works on Linux, and it makes no difference. The app doesn't do much rendering while playing back, perhaps this is more for browsing.

https://imgur.com/a/FqtVS8z

https://imgur.com/phcuYaX

Audio output options: https://imgur.com/a/uUlmHQV

Secondly, I am using the pipewire and wireplumber PPAs I have done this with a number of DACs. Currently I have a Topping E50. I will repeat this setup on my laptop running 23.10, in which case the DAC will be a Topping G5 via USB C.

OK, now onto the pipewire / pulseaudio configuration.

Pipewire can be configured to support multiple rates. For example, according to these instructions. https://gitlab.freedesktop.org/pipewire/pipewire/-/wikis/Guide-Rates

Don't do that. It only works if the device goes idle, and the Amazon app does not idle the stream between tracks. If you provide multiple bit rates, you'll be stuck with the first value.

Instead, simply change the default.clock.rate

So:

  1. create a .config directory in your home directory (it almost certainly exists).This is called

~/.config in the lingo

  1. make a pipedrive directory in there (ie ~/.config/pipewire) and cd into that directory
  2. copy the default configuration file: cp /usr/share/pipewire/pipewire.conf .

We are only modifying one line.

(It is possible to make an "add on" config file that only includes the change of one line, but I won't go into that. If you want to do that, make sure that you follow the naming instructions, don't call your cutdown file pipewire.conf)

Uncomment the line:
default.clock.rate and set it to 192000 (if your DAC supports that rate)

You can make it higher if you wish. Amazon doesn't go higher, but you might have other streams or files that are higher.

That's it. restart pipewire

systemctl --user restart pipewire

Note that if you do this while Amazon Music is player, it will crash and you will have to manually kill processes to clean it up (or if you are using Crossover, quit the Bottle)

Now, you will have todo the usual Linux audio stuff. If your dac is working, it will be an available output device. Amazon Music will let you select the DAC. As far as I can tell, this works the same as letting Amazon Music send to Pulse Audio, and then you use Pulse Audio Volume Control to assign the output to the DAC.

Like a modern Linux user, I am using pipewire underneath. Pipewire pretends to be PulseAudio. That matters if you want to do something more advanced ... pipewire will in most cases be upscaling sampling rates to get 192K since most of the time Amazon plays at lower rates. You might want to request pipewire to spend more CPU on that. The pipewire devs say you won't hear the difference, but what the heck. Now in this case, it matters that pipewire is pretending to be pulseaudio.

In this case, cp /usr/share/pipewire/pipewire-pulse.conf to the same local directory as above. Edit the file, and in stream properties, choose resample.quality = 10 (and remove the comment). Max is 14, default is 4. I don't notice any CPU hit. quit Amazon Music, and then systemctl --user restart pipewire-pulse

Topping E50 connection tips

It has been frustrating getting the E50 to connect properly. Once it connects, it's fine. My current idea is to

a) after booting the PC, disconnect the E50

b) set the input to something other than USB

c) reconnect USB

d) change DAC input to USB

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment