Coder Social home page Coder Social logo

redsea's Introduction

redsea RDS decoder

redsea is a lightweight command-line FM-RDS decoder for Linux/macOS. It supports a large subset of RDS features.

release build

Decoded RDS groups are printed to the terminal as line-delimited JSON objects or, optionally, undecoded hex blocks (-x). Please refer to the wiki for input data formats.

Redsea can be used with any RTL-SDR USB radio stick with the rtl_fm tool, or any other SDR via csdr, for example. It can also decode raw ASCII bitstream, the hex format used by RDS Spy, and audio files containing multiplex signals (MPX). These use cases are documented in the wiki.

Example output:

{"pi":"0xD3C2","group":"0A","ps":"MDR JUMP","di":{"dynamic_pty":true},"is_music":true,"prog_type":"Pop music","ta":false,"tp":false}
{"pi":"0xD3C2","group":"2A","prog_type":"Pop music","tp":false}
{"pi":"0xD3C2","group":"2A","radiotext":"Das Leichteste der Welt von Silbermond JETZT AUF MDR JUMP","prog_type":"Pop music","tp":false}
{"pi":"0xD3C2","group":"12A","prog_type":"Pop music","radiotext_plus":{"item_running":true,"item_toggle":1,"tags":[{"content-type":"item.title","data":"Das Leichteste der Welt"},{"content-type":"item.artist","data":"Silbermond"}]},"tp":false}
{"pi":"0xD3C2","group":"3A","open_data_app":{"app_name":"RadioText+ (RT+)","oda_group":"12A"},"prog_type":"Pop music","tp":false}

Contents

Installation

These commands should be run in the terminal. Don't type the $ in the beginning.

  1. Install the prerequisites. On Ubuntu:

     $ sudo apt install git build-essential autoconf libsndfile1-dev libliquid-dev
    

Or on macOS (OSX) using Homebrew:

    $ brew install autoconf automake libsndfile liquid-dsp
    $ xcode-select --install
  1. Clone the repository (unless you downloaded a release zip file):

     $ git clone https://github.com/windytan/redsea.git
     $ cd redsea
    
  2. Compile redsea:

     $ ./autogen.sh && ./configure && make
    
  3. Install:

     $ make install
    

How to later get the latest updates and recompile:

    $ git pull
    $ ./autogen.sh && ./configure && make clean && make
    $ make install

For a slower machine it can take some time to compile the TMC support. This can be disabled (./configure --disable-tmc).

If you only need to decode hex or binary input and don't need demodulation, you can compile redsea without liquid-dsp (./configure --without-liquid).

Usage

By default, an MPX signal is expected via stdin (raw 16-bit signed-integer PCM sampled at 171 kHz).

The simplest way to view RDS groups using rtl_fm is:

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

Please refer to the wiki for more details and usage examples.

Full usage

radio_command | redsea [OPTIONS]
redsea -f WAVEFILE

-c, --channels CHANS   Number of channels in the raw input signal. Each
                       channel is demodulated independently.

-e, --feed-through     Echo the input signal to stdout and print
                       decoded groups to stderr.

-E, --bler             Display the average block error rate, or the
                       percentage of blocks that had errors before
                       error correction. Averaged over the last 12
                       groups. For hex input, this is the percentage
                       of missing blocks.

-f, --file FILENAME    Use an audio file as MPX input. All formats
                       readable by libsndfile should work.

-i, --input FORMAT     Decode stdin as FORMAT (see the wiki for more info):
                        bits Unsynchronized ASCII bit stream (011010110...).
                             All characters but '0' and '1' are ignored.
                        hex  RDS Spy hex format.
                        mpx  Mono S16LE PCM-encoded MPX waveform (default).
                        tef  Serial data from the TEF6686 tuner.

-l, --loctable DIR     Load TMC location table from a directory in TMC
                       Exchange format. This option can be specified
                       multiple times to load several location tables.

-p, --show-partial     Show some multi-group data even before they've been
                       fully received (PS names, RadioText, alternative
                       frequencies). partial_ will be prepended to their
                       names. This is good for noisy conditions.

-r, --samplerate RATE  Set sample frequency of the raw MPX input signal in Hz.
                       Will resample (slow) if this differs from 171000 Hz.

-R, --show-raw         Show raw group data as hex in the JSON stream.

-t, --timestamp FORMAT Add time of decoding to JSON groups; see
                       man strftime for formatting options (or
                       try "%c"). Use "%f" to add hundredths of seconds.

-u, --rbds             RBDS mode; use North American program type names
                       and "back-calculate" the station's call sign from
                       its PI code. Note that this calculation gives an
                       incorrect call sign for most stations that transmit
                       TMC.

