spotify-player icon indicating copy to clipboard operation
spotify-player copied to clipboard

Audio playback does not route to output correctly on Windows (Windows Terminal)

Open selvmaya opened this issue 11 months ago • 5 comments

Describe the bug The audio output of spotify-player does not respect the audio routing chosen in Windows 10 (& 11?) per-app audio settings. It seems to always use the default output no matter what.

To Reproduce Open Windows terminal, run spotify-player. Either select the per-app setting in Windows "App volume and device preferences" (Win10) before or during/between playback (refreshing does not help).

Expected behaviour The audio routes to the correct audio output (see C in reference image) instead of default output (see A in reference image). This works for (nearly) every single windows application. Exceptions to this usually only have problems routing while the application is running, but usually still works if you select the app route before it starts. Specific apps fix it if you refresh the setting during runtime.

Log and backtrace spotify-player-25-01-30-16-33.log GitHub did not let me upload a (0KB) backtrace file (also seems irrelevant).

Screenshots Reference image: Image This image shows spotify_player in a Windows Terminal window, the Windows 10 "App volume and device preferences" settings window, as well as live audio software Voicemeeter. Note: Firefox is not playing any audio here, only spotify-player is. The fact that apps with individual sliders often show up in the default output or not at all in Voicemeeter is a common unrelated issue.

Environment

  • OS: Windows 10 Home 22H2
  • Application version: 0.20.4
  • Application features: default features + image + fzf
  • Extra build notes: Built using cargo-install with --config "lto=true"

Additional context This could be a Windows Terminal bug or a audio backend (default: rodio) feature that is simply unimplemented. My surface-level look over the existing open/closed issues did not find an issue with this target problem. If there is a workaround (e.g. alternative backend) or a problem inherent to Windows Terminal, I would like to know (and this could be documented as a limitation).

selvmaya avatar Jan 30 '25 16:01 selvmaya

I am not at all an expert in audio backends or how terminals handle audio, so I hope you'll bear with me if this is a dumb/naive report.

selvmaya avatar Jan 30 '25 16:01 selvmaya

It seems to always use the default output no matter what.

I think this is expected. Sound is handled by https://github.com/RustAudio/rodio if you use the default audio backend. IIUC, the default behaviour is playing sound from whatever the default device the system is using and I don't know if there is a way to configure this. Maybe you can poke around with different audio backends as listed in https://github.com/aome510/spotify-player?tab=readme-ov-file#audio-backend

aome510 avatar Feb 04 '25 02:02 aome510

If I do play around with backends then I'll report back if I have any interesting results.

selvmaya avatar Feb 04 '25 05:02 selvmaya

Would be amazing if it supported bit-perfect playback on Windows using WASAPI exclusive mode. This might attract a whole new class of users, as many audio enthusiasts have wanted Spotify to add this for years: https://community.spotify.com/t5/Live-Ideas/Desktop-Support-WASAPI-Output/idi-p/1138616

If you add this feature and post on hydrogenaudio.org and head-fi.org, you'll attract many new users. It's been a highly requested feature for a long time.

In its current state, it's unusable for me, as I route desktop audio (default) and music through different virtual devices on my system.

User-3090 avatar May 14 '25 09:05 User-3090

Seems PortAudio Backend actually supports WASAPI exclusive mode, but it needs to be enabled with paWinWasapiExclusive. Would it be possible add support for this configuration?

User-3090 avatar May 16 '25 20:05 User-3090