DAB, Qt-DAB-2.0 and other SDR software (August 2018)

DAB and DAB+

The DAB programs are implemented for use under Linux on x86_64 computers, under Windows, and under Stretch on the RPI 2/3. The software is developed under Linux (Fedora), "open source", available and large parts have been reused by others as well.

There are different versions of the DAB decoding programs, two with, others without a GUI.

Receiving DAB Receiving DAB

The GUI versions

The picture on the right, dabradio is a simple version, just select a service and listen. The one on the left, called Qt-DAB, does have more features and displays.

Both programs support - if so configured - the SDRplay, the AIRspy and rtlsdr based DABsticks as input device. The Qt-DAB program can be configured to accept input from an HACKRF device and from a file, either a "raw" file (".iq" or ".raw", 8 bit I/Q samples) as produced by e.g. osmocom tools or an "sdr" file (a ".wav" file) generated by the Qt-DAB program. Both programs support MOT handling from subchannels of audio services, as is the way of showing MOT data in e.g. transmissions in Belgium.

Sources and executables.

The repositories ("https://github.com/JvanKatwijk/qt-dab" and "https://github.com/JvanKatwijk/dabradio") contain all sources of the programs.

For both programs so-called AppImages are available, "ready-to-run" images, one for x86_64 based Linux boxes and one for use with Raspbian Stretch on an Raspberry PI 2/3. For such an AppImage to run, one should have the library for the device of choice installed (most modern distros do have the rtlsdr library in the repositories, the driver for the SDRplay devices can be downloaded from SDRplay.com), the AppImage itself contains all further dependencies. Running is then simply setting the exec bit on the AppImage and executing the file.

For Windows, a "zip-file" (windows-bin.zip) is available, a folder compressed in "zip" format, with the executables of these (and other) programs and the required DLL's.

This windows-bin.zip file and an AppImage for Qt-DAB are available in the releases section of the Qt-DAB repository ( Qt-DAB releases).

An Appimage for dabradio is available in the releases section of the dabradio repository ( dabradio releases). The Windows executable of dabradio is in the aforementioned zipped folder.

dabradio: Features

Receiving DAB

Dabradio is made by omitting features, retaining just those to decode DAB audio services.

Most important simplifications of dabradio program from Qt-DAB are:

  1. no explicit device selection. If one of the configured devices is connected, the software will automatically open it when started.

  2. no explicit channel selection. On program start, a scanning function will scan through selected channels to collect the names of all audio services. The GUI contains a reset button to start a new scan over all channels in the selected band.

The Mode and Band are set to default values (Mode 1 and VHF Band III), they can be set to a different value in a simple configuration file (.dabradio.ini in the home directory).

Audio services will show on the GUI. Selecting a service is just by clicking on the name of the service in the list.

Furthermore, there are 3 buttons and one slider

  1. The audio out selector for selecting a channel on the sound card. Default is here "default";

  2. Pushing the reset button will start scanning of all channels in the selected band. Only those channels where a DAB ensemble is discovered are recorded for a next start of the program.

  3. Pushing the auto button will set - if available - the autogain function in the attached device.

  4. The slider can be used to set the gain of the attached device, setting is in a range from 1 .. 100. The value will be mapped onto a value in the range supported by the device.

Qt-DAB: features

Receiving DAB

The GUI of Qt-DAB-2.0 provides elements for selecting of an input device, selecting a channel and selecting the Band. Qt-DAB also supports - in limited way - handling of data services next to handling of audio services. It handles MOT data, and if a a service with TPEG data is selected, it instantiates a server to enable clients to do whatever they want to do with that data. EPG data will be stored in a file, and IP transmissions will be send through to a user specified port.

The Windows version provides additional support for selected devices with an Extio plugin dll, tested with plugins for the SDRPlay and rtlsdr based DABsticks. Direct support for SDRPlay, for DABsticks and AIRSPY is obviously available for both Linux and Windows. Support for the HACKRF device is available under Linux.

Qt-DAB-2.0 contains some buttons to select a widget with additional information:

  1. The button Technical details controls the visibility of a widget with information on the selected service and on the quality of the reception.

  2. the spectrum button controls the visibility of the the spectrum of the received input. It shows the spectrum, the constellation of the decoded data, and a simple quality indication;

  3. the ir button controls showing the response on the incoming first data block of the stream: a stable image with a single "needle" on app pos 500 is good, more "needles" show that more transmitters are being received, the strongest one is selected;

  4. the tii button controls showing the spectrum of the "null-period", containing the data defining the Transmitter Identification Information (TII). An (educated) guess of the main Id and the subId of the Transmitter Identification Information as - with most transmissions - transmitted in the signal null-period is continuously shown at the bottom of the "Technical Data" Widget.

