conditonally aware music player

hello! i live stream viola performance on Twitch and there's always an awkward silence when i'm not playing, where i'm chatting with viewers, loading up sheet music whatever. it would be great if there were a way to program a music player to always be playing music in the background and ducks when it hears music coming from my mic, my chrome tab, or actual files. any ideas?