-v, --version          Print version string and exit.

-x, --output-hex       Output hex groups in the RDS Spy format,
                       suppressing JSON output.

Formatting and filtering the JSON output

The JSON output can be tidied and/or colored using jq:

$ rtl_fm ... | redsea | jq

It can also be used to extract only certain fields, for instance the program type:

$ rtl_fm ... | redsea | jq '.prog_type'

Requirements

  • Linux or macOS
  • For realtime decoding, a Raspberry Pi 1 or faster
  • ~8 MB of free memory (~128 MB for RDS-TMC)
  • C++14 compiler
  • GNU autotools
  • libiconv 1.16
  • libsndfile 1.0.31
  • liquid-dsp release 1.3.2
  • rtl_fm (from rtl-sdr) or any other source that can output demodulated FM multiplex signals

Troubleshooting

Can't find liquid-dsp on macOS

If you've installed liquid-dsp yet configure can't find it, it's possible that XCode command line tools aren't installed. Run this command to fix it:

xcode-select --install

Can't find liquid-dsp on Linux

Try running this in the terminal:

sudo ldconfig

Contributing

Bug reports are welcome. See CONTRIBUTING for more information.

Also, if a station in your area is transmitting an interesting RDS feature that should be implemented in redsea, I would be happy to see a minute or two's worth of hex data using the -x switch. You could use a gist or an external pastebin service and post a link to it.

Licensing

Redsea is released under the MIT license, which means it is copyrighted to Oona Räisänen OH2EIQ yet you're free to use it provided that the copyright information is not removed. (jsoncpp and iconvpp have their own licenses.) See LICENSE.

This software should never be relied on for emergency communication, accurate traffic / weather information, or when your life is on the line.

redsea's People

Contributors

andimik avatar athoik avatar master131 avatar mct avatar windytan avatar zipdox2 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

redsea's Issues

Residual phase error

There's a residual phase error of around 6° in the liquid-dsp symbol synchronizer. Probably not a big deal, but not perfect either; it could potentially cause more bit flips than necessary in noisy conditions.

The relevant function is Subcarrier::demodulateMoreBits(). This phase error seems to come from the PLL NCO that follows the difference frequency between 57 kHz and the actual subcarrier (nco_exact_).

  • Perhaps nco_exact_.stepPLL() should be called at a different point?
  • Calling nco_exact_.step() anywhere makes the constellation rotate wildly. But according to Liquid docs, you should call step() on an NCO or it will not advance. So what's happening here?
  • What about loop filter bandwidth?
  • Or perhaps the PLL can't lock onto such a low frequency? It's on the order of ±10 Hz.
  • Links to liquid docs: nco, symsync

Here's the constellation of PSK symbols returned by the liquid-dsp functionsymsync_crcf_execute():

png image

Multiple source support!

Hey!

  1. Why Analog input was removed?!
  2. Add RTL-SDR!!!
  3. Add command line option for selecting RDS signal source

RT+ JSON names should not contain periods

According to JSON API v1.0, member names must not contain periods. So the RadioText Plus fields should be exploded into objects:

"radiotext_plus":{
  "item.artist":"Silbermond",
  "item.title":"Das Leichteste der Welt",
  "item_running":true
}

should be

"radiotext_plus":{
  "item":{
    "artist":"Silbermond",
    "title":"Das Leichteste der Welt",
  },
  "item_running":true
}

or

"radiotext_plus":{
  "item":{
    "artist":"Silbermond",
    "title":"Das Leichteste der Welt",
    "running":true
  }
}

But this would pose a problem, because the content of RT+ class chat would be of ambiguous type (it may contain a string or an object with center string). So another way to do this would be:

"radiotext_plus":{
  "tags":[
    {
      "content-type":"item.artist",
      "data":"Silbermond"
    },
    {
      "content-type":"item.title",
      "data":"Das Leichteste der Welt"
    }
  ],
  "item_running":true
}

However, this would make the JSON more difficult to filter.

broken json