In QT-DAB controls for the selected device will be made visible in a separate widget after selecting the device.

Qt-DAB supports dumping the input in a ".wav" file format (the ".sdr" files). The resulting file can be processed by Qt-DAB. Furthermore, Qt-DAB supports dumping the audio output in a ".wav" file format.

On (normal) termination (by closing the main widget) of the program, some settings (i.e. device selection, channel selection, service selection) are stored in the ".ini" file (.qt-dab.ini), these settings are used to set sliders and selectors when starting the program a next time.

Command line versions: dab-cmdline

In order to create a command line version for DAB processing, a library was created with entries to the functionality to process DAB and DAB+. The sources can be compiled into a shareable library, or they can be included in an application. To show examples of the use of this library, some (sources for) example programs are provided for (each directory contains a CMakeLists.txt file that can be used to create an executable).

  1. Example 1 implements a simple command line version, using a precompiled library. In the configuration phase one has to select the device to be used;

  2. Example 2 implements a simple command line version, using the sources of the library. In the configuration phase one has to select the device to be used;

  3. Example 3 is based on example 2, it differs from example 2 in that the PCM output is now being sent to stdout rather than using portaudio to control a soundcard;

  4. Example 4 is based on example 2, it differs from example 2 in that the raw MP2 or aac data (depending on the service selected) is being sent to stdout rather than to an MP2 resp. AAC decoder

  5. Example 5 implements the functionality of example 2, with as addition the possibility of selecting the "next" service in the channel;

  6. Example 6 implements a version with an internet interface. Commands to select a channel, set the gain of the device (on a scale from 1 .. 100) and select a service can be given through an IP port, some data (i.e. the names of the services in an ensemble) are passed back. The Example code contains a mini client implemented using Qt.

  7. The Python example implements a simple command line version using Python 3. A Python API layer is created implementing a library with a Python binding to DAB handling functionality. This Python API together with the library sources are made into a separately compiled library and references from with the Python program.

A typical command line for e.g. the Example 2 program, configured to run with an SDRplay device is

./linux/dab-sdrplay-2 -M 1 -B "BAND III" -C 12C -P "Radio 4" -G 40 -A default

In this example Mode 1 is selected explicitly, which happens to be the default one. VHF Band III is selected, which also happens to be the default one, channel 12 C is selected, and in that channel the program "Radio 4". The Gain for the input device is set to 40 (on a scale from 1 .. 100), and as output device "default" is chosen (which, almost obviously, happens to be the default one).

The example programs - although all functioning quite well - are merely meant to show the usage of the library (or its sources) and are hopefully a source of inspiration, rather than complete implementations. Use your own imagination tot adapt and extend.

Other implementations

Just as a programming exercise - and to (re-)gain some experience with the languages - the core of the C++ implementation was recoded in both Ada and Java. Both implementations are functioning and provide more or less the same functionality as dabradio. Both programs make use of a number of "native" (i.e. "C") libraries. gnat, the compiler used for the Ada version, is part of the gcc ecosystem, making it relatively easy to bind to C libraries, in Java it is more complex - and it is far less portable - to handle "native" libraries.

javaDab adaDab

The sources are to be found in the github repositories:

  1. "https://github.com/JvanKatwijk/JavaProject"
  2. resp. "https://github.com/JvanKatwijk/ada-dab"
  3. .

While both programs are functioning, making them was merely an exercise and the programs are not actively maintained. Feel free to adapt, modify and extend. A reasonably extended implementation description of ada-dab is contained in the repository.

swradio-8

Shortwave Radio

The swradio-8 program is used to "listen" to "short wave", it supports the SDRplay (all models) as input device and it implements half a dozen decoders. While there are no decoders specific to signals in the higher bands the covered frequency range is only determined by the device and with the SDRplay allows access to frequencies up to 2 GHz.

The software is a (partial) rewrite and simplification of the sdr-j-sw software, the latter, still available on github, supports more decoders than this one, but is more complex to build and to use.

The swradio-8 assumes that the interesting signals are small-band, The inputrate of the SDRplay is set to just over 2M, and decimated (and filtered) to a rate of 96000. The software will then select a band with a width of 12K, based on the user's frequency selection, and filter it out. The user then can select a subband (usb, lsb, AM, wide) to be send to the selected decoder, the decoder will - if required - do further filtering.

SW Reception

