Skip to content

cransono/radioblock

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

65 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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 https://stream3.polskieradio.pl:8904/\;stream \
       -f s16le -acodec pcm_s16le - \
  | java -jar target/analyzer-1.0.0-SNAPSHOT-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-1.0.0-SNAPSHOT-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-1.0.0-SNAPSHOT.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-1.0.0-SNAPSHOT.jar --cli 500 700 \
  | play -t raw -b 16 -c 2 -r 48000 -e signed-integer -

Packages

No packages published

Languages

  • Java 95.3%
  • Shell 4.7%