BackgroundMusic icon indicating copy to clipboard operation
BackgroundMusic copied to clipboard

Fade out & fade in

Open dmnd opened this issue 5 years ago • 3 comments

Instead of an abrupt pause, how about fading out music and then fading back in?

dmnd avatar Jun 03 '20 17:06 dmnd

This has been a high priority (at least for me) for a while now. I think it would help a lot, especially with sounds that are just long enough to make Background Music pause the music.

We could implement this either

  1. by having BGMDriver control the music player's volume to fade it in and out, or
  2. by controlling the music player's volume through its API.

The problem with option 1 is the same problem that the app volume sliders have. BGMDriver controls apps' volumes by matching the apps' bundle IDs with the bundle IDs of their CoreAudio clients. Those bundle IDs aren't part of the apps' APIs, so they can change in new versions. Then BGMDriver might not be able to find the right CoreAudio client.

That said, for most music players, it's probably safe enough. And we might even be able to figure out the right CoreAudio client by listening for notifications from the music player's API and looking for a client that starts/stops IO around the same time. I'd say option 1 is the better choice, at least for now.

The problems with option 2 are that some music players might not support controlling their volume through their API and that we would have to write some extra glue code for each music player. It would probably also move the volume slider in the music player, which would be pretty confusing for users.

kyleneideck avatar Jun 04 '20 03:06 kyleneideck

it would help a lot, especially with sounds that are just long enough to make Background Music pause the music

Yes! I was going to write about that too, but decided to keep the original issue simple because fading is nice for UX on its own merit. Two more related thoughts:

  1. What happens when you fade to zero? Do you pause, or keep playing at zero volume? Probably pausing is better, but it adds complexity.
  2. Furthermore, I can imagine situations where instead of zero volume, it'd be nice to fade the volume out to slightly above zero. Ideally you only want to pause when the new source has conflicting music of its own. But that sounds even more complex.

That stuff should probably go into a separate issue, since fading transitions are better than abrupt transitions regardless of the above digressions.

dmnd avatar Jun 04 '20 03:06 dmnd

Hey @kyleneideck,

I've been following this discussion for a while and was wondering if there are any updates on the fade out & fade in feature. Is it something that’s still planned, or maybe there’s a test version available to try?

Would love to hear any news on this. Thanks for all your work on Background Music!

repentandliveholy avatar Feb 12 '25 12:02 repentandliveholy