Implemented decoders are:

  1. An AM decoder,
  2. a decoder for USB and LSB
  3. an rtty decoder,
  4. a psk decoder,
  5. a CW decoder,
  6. a weather-fax decoder,
  7. an AMTOR (Navtex) decoder,
  8. and a DRM decoder (only 10K and smaller) for DRM broadcast transmissions (see picture).

The bandwidth for the decoder can be set to AM (9 kHz), wide, for DRM (12 kHz), USB (2.5 kHz) or LSB (2.5 kHz).

On the 7 and 14 MHz band there are plenty of CW and psk calls. The 3855 Khz frequency is often used by me to receive weatherfaxes, the coastguard sends regularly messages in Amtor format on 518 Khz. DRM transmissions are rather scarce, the transmissions of RRI and Nigeria are well received here.

A new feature is that a program list can be maintained between program invocations, selecting a program on the list is just by clicking the mouse on the selected program. The GUI contains a button with which a frequency can be saved and stored in the list.

For use under Linux, one might want to download an AppImage from the releases section in from github. The AppImage is "ready to run" (after downloading and setting the exec bit of course), one only needs to have installed the support library for the SDRplay (the library can be downloaded from SDRplay.com).

The AppImage and the Windows executable both have the correct faad library for DRM reception compiled in.

The Windows version is included in the aforementioned "zip" file, maintained in the releases section of the Qt-DAB repository, the sources are in the aforementioned repository.

Other SDR-J programs

Some other programs might also be of interest

  1. FM software:
    1. WFM-RPI, a program with a small and simple GUI, just to select a frequency and listen to the output;

    2. a "larger" program with a wealth of buttons and sliders showing the spectrum of the incoming signal and the spectrum of the decoded signal.

    3. a command line version, supporting the SDRplay and the AIRSPY, just to experiment with.

  2. a simple "spectrum viewer", just to show spectra from common devices like the SDRplay, dabsticks and others.

  3. qt-1090, a variant of the popular 1090 decoding program of Salvatore Sanfilipo, with additional support for the SDRplay and the HACKRF devices, and with a simple GUI

  4. a simple demonstration program for filters, just showing the behaviour of software-implemented filters.

FM Software.

WFM-RPI software

The WFM-RPI software is the implementation of a simple (W)FM decoder, compiled for use with radio devices as SDRplay, AIRspy and/or DABsticks (depending on the configuration). The software runs under Windows (precompiled version configured for all three devices mentioned) and under Linux. The sources are to be found on the github repository.

The program(s) support decoding FM transmissions in mono and stereo and support RDS decoding (obviously, the frequencies to be received depend on the radio device connected).

A program list, a list of known programs with their frequencies, is maintained between invocations.

Fm Reception

Tooltips tell the function of the various buttons and sliders.

A general (W)FM decoder

The more general sdr-j-fm software contains more elements, the GUI shows the spectrum of the incoming signal as well as the spectrum of the decoded signal.

Fm Reception-2

This version supports - under Linux - next to the SDRPlay, the AIRspy, DABsticks and a soundcard, the sw-elad-s1, to be used with a downconverter. Note that the program is - especially when running Windows - quite resource hungry.

While an executable for Windows is in the aforementioned zip file as maintained in the releases section of the Qt-DAB repository, the sources can be downloaded from github .

A command-line (W)FM decoder

For experimental purposes a simple command line based version of the FM software was created. The software sends it output to stdout or to a selected file, rather than to a soundcard. It can be used e.g. to listen to mono or stereo transmissions, or to see what is happening on the P2000 band on 169650 kHz. It is modelled after the - excellent - fm software in the osmocon site for DABsticks.

Receiving P2000

sdrplay_radio -f 169650000 [-p3] |multimon-ng -a FLEX -t raw /dev/stdin

To listen to an FM transmission (the only classical station in the Netherlands on FM)

sdrplay-radio -f 94700000 -g 30 -M fm-stereo -D -Z |aplay -r 22050 -f S16_LE -t raw -c 2 

Since the osmocom site has an excellent version of rtl_fm, the version here can only be configured for the SDRplay or the AIRspy.

The sources for the xxx-radio are to be found at the github repository .

Spectrumviewer.

The spectrumviewer program just shows the spectrum, up to the selected bandwidth determined by the selected samplerate. The spectrumviewer software can be configured with the SDRplay, the AIRspy, the HACKRF and DABsticks.

Spectrum viewer

Operation of the spectrumviewer software is straightforward, tooltips tell the function of the various buttons and sliders.

