Hacker News new | comments | show | ask | jobs | submit login

I used DSP to recognize the commercials in the radio broadcast on my stereo receiver and turn down the volume automatically ("adblock for the radio broadcast"). I described it here: http://blog.rekawek.eu/2016/02/24/radio-adblock/

> The commercial block starts and finishes with a jingle, so the potential software should recognize these specific sounds and turn off the volume between them.

I suppose that many stations don't have such markers though.

Indeed. I see two options here.

First is to analyze the other signal features of the commercials (eg. increased volume), although it may be tricky.

The other option is a crowd-sourced solution - pretty much as for the browser adblock - where users can mark samples recognized as ads. Since the publishers often buy campaigns for many stations in the same country or state, it may be a shared database.

On the other hand, the described project only scratches my own itch. I wouldn't try to productise an app that takes away the main source of income for the radio stations.

How about a third option, ads are by definition short and repeat a lot.

No fancy ML needed, after a couple of times the filter gets one of these repeating fragments it should be able to block it. Fairness bonus: you get to hear each new ad a couple of times.

The problem you have here is that in order to continue listening to songs more than just a couple of times you'd have to able to classify the song versus an ad. Otherwise once the system heard the song a few times it would start blocking it too.

I expect most ads are <30s, most songs are >2m.

That's not necessarily a bad thing. The decline in commercial music radio has been, in large part, because people quickly grow tired of hearing the same songs over and over again.

Just filter by length.

it's radio. the length is infinite. there are pauses in music. there are pauses in speech. Also, he didn't mention anything about delayed listening. The implication was that it happens in real-time so you don't know how long it will be when you need to start dropping the levels.

Ads repeat several times an hour, songs very seldom repeat within an hour and even then usually only once. It should be possible (although not sure how practical) to just autocorrelate the current audio with audio over the past hour.

It sounds easy, but often isn't.

Maybe radio spots are a little different because they're cheaper and usually more low-quality than TV ads, but it doesn't really work for TV ads - they often have small variations, e.g. 10sec identical, 5sec different, 10sec identical (easy example). Also depending on your method of analyzing the audio it's sometimes broadcast with an unhearable fingerprint that distorts the waveform (let's say like MP3 versus WAV, but worse).

So yes, you can find some patterns - but the commercial breaks are highly mixed up and you wouldn't believe how many distinct commercials per channel are there, even if you think you hear the same ones all the time :)

Easier still... in the US, many radio stations transmit the artist and song title that's currently being played, via a low-bitrate subcarrier encoding. (The proper name is "Radio Data System", IIRC.)

There were previously some FM to MP3 "ripping" tools that would use the RDS information to tag the resulting recordings -- I'm not sure of the status of them. But it could provide a good way to detect commercials, since most radio stations change to a generic station identification message when they break for commercials / banter. (Whether you'd also want to turn down for banter is another question.)

It certainly works for some stations, but not for many other (from personal experience in France), and it would be trivial for radios to change their RDS / metadata system to circumvent ad blocking.

As long as it's only individuals doing this I don't see anybody reacting on a wide scale. Also there's no feedback of listener numbers depending on volume. So there's no way to detect people "adblocking" on radio, so there's no impact on revenue.

> I see two options here.

Yes, or perhaps a combination of techniques. E.g. shared database to train an ML system to detect ads. Of course, the downside is that the ad industry will then tweak the ads until they pass the ML test.

> I wouldn't try to productise an app that takes away the main source of income for the radio stations.

I wouldn't think of it as taking away a source of income, but rather as forcing them to find a source that doesn't bother their customers so much. Ad blockers seem to be getting more accepted.

Do you have an idea how could such a database of copyrighted material be shared? (Asking for a friend...)

I think that it'd be enough to store some kind of fingerprints (eg. selected frequency components after performing the FFT), not the whole samples.

Indeed it seems to be the best option.

Good point. Perhaps use only parts of the material (not the entire clips). This should be covered by "fair use".

And perhaps using the clips for other purposes than "viewing" may in fact be fair use. Especially since you are trying to find a method for not viewing them.


IANAL as well, but this notion of "fair use" seems slippy. I had a look in the French article that lists some exceptions that allow sharing copyrighted material, and did not find any obvious match with the potential shared database.


I was under the impression that for purposes of research, fair use is pretty broad. So perhaps you could explore that angle.

Just apply a transform to them like FFT then it's not the original work anymore and it should be fine.

You know MP3 is kinda like a FFT right?

Yeah, but if you lose enough info such that it doesn't play like the original or can't be reconstituted into the original it's still large enough of a change that it should steer clear from copyright issues. No one's really tested exactly where the distinction falls.



> Of course, the downside is that the ad industry will then tweak the ads until they pass the ML test.

Nothing like a little competition to motivate the improvement of ML systems :)

> analyze the other signal features of the commercials (eg. increased volume), although it may be tricky

My home theater receiver does this (Marantz). It works pretty well. It doesn't cancel out the TV commercials though, it just normalizes the volume so it matches the show. But, I assume you could make it work for muting too.

> I wouldn't try to productise an app that takes away the main source of income for the radio stations.

Do you have similar objections to things like self-driving vehicle technology that will take away the main source of income for truck drivers?

I think you'd want to look for dynamic range compression among other things.

Note this is not foolproof as e.g. pop songs are already heavily compressed.

At least in Germany, they all have. Also you could almost time it, since commercials start ~5mins before the full hour (where the news comes on).

I've often toyed with the same idea of the parent poster

I wonder, if you accepted a little delay, say 20 seconds, could you use Shazam to identify what song is currently playing? I have been amazed at the range of music Shazam can identify, if you could do regularly queries and separately listen out for gaps in music, it seems plausible to be able to identify when a non-song (from Shazam's perspective) is playing.

Great work! I have been working for a while on a similar adblock, but that does not need jingles to detect ads. I'm on my way to open source it. A radio player with adblocking included is available at https://www.adblockradio.com

Would be great to have ability to add custom stations. Would it work too?

I think so. Are you thinking about a station in particular?

Not promising anything, because each station requires time to tune and money for computational resources.

I once made a radio adblocker for streams hosted on http://radioplayer.co.uk/ to be run in a terminal. There is also code to increase/decrease the volume on a Mac. It's not perfect but was a fun little project.

For some reason, the data and audio are out of sync but once calibrated it works quite well.


I would like something like this, but to cut out all non-music (i.e. talking, interviews, etc). Would tensorflow be able to be trained to detect just speech vs music? It would obviously fail if there is speech with background music, but that isn't too common outside of Jamaica (and reggae stations/shows)

This for TV would be great!

Check this:


It seems the tuning of the algorithm is complex though. There's a dedicated forum for it: http://www.kaashoek.com/comskip/viewforum.php?f=2&sid=effa4b...

This Is great. I wanted to do something similar with a TV. Mic detects commercial signature and sends mute command via IR interface. I'm just an idea man though who never followed through.

That is genius.

im getting an error

Sorry, I had some DNS issues. It should be fine now.

Obligatory plug:

I automated handling DNS updates via simple "git pushes" - Lets you revert from bad changes, and gives you a good history of changes over time - https://dns-api.com/

Guidelines | FAQ | Support | API | Security | Lists | Bookmarklet | Legal | Apply to YC | Contact