I think music is a great way to switch tracks when you feel a compulsion. For me, sometimes it was also a trigger.
I made a list of 25 of my albums (I'm that old

) and how they made me feel. I swore off the ones that made me feel bad for a month (put them in the back of the rack). I wrote paragraphs about the thoughts I had about the ones that made me feel good.
One thing that really worked for me was finding covers of songs that were positive for me. My favorite was Booker T and the MGs covering Beatles tunes. They were funky versions of classics with no words, when I remembered the words in my head I found the effect was even better than listening to the originals.
You might find a set of songs that really help you feel positive and then find karaoke versions of the songs ... create a positive play list!
Check to see if some music has a negative impact. I know that there are certain genres that I used to listen to that I can't stand now because they make me feel so negative.