r/programminghelp • u/whayd • Dec 09 '22
Other Program to mute system audio during Spotify ads
Hey everyone. I'm new to programming. I want to write an automation for my MacBook that will mute the volume while Spotify ads play. I can manually mute my audio while ads play, so I see no legal/ethical issue with this. The Spotify GUI changes when an ad begins, so I figured the program could watch for this change and trigger a temporary volume mute until the GUI reverts to music mode. Pic of music mode, pic of ad mode.
2
Dec 09 '22
Then pick a language and start researching how to take a screen shot and/or extract pixel data from the screen. For a Mac I'd suggest C/C++ or Python. Good luck!
1
u/FuzzyTekShow Dec 10 '22
FYI you can do this on Windows with https://www.ericzhang.me/projects/spotify-ad-blocker-ezblocker
I don't know how to get a window title on Mac but I've used C# before on Windows to get the current window title from the process which contains either the artist and song name or just "Advertisement" if its an ad. I presume you can do something similar on Mac. Good luck!
1
u/Lewinator56 Dec 09 '22
Welcome to the world of AI... This isn't as simple as checking pixels etc... Of the UI, because you are assuming it's always in the same place, same size etc... You are going to need to use a bit of machine learning to train a program what the ad UI and music UI looks like. This is not trivial.
Python is your friend here, but before you start, have a long look through some literature about machine learning to understand what you need to do it you will just get lost.