View on GitHub

redsea

A lightweight RDS decoder

Download this project as a .zip file Download this project as a tar.gz file

redsea is a lightweight command-line RDS decoder for Linux/macOS. It works best with the RTL-SDR tool rtl_fm and any program that can handle JSON, such as jq.

See README.md in the repository for further information.

Simple usage with rtl_fm

Receive a station at 104.1 MHz:

rtl_fm -M fm -l 0 -A std -p 0 -s 171k -g 40 -F 9 -f 104.1M | redsea

Output filtering and formatting

redsea outputs line-delimited JSON (see the schema). It can be further processed using any JSON-aware tool, such as jq, and common Unix tools.

# Extract radiotext field
redsea ... | jq .radiotext | grep -v null

# Print changed radiotext only using uniq
redsea ... | jq .radiotext | grep -v null | uniq

# Pretty-formatted TMC messages
redsea ... | grep tmc | jq .tmc

# Composer name (RT+ stations)
redsea ... | jq '.radiotext_plus."item.composer"' | grep -v null | uniq

Input formats

Raw MPX PCM

By default, redsea expects a demodulated FM multiplex signal as raw 16-bit single-channel PCM at 171,000 Hz via stdin. This is the format that rtl_fm outputs. The sample rate can be changed using --samplerate, but 171k will work fastest.

If you have sox installed and your sound card supports recording at high sample rates (e.g. 192 kHz) you can also decode the MPX output of an FM tuner or RDS encoder:

rec -t .s16 -r 171k -c 1 - | redsea

The signal can also be read from a WAV or FLAC file (--file signal.wav).

Hex groups

The hex format (--input-hex) is compatible with RDS Spy. Single group per line, four blocks per group.

6403 0442 5541 484B
6403 0447 1C41 4920
6403 8449 506C 716D
6403 245F 2020 2020
6403 0440 6841 594C
6403 0441 5E41 4520
6403 1440 7111 7C54
6403 E44C 0000 6202
6403 0442 414B 484B

ASCII bits

This format (--input-bits) can be used to decode the serial output from an RDS receiver chip, for instance.

0010010110001011100001111001000010101100010101100100100000000010011111
1100010000000101101011110011100100000010011001001110010111100100001010
1100010101100000100000010000111101011000100010001101001011100010101011
0010000011100011110111100100001010110001010110010010000000010100011010
1010001010010000010111001000101001101001111111001111011110010000101011
0001010110010010000000011111000110001001110001000000011011001010100000
1001111101111101011110010000101011000101011001001000000010010000110100
1010000001011011110100100010100100100111111010000101111001000010101100
0101011000001000000100100010100100010111100110001110100101101001110010
0010100000100011111001000010101100010101100100100000001011110100011010