The spectrumviewer will open a device that is configured and connected. A frequency can be selected by entering the number in the keypad, terminating it with either mHz (for interpreting the number as the frequency in mHz) or kHz (for interpreting the number as the frequency in kHz).

The program shows both a spectrum and a waterfall, here over a range of frequencies in the FM broadcast band.

Since the input is usually wideband, up to 8 or 10 MHz, a decimator is part of the program, where the decimation rate can be selected. For e.g. an input signal with a width of 8 Mhz, decimation with a factor 100 gives a signal width of 80 Khz, making smaller band signals visible.

The "set scan" selector starts (or stops) scanning though the frequencies The 4 selectors to the left of the "set scan" button determine the frequency range, the stepsize and the rate at which the frequency change will occur.

The precompiled Windows executable is to be found in the zipped folder available on the github repository for Qt-DAB . The sources are to be found in the repository "https://github.com/JvanKatwijk/sdr-j-spectrumviewer".

qt-1090 software

The popular 1090 software (Copyrights Salvatore Sanfilipo) to keep track on planes lacked support for the SDRplay and the HACKRF devices. So, some reconstruction was done to improve the separation between "device" and "algorithm", and at the same time a kind of GUI was added.

qt-1090

The current version is 0.8: while it is definitely running, it is still an experimental version and does not have all of its final functionality.

Unfortunately, it seems that the free access to the maps API is restricted and - since end of june - one needs to register and - in some cases - one seems to have to pay for the usage of the API.

The sources, for compilation under Linux, are in their own repository . In the configuration file, qt-1090.pro, one can select or deselect the devices supported. The program, when started, will sequence through a (short) list to open one of the configured devices.

Filter demo.

Modern radio devices deliver a wideband signal (the SDRplay up to 10 Mhz). While nice to show the spectrum of e.g. half the FM broadcast band with a single view, short wave radio reception often needs smaller bands. As an example, the band width for e.g. the psk mode is less than 100 Hz, so it seems that some filtering (and decimation) is inevitable. The sw software takes as input from both the SDRplay and (filters and) decimates that to 96 Khz. The software shows the spectrum of that signal. Then in a next filtering and decimation step a subband of 12 Khz is selected and made available for decoding. The user may select a subband of 2.5 Khz (upper or lower sideband) to be handled by the decoder. The latter will further filter the signal as required.

All these filterings are done by Finite Impulse Response filters, some with a pretty high degree (a degree of 255 is no exception, although then implemented using a FFT). FIR is chosen over IIR since FIR does not destroy the phase of the signal.

To show the effects, possibilities and restrictions a simple program was made to demonstrate various windowing techniques for FIR filtering. The pictures all show a filter with a degree 64 and a width of 0.33 (in the range 0 .. 100, i.e. for a signal with a sampling rate of 96000, this would mean 0.33 * 96000 / 2, i.e. 16Khz). So the pictures show a low pass filter with a 3DB point at 16 Khz.

filter-1 filter-2 filter-3 filter-4

The sources of the program can be found in the github repository .

Finally...

Since my interest is primarily in programming, I'm less interested in writing manuals (that no one ever reads), so manuals are pretty much absent. The versions of the software with a GUI are equipped with tooltips, telling the function of the GUI elements. For the others, read the README and the CMakeLists.txt and/or the xxx.pro file.

An informal description of the synchronization in the DRM decoder is given in this description. The document will be a draft forever, but it contains quite some practical information on issues encountered in writing the software (one of the decoders for the sw-radio-8 program) for decoding the DRM signal.

A description - also informal - of processing of DAB and DAB+, as implemented in the Ada version of the software, is given here. This (also eternal draft) report describes - including a number of code fragments - how the Ada version of the DAB software is built up. The description presumes some basic knowledge on Ada and on the structure of DAB.

Developing this SDR-J software is a pure hobby project, the software is available "as-is" under a GPL V2 license. It is - obviously - nice if the software is useful, but if - for whatever reason - it is not, feel free not to use it. As the license states:
SDR-J is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

I am grateful to SDRplay ltd for providing me the possibility to use different versions of the SDRplay RSP devices, all wonderful devices. Furthermore, thanks to Benjamin Vernoux for making an AIRSPY device available to me, and Great Scott Gadgets for making an HACKRF device available to me.

Suggestions for improving the programs are always welcome (but do not expect me to work on a call-basis). Material contributions are - of course - also always very welcome.

Have Fun!!!

Pijnacker, August 2018
Jan van Katwijk
Lazy Chair Computing
J.vanKatwijk-at-gmail-dot-com