I’ve made some changes on a script I found on the internet these days to “remove” the audio ad when listening to Spotify on Linux (with the official Linux preview). The truth is, this script doesn’t remove the ad, just mute it (and all sound from Alsa on your computer), and unmutes when finished. Just it.
The original script uses PulseAudio to do the magic and let you play another song while the ad is “playing”. But as I hate PulseAudio and don’t want it installed on my system, I came with this “solution”. For me it’s working (Slackware-current 64 bits):
It requires Alsa, libnotify (for notify-send) and, of course, Spotify for Linux version 0.9.10.17.g4129e1c (you can get the latest package for Slackware x86_64 here). Basically, the script starts spotify and waits 15 seconds to check if it is running and get its status via dbus. When it detects an ad, it mutes the Alsa master channel and unmutes when the ad finishes.
I saw that Alsa create a stream for Spotify, but I can’t get this information from command line. If you have some better solution that doesn’t involves PulseAudio, send a patch or comment about it on this post