Adblock for the radio broadcast
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
analyzer
scripts
standalone
.gitattributes
.gitignore
README.md
pom.xml

README.md

RadioBlock

AdBlock for the polish public radio Trójka. Uses cross correlation to find ad jingles and mutes the whole ads block. More info can be found in a blog post: part 1, part 2.

Usage

Case 1 - detecting ads

The analyzer modules is a CLI application reading the stream from the standard input and trying to find the configured samples. For instance, the command below uses ffmpeg to generate the raw stream of Polish "Trójka" and looks for the commercial start and stop jingles, with thresholds 500 and 700, respectively. The "2" describes the channel count:

cd analyzer
ffmpeg -loglevel -8 \
       -i http://stream3.polskieradio.pl:8904/\;stream \
       -f s16le -acodec pcm_s16le - \
  | java -jar target/analyzer-*-jar-with-dependencies.jar \
    2 \
    src/test/resources/commercial-start-44.1k.raw 500 \
    src/test/resources/commercial-end-44.1k.raw 700

Another example - reading the audio stream from the RTL-SDR device:

rtl_fm -M wbfm -f 89.50M -g 0 \
 | java -jar analyzer-*-jar-with-dependencies.jar 1 \
   commercial-start-32k-mono.raw 180 \
   commercial-end-32k-mono.raw 190 \

Case 2 - GUI

A standalone "Trójka" player with GUI:

java -jar standalone/target/standalone-*.jar

Case 3 - write the muted stream to stdout

A command line "Trójka" player, passing the stream to stdout. Output format is PCM, 48000, stereo, low-endian. Example:

java -jar standalone/target/standalone-*.jar --cli 500 700 \
  | play -t raw -b 16 -c 2 -r 48000 -e signed-integer -