{"pi":"0xd318","group":"3A","tp":"true","prog_type":"Pop Music","open_data_app":{"oda_group":"12A","app_name":"RadioText+ (RT+)"}

there's a missing }

RBDS support

It should be possible, using a command-line switch, to instruct redsea to use the US standard RBDS instead.

Compilation instructions incorrect for Linux

Following instructions in readme:

kjotte@daedalus:~/git/redsea$ gcc -o rtl_redsea -lm rtl_redsea.c
rtl_redsea.c: In function ‘main’:
rtl_redsea.c:91:5: error: ‘for’ loop initial declarations are only allowed in C99 mode
     for (int iq=0;iq<=1;iq++) {
     ^
rtl_redsea.c:91:5: note: use option -std=c99 or -std=gnu99 to compile your code

Code compiles correctly with command:
kjotte@daedalus:~/git/redsea$ gcc -std=gnu99 -o rtl_redsea rtl_redsea.c -lm

tmc description is missing

the following is selected: [.location,.event_codes,.description]'

result:
[12823,[243],"."]
[12823,[243],"."]
[12820,[501],"."]
[31769,[802],"."]
[61452,[401,1472],"."]
[12744,[1926],"."]
[7613,[105],"."]
[7613,[105],"."]
[32245,[802,810],"."]
[7613,[241],"."]
[7613,[241],"."]
^C

label mismatch in event_list.h

Hello,

First I would like to say a very very big thank you for your work. Redsea is working like a charm. It's fully support the two commercial TMC services in my local area.

It's seem that the line number 1062 in event_list.h should be

"1356;cold,;cold, minimum temperature (Q);F;6;L;2;;37;M6F"

instead of :

"1356;cold,;cold, maximum temperature (Q);F;6;L;2;;37;M6F"

About TMC encryption : in my case they do not encrypted the location, they just send a different table code that the one expected in my country. Changing the table code in my side to the trick.

Best Regards

Use of uninitialized value in subroutine entry at redsea.pl line 185.

Hi, I'm having trouble running this on Mac OS X 10.10.2

  1. gcc -std=gnu99 -o rtl_redsea rtl_redsea.c -lm
  2. perl5.18 redsea.pl 105.7M
  3. Output:
Found 1 device(s):
  0:  Generic, RTL2832U, SN: 77771111153705700

Using device 0: Generic RTL2832U
Found Rafael Micro R820T tuner
Tuner gain set to automatic.
Tuned to 106012500 Hz.
Oversampling input by: 5x.
Oversampling output by: 1x.
Buffer size: 6.55ms
Exact sample rate is: 1250000.002070 Hz
Sampling at 1250000 S/s.
Output at 250000 Hz.
Use of uninitialized value in subroutine entry at redsea.pl line 185.
Use of uninitialized value in subroutine entry at redsea.pl line 185.
...
Use of uninitialized value in subroutine entry at redsea.pl line 185.
^CSignal caught, exiting!

User cancel, exiting...

Also, sox --version produces

sox:      SoX v

which seems strange, but I'm not sure if it's related.

Thanks very much for your help

item.artist and item.title are missing last character

I know this part is still in the development, just wanted to point this out:
$ nc -u -l 192.168.1.255 6666 | ./redsea -b | sed -r 's/\/\*[^\/]+.//g'|jq -c 'select(.group=="12A")|.radiotext_plus|select(.["item.artist"]!=null)|[ .["item.artist"],.["item.title"] ]'
[" "," "]
[" "," "]
[" "," "]
[" "," "]
[" Taylor Swif"," Shake It Of"]

it should be "Taylor Swift" I suppose and "Shake It Off"

libsndfile

Reading a wav file should be possible without SoX, using libsndfile.

Possible length off-by-one in RadioText+ decode

Looks like RadioText+ might be dropping the last character. I'm inferring this from the standard RT messages preceeding it:

17EF  2A TP:0 PTY:10 RT:'B93.9 Close Your Eyes Parmalee ↵                                ' RT_OK
  RadioText+: 
    Item running
    Tag item.artist: Parmale
    Tag item.title: Close Your Eye

Hex dumps for TODO 7A 8A 9A 11A 12A

First of all thanks for your software!

I test in on local fm radio and got some debug TODOs.

So I collect hex dumps in 5 minutes for each stantion with TODOs: todo.dump.zip

There is also one file with "unimplemented ODA app" message.

could the crc error correction return wrong result?

that is not discarded?

{"group":"2A","pi":"0x141D","prog_type":"No PTY","radiotext":"Jetzt on air: ** KUNGS feat. JAMIE N COMMONS ** DONT YOU KNOW","tp":true}
{"group":"2A","pi":"0x141D","prog_type":"No PTY","radiotext":"Jetzt on air: ** KUNGS feat. JAMIE N COMMONS ** DOOL YOU KNOW","tp":true}
{"group":"2A","pi":"0x141D","prog_type":"No PTY","radiotext":"Jetzt on air: ** KUNGS feat. JAMIE N COMMONS ** DONT YOU KNOW","tp":true}

DONT -> DOOL -> DONT

Rx timestamp

Groups should optionally include time of decoding, optionally formatted using strftime. Its name should reflect that it's not the time of transmission.

timestamp_rx:"2017-06-18 11:48:21"

Clock recovery

Redsea should recover the clock signal and integrate over the DPSK bit-time to ensure best SNR. Currently there is no locking whatsoever and the signal will fade in and out at the difference frequency between TX and RX clocks.

Suggested fix: PLL

This locking could be implemented as a PLL. There is a PLL readily available in liquid-dsp.

Caveat

How to present an estimate of the phase error to the PLL in the presence of gradual 180-degree phase shifts?

Suggested fix: symsync

There's also a symbol synchronizer in liquid that probably does everything needed for carrier & clock recovery

Caveat

How to use it in binary DPSK? The example for QPSK does not work for RDS.

Incorrect frequency reported in display output

$perl redsea.pl 99.0M
Waiting for sync at 99.00 MHz
Found 1 device(s):
  0:  Realtek, DVB-T Dongle, SN: 00000991

Using device 0: Dexatek DK DVB-T Dongle (Logilink VG0002A)
Found Fitipower FC0013 tuner
Tuner gain set to automatic.
Tuned to 99500000 Hz.
Oversampling input by: 8x.
Oversampling output by: 1x.
Buffer size: 4.10ms
Exact sample rate is: 2000000.052982 Hz
Sampling at 2000000 S/s.
Output at 250000 Hz.

As you can see, the "Tuned to" line reports a frequency that is 0.5 MHz above the selected one. It does seem to pick the correct frequency, though. (In my area I have two radio stations which are 0.5 MHz apart, and if I pick the lower one, I get the correct station.)

I didn't investigate further – it may be a bug in rtl-sdr.

redsea exits - libliquid.so not found

Could you tell me why redsea exits? I've even have copied libliquid.so to the readsea directory. libsndfile is installed, too.

./rtl-rx.sh -f 90.4M
redsea: error while loading shared libraries: libliquid.so: cannot open shared object file: No such file or directory
Found 1 device(s):
0: NOXON, DAB Stick, SN: 0

Using device 0: Terratec NOXON DAB/DAB+ USB dongle (rev 1)
Found Fitipower FC0013 tuner
Tuner gain set to 19.70 dB.
Bandwidth set to automatic resulted in 0 Hz.
Tuned to 90058000 Hz.
Oversampling input by: 8x.
Oversampling output by: 1x.
Buffer size: 5.99ms
Exact sample rate is: 1368000.013046 Hz
Sampling at 1368000 S/s.
Output at 171000 Hz.
Signal caught, exiting!

User cancel, exiting...

wrong output

it looks like the next json could start on the same line before the previous one is finished:

{"pi":"0xd318{"pi":"0xd318","group":"3A","tp":"true","prog_type":"Pop Music","open_data_app":{"oda_group":"8A","app_name":"RDS-TMC: ALERT-C"},"tmc":{"system_info":{"is_encrypted":"false","location_table":"0x01","is_on_alt_freqs":"false","scope":["national","regional","urban"]}}}

Resampling

The input sample rate should be configurable. When it differs from 171k, an internal resampler should be used.

No RDS text

I dont get any RDS text. Is there anything i am missing?

$ rtl_fm -f 95.7e6 -M wbfm -s 200000 -r 48000 - |./redsea -u --feed-through|aplay  -f S16_LE -r48000 
Found 1 device(s):
  0:  Realtek, RTL2838UHIDIR, SN: 00000001

Using device 0: Generic RTL2832U OEM
Found Rafael Micro R820T tuner
Tuner gain set to automatic.
Tuned to 96016000 Hz.
Oversampling input by: 6x.
Oversampling output by: 1x.
Buffer size: 6.83ms
Sampling at 1200000 S/s.
Output at 200000 Hz.
Playing raw data 'stdin' : Signed 16 bit Little Endian, Rate 48000 Hz, Mono

I also tried without the -u option, and the result was the same.

The following does give some text:

$ rtl_fm -M fm -l 0 -A std -p 0 -s 171k -g 40 -F 9 -f 95.7e6 |./redsea 
Found 1 device(s):
  0:  Realtek, RTL2838UHIDIR, SN: 00000001

Using device 0: Generic RTL2832U OEM
\Found Rafael Micro R820T tuner
Tuner gain set to 40.20 dB.
Tuned to 96042000 Hz.
Oversampling input by: 8x.
Oversampling output by: 1x.
Buffer size: 5.99ms
Exact sample rate is: 1368000.013046 Hz
Sampling at 1368000 S/s.
Output at 171000 Hz.
{"pi":"0x2B25"}
{"di":{"stereo":false},"group":"0A","is_music":true,"pi":"0x2B25","prog_type":"Culture","ta":false,"tp":false}
{"di":{"artificial_head":false},"group":"0A","is_music":true,"pi":"0x2B25","prog_type":"Culture","ta":false,"tp":false}
{"di":{"compressed":false},"group":"0A","is_music":true,"pi":"0x2B25","prog_type":"Culture","ta":false,"tp":false}
{"di":{"dynamic_pty":true},"group":"0A","is_music":true,"pi":"0x2B25","prog_type":"Culture","ta":false,"tp":false}
{"di":{"stereo":false},"group":"0A","is_music":true,"pi":"0x2B25","prog_type":"Culture","ta":false,"tp":false}
{"di":{"artificial_head":false},"group":"0A","is_music":true,"pi":"0x2B25","prog_type":"Culture","ta":false,"tp":false}
{"group":"2A","pi":"0x2B25","prog_type":"Culture","tp":false}
{"di":{"compressed":false},"group":"0A","is_music":true,"pi":"0x2B25","prog_type":"Culture","ta":false,"tp":false}
{"di":{"dynamic_pty":true},"group":"0A","is_music":true,"pi":"0x2B25","prog_type":"Culture","ps":" on 95.7","ta":false,"tp":false}
{"di":{"stereo":false},"group":"0A","is_music":true,"pi":"0x2B25","prog_type":"Culture","ta":false,"tp":false}
{"di":{"artificial_head":false},"group":"0A","is_music":true,"pi":"0x2B25","prog_type":"Culture","ta":false,"tp":false}
^CSignal caught, exiting!

User cancel, exiting...
Signal caught, exiting!

How do i get RDS with wbfm?

cannot compile.

Hi I'm trying to compile this on a orange pi with debian jesse.

I have liquid installed but make fails

hadow -Wuninitialized -pedantic -g -O2 -MT redsea-redsea.o -MD -MP -MF .deps/redsea-redsea.Tpo -c -o redsea-redsea.o test -f 'redsea.cc' || echo './'redsea.cc
In file included from ../src/subcarrier.h:10:0,
from ../src/block_sync.h:10,
from redsea.cc:24:
../src/liquid_wrappers.h:55:31: error: expected â before â
SymSync(liquid_firfilt_type ftype, unsigned k, unsigned m,
^
Makefile:400: recipe for target 'redsea-redsea.o' failed

the configure script can find liquid otherwise it would stop. Any hints?? Thanks in advance

Only print TMC messages received twice

There's an "error-detection" mechanism in TMC that suggests messages should only be displayed after they're received at least twice. This should be implemented in redsea.

Improve error correction if possible

The error correction makes a lot of mistakes yet reports them as valid codewords (syndrome == 0). Two options:

  1. This should be fixed, or
  2. If it is a limitation of the error correction code itself, error correction should be disabled.

Here's an example of the error correction failing. The group is shown separated into blocks (4 hex characters) and checkwords (3 characters).

orig: 6A03/2C7 0421/14A F741/0C6 4557/1B8
err:  0800     0100     0000     0800
corr: 6203     0521              4D57

This leads to the PS string "YLMWUO" (should be "YLESUOMI"). It nevertheless gives syndrome 0 (no errors detected).

The syndrome calculation function (uint32_t calcSyndrome(uint32_t) in block_sync.cc) is a shift register implementation using obscure bit magic and should also be reviewed.

Here's what the RDS specs have to say about the error protection scheme:

The error-protecting code has the following error-checking capabilities [3, 4]:

a) Detects all single and double bit errors in a block.
b) Detects any single error burst spanning 10 bits or less.
c) Detects about 99.8% of bursts spanning 11 bits and about 99.9% of all longer bursts.

The code is also an optimal burst error correcting code [5] and is capable of correcting any
single burst of span 5 bits or less.

The references point to:

[3] Peterson, W.W., and Brown, D.T.: Cyclic codes for error detection.
Proceedings of the IRE, No. 49, January 1961, pp. 228-235. (pdf)

[4] Peterson, W.W., and Weldon, E.J.: Error-correcting codes.
Published by MIT Press, Cambridge Mass., second edition, 1972.

[5] Kasami, T.: Optimum shortened cyclic codes for burst error correction.
IEEE Transactions on Information Theory (IT9), No. 4, 1963, pp. 105-109. (doi)

Does not compile

This patch fixed it for me.

diff --git a/rtl_redsea.c b/rtl_redsea.c
index 9ea1e68..2b3dca3 100644
--- a/rtl_redsea.c
+++ b/rtl_redsea.c
@@ -122,8 +122,8 @@ int main(int argc, char **argv) {
reading_frame = 0;
qua = 0;
double t = 0;

  • int numsamples = 0;
    #endif
  • int numsamples = 0;

while ((c = getopt (argc, argv, "f:")) != -1)
switch (c) {

RDS 2.0

Soon, the new version of RDS standard will start to be integrated. It's backwards-compatible, but adds additional subcarriers to increase data throughput. It will have many new features: https://en.wikipedia.org/wiki/Radio_Data_System#RDS_2.0.

Will you implement it when the specifications are released?

redsea: data.cc:10: std::string redsea::getLCDchar(int): Assertion `code >= 32' failed.

I run readsea with the below command, any ideas what I'm doing wrong ?

$ date ; rtl_fm -M fm -f 88.5M -l 0 -A std -p 0 -s 228k -F 9 | ./redsea 2>&1  > /tmp/ram/redsea_88.5M.log.B.txt ; date
Tue Jul  5 13:02:27 UTC 2016
Found 1 device(s):
  0:  Realtek, RTL2838UHIDIR, SN: 00000001

Using device 0: Generic RTL2832U OEM
Found Rafael Micro R820T tuner
Tuner gain set to automatic.
Tuned to 88956000 Hz.
Oversampling input by: 8x.
Oversampling output by: 1x.
Buffer size: 4.49ms
Exact sample rate is: 1824000.017395 Hz
Sampling at 1824000 S/s.
Output at 228000 Hz.
redsea: data.cc:10: std::string redsea::getLCDchar(int): Assertion `code >= 32' failed.
Signal caught, exiting!

User cancel, exiting...
Aborted
Tue Jul  5 14:09:12 UTC 2016
$

It looks to happen at random times:

-rw-r--r--  1 mzs mzs   23356 Jun 30 03:50 redsea_88.5M.log.0.txt.xz
-rw-r--r--  1 mzs mzs    3764 Jun 30 10:12 redsea_88.5M.log.1.txt.xz
-rw-r--r--  1 mzs mzs    3208 Jul  1 01:19 redsea_88.5M.log.2.txt.xz
-rw-r--r--  1 mzs mzs    7864 Jul  1 17:29 redsea_88.5M.log.3.txt.xz
-rw-r--r--  1 mzs mzs    6364 Jul  1 22:57 redsea_88.5M.log.4.txt.xz
-rw-r--r--  1 mzs mzs   12092 Jul  2 03:36 redsea_88.5M.log.5.txt.xz
-rw-r--r--  1 mzs mzs    9040 Jul  2 10:46 redsea_88.5M.log.6.txt.xz
-rw-r--r--  1 mzs mzs   34284 Jul  2 22:57 redsea_88.5M.log.7.txt.xz
-rw-r--r--  1 mzs mzs   29644 Jul  3 12:02 redsea_88.5M.log.8.txt.xz
-rw-r--r--  1 mzs mzs   31604 Jul  4 00:14 redsea_88.5M.log.9.txt.xz
-rw-r--r--  1 mzs mzs   11460 Jul  5 04:00 redsea_88.5M.log.A.txt.xz
-rw-r--r--  1 mzs mzs    2136 Jul  5 14:09 redsea_88.5M.log.B.txt.xz

I do not think that I have managed to run it for 24 hours yet without it kicking up that message.

RT+ tags contain expired RadioText

Occasionally, for a short time, a RT+ tag may contain parts of RadioText it should not apply to, because the change in RadioText was not synchronized with the change in RT+ field lengths.

This appears to be caused at the transmitter; a RT+ tag is transmitted while still transmitting the old RadioText. An example from NDR 2:

                    |         |
D382 2153 6E64 722E | 2A  RT  | "NDR 2   www.ndr.de/ndr2 "
                    |         |              ^^^^
D382 3158 0000 4BD7 | 3A  ODA | 12A = RadioText+
                    |         |
D382 2154 6465 2F6E | 2A  RT  | "NDR 2   www.ndr.de/ndr2 "
                    |         |                  ^^^^
D382 2155 6472 320D | 2A  RT  | "NDR 2   www.ndr.de/ndr2 "
                    |         |                      ^^^^
D382 C148 201C 2244 | 12A RT+ | item.title:"NDR 2   www.ndr"
                    |         | item.artist:"/ndr2 "
D382 2150 4E44 5220 | 2A  RT  | "NDR 2   www.ndr.de/ndr2 "
                    |         |  ^^^^
D382 C148 201C 2244 | 12A RT+ | item.title:"NDR 2   www.ndr"
                    |         | item.artist:"/ndr2 "
D382 2151 3220 2020 | 2A  RT  | "NDR 2   www.ndr.de/ndr2 "
                    |         |      ^^^^

RT+ is handled by parseRadioTextPlus().

A workaround would be to, for example, ignore RT+ tags that end or start with whitespace. But this could possibly lead to legit RT+ being ignored.

Can't get it to decode anything

Maybe the hardware (RPi B+) is not powerful enough?

pi@raspberrypi:~/redsea/src $ rtl_fm -M fm -f 88.2M -l 0 -A std -p 0 -s 228k -F 9 | ./redsea
Found 1 device(s):
0: Realtek, RTL2838UHIDIR, SN: 00000001

Using device 0: Generic RTL2832U OEM
HWTUNER Rafael Micro R820T
Tuner gain set to automatic.
Tuned to 88656000 Hz.
Oversampling input by: 8x.
Oversampling output by: 1x.
Buffer size: 4.49ms
SAMPLERATE 1824000.017395
Sampling at 1824000 S/s.
Output at 228000 Hz.
buffer underrun!

...is all Im getting.

Hex output is missing groups

Not all groups seem to get printed by PrintHexGroup().

The JSON output from a noisy WAV test file shows (erroneous) PI codes that don't show up in the hex output. This should not happen.

redsea exiting when libliquid.so not found

Same problem as issue 41, but a restart does not solve it
Ubuntu 16.04 64 bit
libliquid.so is installed to /usr/local/lib/libliquid.so

I get
redsea: error while loading shared libraries: libliquid.so: cannot open shared object file: No such file or directory

Rename project :-)

Been looking for something like this for a couple of weeks and just stumbled across it. Maybe call it "super RDS decoder" or similar ? :-)

subcarrier.cc needs #include <tuple> for std::tie

To compile out of the box on my system, I need to add #include <tuple> to subcarrier.cc which provides std::tie().

subcarrier.cc: In member function ‘void redsea::Subcarrier::demodulateMoreBits()’:
subcarrier.cc:168:9: error: ‘tie’ is not a member of ‘std’
std::tie(is_clock,biphase) = biphase_decoder_.push(symbol);
^~~

(compiling with Archlinux's gcc-multilib 6.2.1-1, this package provides the c++ stl)

Block error rate

It should be possible to optionally display the block error rate (BLER), i.e. percentage of erroneous blocks during the last n blocks or seconds.

There are two distinct definitions of BLER, depending on the time of calculation: either before (transmission BLER) or after error correction (decoding BLER). Decoding BLER is perhaps more useful for redsea users (?).

The BlockStream member block_has_errors_ is already nearly suitable for this, but for transmission BLER it would need to be able to count error-corrected blocks as well. This would also alter the criteria for sync drop. Whether this is a good thing needs to be tested.

The BLER value should not perhaps refer to a single group; otherwise it could only get one of the values 0, 25, 75, or 100 %. Instead, it should be an average over a dozen or so groups. This may be misleading though, since almost everything else in the JSON object refers to the group at hand.

Print TMC message as soon as it's completed

Currently, multi-part TMC messages are only printed when the next message begins. End of message should be detected instead.

For this to work, a TMC message should know its expected length. This can be calculated from GSI.

configure: error: Could not find liquid-dsp, but liquid-dsp is installed from MacPorts

I can't get past autogen/configure/make. It wants to find liquid-dsp, but can't find it.

checking whether gcc understands -c and -o together... yes
checking dependency style of gcc... gcc3
checking for main in -lliquid... no
configure: error: in `/Users/spk/Documents/Source/GitHub/redsea':
configure: error: Could not find liquid-dsp (use --without-liquid to disable)
See `config.log' for more details
spkmbp:redsea spk$

From config.log:

configure:3591: checking for main in -lliquid
configure:3610: gcc -o conftest -g -O2   conftest.c -lliquid   >&5
ld: library not found for -lliquid
clang: error: linker command failed with exit code 1 (use -v to see invocation)

liquid-dsp really is installed:

spkmbp:redsea spk$ port list installed | grep liquid-dsp
Warning: The 'list' action only shows the currently available version of each port. To see installed versions, use the 'installed' action.
liquid-dsp                     @20170513       science/liquid-dsp
spkmbp:redsea spk$ mdfind liquid.h | egrep "\.h$"
/opt/local/include/liquid/liquid.h
/Users/spk/Documents/Source/GitHub/redsea/src/liquid_wrappers.h
spkmbp:redsea spk$ 

Decode call sign from PI

According to the NRSC-4 standard for the U.S., the PI for a station is based on its call sign, according to a formula in the standard : http://www.nrscstandards.org/SG/nrsc-4-B.pdf (see section 7.12). Most stations here in the U.S. (commercial ones, in any case) use PS either for a slogan (as suggested by the NRSC document) or as a 'poor man's RadioText+'. This leads to interesting results when a radio manufacturer doesn't account for this (the radios in BMWs have had this issue before).

It would be nice, perhaps when the -u switch is used, to have the PI decoded into a string like 'WFOO' or 'KBAZ'. This is makes things more consistent when trying to use redsea output to identify stations.

No output from redsea.pl

rtl_redsea is emitting a sequence of 0's and 1's, but the Perl script doesn't seem to be decoding anything:

kjotte@daedalus:~/git/redsea$ ./rtl_redsea -f 90.7M | ./redsea.pl 
Found 1 device(s):
  0:  Realtek, RTL2841UHIDIR, SN: 00000001

Using device 0: Generic RTL2832U OEM
Name "main::correct_all" used only once: possible typo at ./redsea.pl line 151.
Found Rafael Micro R820T tuner
Tuner gain set to automatic.
[R82XX] PLL not locked!
Tuned to 312590 Hz.
Oversampling input by: 5x.
Oversampling output by: 1x.
Buffer size: 6.55ms
Exact sample rate is: 1250000.002070 Hz
Sampling at 1250000 S/s.
Output at 250000 Hz.

Noise issues

I've gotten some reports that redsea requires a stronger FM signal than other decoders. Possible reasons discussed here.

1) rtl_fm

  • Are the parameters for rtl_fm optimal?
  • Is there a poor-quality resampling phase somewhere?
  • Is the bandwidth (171 kHz) right?

2) PLL

