适用于 Mac 上音频设备的自动 Apple Music 无损采样率切换

带有应用图标的标题图像

安装

只需转到此存储库的“发布”页面。(链接到最新版本)

或者,尝试测试版!(链接)

将应用程序拖到“应用程序”文件夹。如果您希望在登录时运行它,您应该能够在系统偏好设置中添加无损切换器:

> User & Groups > Login Items > Add LosslessSwitcher app

应用详细信息

当涉及到应用程序的 UI 时,没有太多事情发生,因为大多数逻辑是:

  1. 阅读 Apple Music 的日志以了解歌曲的采样率。
  2. 将采样率设置为当前正在播放的设备。

As such, the app lives on your menu bar. The screenshot above shows it’s only UI component that it offers, which is to show the sample rate that it has parsed from Apple Music’s logs.

app screenshot, with music note icon shown as UI button

If you wish, the sample rate can also be directly visible as the menu bar item.

app screenshot with sample rate shown as UI button

Do also note that:

  • There may be short interuptions to your audio playback, during the time where the app attempts to switch the sample rates.
  • Prolonged use on MacBooks may accelerate battery usages, due to the frequent querying of the latest sample rate.

Why make this?

Ever since Apple Music Lossless launched along with macOS 11.4, the app would never switch the sample rates according to the song that was playing. A trip down to the Audio MIDI Setup app was required. This still happens today, with macOS 12.3.1, despite iOS’s Music app having such an ability.

I think this improvement might be well appreciated by many, hence this project is here, free and open source.

Prerequisites

Due to how the app works, this app is not, and cannot be sandboxed. It also has the following requirement, due to the use of API:OSLog

  • The user running LosslessSwitcher must be an admin. This is not tested and assumed due to this Apple Developer Forums thread.
  • Apple Music app must have Lossless mode on. (well, of course)

Other than that, it should run on any Mac running macOS 11.4 or later.

Disclaimer

By using LosslessSwitcher, you agree that under no circumstances will the developer or any contributors be held responsible or liable in any way for any claims, damages, losses, expenses, costs or liabilities whatsoever or any other consequences suffered by you or incurred by you directly or indirectly in connection with any form of usages of LosslessSwitcher.

Devices tested

I did not test on any Macs running macOS 11, or any Apple Silicon based Macs (I don’t have one 😢) Use at your own risk.

UPDATE: A reddit user has updated to me that LosslessSwitcher is working on Apple Silicon Macs! Thanks!

CPU Mac Model macOS Version Audio Device
Intel Mac Mini (2018) 12.2 Denon PMA-50
Intel MacBook Pro 13 inch (2018) 12.3.1 Denon PMA-50
Intel MacBook Pro 13 inch, four Thunderbolt 3 ports (2016) 12.3.1 Topping DX7 Pro

You can add to this list by modifying this README and opening a new pull request!

License

LosslessSwitcher is licensed under GPL-3.0.

Love the idea of this?

If you appreciate the development of this application, feel free to spread the word around so more people get to know about LosslessSwitcher. You can also show your support by sponsoring this project!

Dependencies

  • Sweep, by @JohnSundell, a easy to use Swift scanner.String
  • SimplyCoreAudio, by @rnine, a framework that makes so much easier to use.CoreAudio

GitHub

点击跳转