There's jitter in the 57 kHz PLL (realized as nco_crcf_pll_step in liquid-pll), especially when the signal is noisy.

  • Is this an issue?
  • What could affect this? Loop filter bandwidth?
  • What about the phase error multiplier?

Below, the PLL tracks a a good-quality RDS subcarrier. 99.9 % of blocks were received. Time is in seconds.

plot

Here's a noisy signal, with 60.1 % of all blocks received.

plot

Average spectral power of the two signals, good signal in green and the noisy one in red:

plot

Looking at the graph, there's a 27 dB difference in SNR. Is it realistic to receive error-free data in the noisy case?

3) Symbol synchronizer

  • Is liquid's symbol synchronizer being used correctly?
  • What should be the correct values for bandwidth, delay, excess bandwidth factor?
  • Do we really need separate PLL and symbol synchronizer? Couldn't they be fused somehow? Afterall, the PLL already gives us a multiple of the symbol speed (57,000 / 48 = 1187.5).
  • What about symtrack in liquid-dsp 1.3? It seems to perform much worse than the current processing chain + symsync, but could the parameters be adjusted?

Support for LCLs (and maybe ECLs) in TMC messages?

It seems to be easy to get hold of a country's LCL in TMC Exchange format (ISO 14819-3). And in the same package (for Germany) I also got the ECL - but in Excel format which can easily be exported to CSV.

Could you add support to use those files to provide clear text messages for TMC?

Matched filter

A matcher raised root cosine filter would probably improve SNR.

[liquid.h] building error

By building I got:

$ make
make  all-recursive
make[1]: Entering directory `/home/iDoka/soft/redsea'
Making all in src
make[2]: Entering directory `/home/iDoka/soft/redsea/src'
g++ -std=gnu++11 -DHAVE_CONFIG_H -I. -I..  -g -Wall -Wextra -Weffc++ -Wstrict-overflow -Wshadow -Wuninitialized -pedantic    -Wall -std=c++11 -MT redsea-redsea.o -MD -MP -MF .deps/redsea-redsea.Tpo -c -o redsea-redsea.o `test -f 'redsea.cc' || echo './'`redsea.cc
In file included from mpx2bits.h:11:0,
                 from bits2blocks.h:6,
                 from redsea.cc:24:
liquid_wrappers.h:6:27: fatal error: liquid/liquid.h: No such file or directory
 #include "liquid/liquid.h"
                           ^
compilation terminated.
make[2]: *** [redsea-redsea.o] Error 1

I try to search in repo, but cant find proper package:

$ yum search liquid
=================== N/S matched: liquid ===================
rubygem-liquid-doc.noarch : Documentation for rubygem-liquid
rubygem-liquid.noarch : A secure, non-evaling end user template engine with aesthetic markup

My system is CentOS7 x86_64

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.