SDR-J DAB-0.99X, WFM-rpi and SDR-J SW 7.2 (update 01-12-16)

SDR-J is a set of open source programs for the receiving side of Software Defined Radio on the PC. Started as a hobby project (it still is!!!) for getting some sound out of a PC with an Elektor SDR card as (Elektor May 2007) radio device, it evolved into the current set of programs.
The set consists of software for DAB (Windows and Linux PC as well as for a Raspberry PI 2 (3) running a decent Linux distribution), software for (W)FM (Windows and Linux PC and Raspberry PI 2 (3)), software for "classic radio", i.e. amateur modes and DRM, on Windows and Linux PC (it will run on the Raspberry PI 2 (3) though), and some simple software for viewing spectra also on Windows and Linux PC.

Receiving DAB Receiving DAB-2 Fm Reception Shortwave Radio Spectrum viewer

The pictures show (from left to right) screenshots of the use of the major components of the set

  1. the sdr-j-DAB software in operation with the SDRplay,
  2. the DAB-rpi software in operation with the AIRspy,
  3. the WFM software, running under Windows, using the Extio interface of the SDRplay,
  4. the SW software, when receiving a DRM transmission, using the SDRplay (remote), and
  5. the Spectrumviewer software using the AIRspy to look at the spectrum of a DAB transmission.

The software is written in C++, and the Qt framework for the GUI is used, while many libraries available through a GPL are used (recently, as an exercise in programming a - limited - version of the DAB-rpi software is also encoded in the Ada programming language using gtk for a - very simple - interface).
In the current version some errors were fixed, and the software is compiled against the most recent libraries for the devices (1.95 for the SDRplay, 1.08 for the AIRspy). The software will probably not work with versions of the SDRplay library before 1.95.
Furthermore, the common programs (i.e. all but the SW software) are now equipped with tooltips, where the function of a button, slider or other widget can be viewed by moving the cursor over the widget.

Supported devices.

All programs provide direct support - if so configured - for using common DABsticks (using the RT2832 chipset) and the SDRplay as input device. The DAB, WFM and Spectrumviewer programs provide further direct support for the AIRspy (including the AIRspy mini) if so configured. The Windows versions of these programs are configured for DABsticks, SDRPlay and Extio-XXX DLL's, while the DAB, the WFM and the spectrumviewer programs are also configured for the AIRspy.
The "classic" radio can be configured for the SDRplay and DABsticks. Furthermore, under Linux there is - if so configured - direct support for the PMSDR and the elektor card while under Windows these - and other - devices are supported through Extio-XXX.dll's
Libraries (and dll's) can be found:
  1. for a DABstick, the rtlsdr library, to be obtained - with clear installation instructions - from the "www.osmocom.org site",
  2. for the SDRplay, the SDRplay library, to be obtained from the "www.sdrplay.com" site, with installation programs for Windows, Linux and the Raspberry PI,
  3. for the AIRspy, the AIRspy host tools site "https://github.com/airspy/host", also containing clear installation instructions.

Downloads.

For Windows, there is a single zipped folder containing the executables and relevant dll's for all programs. Download the Windows version of the DAB, WFM, Spectrumview and SW software in a zipped folder here . Note that, while a number of dll's is in the zipped files, the "basic ones" are supposed to be available elsewhere on your system. Note further that the libraries for the SDRplay - if you wish to use that - should be downloaded from the producer of the device.
The sources of the software can be downloaded from "https://github.com/JvanKatwijk/XXX" where XXX stands for the project. These projects also often contain up-to-date windows executables.

For more information on any of the programs, touch the appropriate label below.

DAB software.

There are two programs for DAB decoding, the "sdr-j-DAB" program that will run on a PC running Linux or Windows, and the "DAB-rpi" that will run on a PC with Linux or Windows as well as on an Raspberry PI 2 (3). While both programs share large parts of the implementation, the "DAB-rpi" program is implemented slightly differently to distribute the computational load over all 4 cores of the Raspberry PI 2 processor, and it has slightly less functionality in the handling of data.
The "sdr-j-DAB" program - if so configured - shows the spectrum of the signal, on the other hand, the "DAB-rpi" program can be configured to send the audio output to an IP port rather than to the local sound"card" (used by me to listen to DAB programs through the remotely controlled DAB-rpi).
In both programs the audio seems to be OK, data handling, however, is still immature. Unfortunately, since the DAB transmissions that can be received locally do not contain much of a data part, progress in developing the data handling is slow.

Receiving DAB Receiving DAB

Operation of the DAB-rpi program is straightforward. Selecting a device is controlled by the selector labelled "9" on the picture above. The control panel for the selected device will appear elsewhere on the screen. The Mode and Band are by default set to Mode 1, Band III where the transmissions in this part of the world happen, settings can be changed by buttons labelled 7 and 8. Actual running of the program will start after pressing the "START button labelled "1", quitting the program is by pressing the "QUIT" button (labelled "2").
When synchronized, the name of the ensemble (here "DAB+") will appear and names of the programs encoded within the ensemble will be displayed.
Selecting a particular station in the list is by clicking with the mouse on a program name ("Classic FM") in the picture. An output channel is selected using button labelled "6", in case the output is sent to an ip port, this selector is made invisible.
The resulting audio (48000 Hz, stereo) can be saved in a file by pressing button labelled "4". The input (with a samplerate of 2048000) can be saved into a ".sdr" file by pressing button labeled "5" (an ".sdr" file is basically a ".wav" file). Again, pressing the button for the second time after opening a file, will cause closing the file.
Pressing button labelled "3" will cause the software try to resynchronize.
The two numbers shown above the button panel show the "fine" frequency offset resp. the "coarse" frequency offset in Hz. When synchronized, the "coarse" frequency offset will remain constant, the "fine" frequency offset change continuously, depending on the reception conditions.
The numbers on the top line right indicate (from left to right)

  1. the identification of the ensemble received as hexadecimal number,
  2. the estimated SNR, an SNR of 15 and more is good,
  3. the success rate of FIC decoding, 100 is good,
  4. the success rate of AAC (or for "old" DAB mp2) decoding, 100 is good,
  5. the bitrate of the AAC output.
The bottom line might show a message from the selected program

Operation of the sdr-j-DAB program is similar. It has an additional button with which a scan over the channels in the selected band is started. The scan will stop at the channel where the software assumes there is a decent DAB signal.

The executables and dll's required for Windows can be downloaded as a zipped folder. The sources for the programs can be downloaded from
"https://github.com/JvanKatwijk/sdr-j-dab" and/or
Compilation requires a number of libraries to be installed (next to Qt5 and an appropriate C++ compiler toolchain) being installed

  1. the Qwt 6 library for compiling sdr-j-DAB. For the DAB-rpi version of the program this is not needed,
  2. the libsndfile library, used for handling wav files for in- and output,
  3. the fftw3 library,
  4. the libusb1 library,
  5. the zlib library (used in the data decoding),
  6. the faad library (used for decoding the AAC output,
  7. the portaudio library. While some Linux distributions provide a portaudio version 18, version 19 is needed.
Note that for compilation, the development files (i.e. the ".h" files) for all libraries should also be installed. Note further that, depending on the Linux distribution, the "INCLUDE_PATH" and the library path files might have to be modified in the configuration file
For Linux, the devices that are to be supported can be selected in the configuration file (use either cmake or qmake) by commenting out or uncommenting the appropriate lines in these files. As an example, the line CONFIG += airspy specifies that support for the AIRspy should be compiled in the executable.
Note that adding a device to the configuration requires the development file(s) of the supporting library for that device to be installed

New is a variant - currently only available for Linux - with a more "modern" GUI (thanks to Albrecht Lohoefener: For the latest release see "https://github.com/AlbrechtL/dab-rpi".)

GUI_3 GUI_3

This version, using qml for describing the GUI, will - when asked to do so - scan the band and collect all programs from all ensembles that can be received. The list is maintained between invocations of the program. Just click on a program to select it.

Generating the executable for this variant requires setting "CONFIG += gui_3", rather than the default specified "CONFIG += gui_1" in the "dab-rpi.pro" file. Note that is option is not available in the CmakeLists.txt file.

While the CMake configuration file assume Qt5, it is very well possible to compile for Qt4 using QMake. The DAB-rpi program does not require QWT and on my Raspberry PI 2 I am using Qt4 for it.
For compilation of the DAB-rpi on the Raspberry PI 2, the option "NO_SSE_AVAILABLE" should be uncommented, since the arm processor obviously does not support the SSE instructions.
The DAB-rpi software has an option to send the sound output (the PCM samples) to an IP port (20040) rather than to the sound card, an option that can be set or unset in the ".pro" file for use with qmake (comment or uncomment the line CONFIG += tcp-streamer). To support listening in that case, the sources contain a simple "listener" program, that program is precompiled for the Windows library (and named "soundClient"). I use the Raspberry PI headless through an SSH connection, where the Raspberry PI is on a different location than where my chair is.
The Windows executables are part of the windows distribution, that can be downloaded from as a zipped folder . The folder contains next to the executables most of the required libraries. The Windows versions are precompiled for the three mentioned input devices and for appropriate Extio libraries (some of them included in the zipped folder others to be obtained from the supplier of the device). The Extio_XXX.dll's were tested for the DABsticks and the SDRplay, it might or might not work with others.
The projects at github ("https://github.com/JvanKatwijk/dab-rpi", and "https://github.com/JvanKatwijk/sdr-j-dab" contain, next to the newest sources I am working on, sources for complete and recen releases as well as precompiled versions for Windows of these releases.

WFM Software.

The (Wideband)FM software consists of several instances of a simple FM receiver, configured to be used in conjunction with a given device, one of DABstick, SDRplay or AIRspy. The software will run under Windows (precompiled versions for all three mentioned devices as well as for Extio-XXX.dll's), and under Linux (both PC and Raspberry PI 2) configurable for any of these devices.
The program(s) support decoding of stations in the FM broadcast band in mono and stereo and support RDS decoding (obviously, the frequencies to be received depend on the radio device connected). A recent feature is that the FM software supports a program list, a list of known programs with their frequencies, which can be set and altered. Such a program list may contain selected program names with their associated frequency and is maintained between program invocations. Selecting a station from the list will set the program to the frequency for that station.

Fm Reception Fm Reception-2

Operation of the WFM receiver software is straightforward.
When the program is started, it will be idle until the button "START" is touched. The frequency can be selected by pressing the "Freq" button: a separate window will show a keyboard (see the picture) The frequency then can be specified in mHz or in kHz: after pressing the digits of the number, touch either the "mHz" or the "kHz" button to acknowledge and have the frequency sent to the WFM-rpi program.
The button labelled "default" on the top row is the selector for the audio device. The selection depends on the soundcard on the system. The button labelled "fm4decoder" allows selection of an FM demodulator, 5 different approaches to FM demodulation are implemented, the "type" of the decoder show on the field to the right of the selector (the one shown is apparently the pll based one).
The button labelled "rds on" is the selector for the rds "on" or "off" the coloured field indicates the successful decoding of the rds signal, "green" indicates that the software thinks to be able to decode the signal, "red" that is doesn't. The 4 buttons on that row to the right are
  1. stereo or mono selection,
  2. selection for channel out: mono, stereo, left, right,
  3. de-emphasis selection,
  4. lowpass filter selection.
Further selectors are the "squelch" and the selectors f-, etc. With the latter one may step through the frequencies (steps are 100 kHz) either manual (the buttons f- and f+), or automatic, the buttons fc+ and fc1.

Finally, with the button "FS", one may save the current frequency setting and bind a name to it.

The sources are to be found on
"https://github.com/JvanKatwijk/wfm-rpi".
The precompiled Windows executables are - together with the DAB software - to be found as a zipped folder.
When compiling under Linux, first, the device or devices for which it is meant is to be selected in the configuration file (either qmake or cmake, the zipped Windows folder contains 4 precompiled versions, one for each of the mentioned devices and one for use with Extio-XXX dll's).
When compiling one needs, next to the C++ compiler and Qt (either 4 or 5)

  1. the library (and development files) for the selected device (see the section on DAB and the libusb1 library,
  2. the portaudio library (and development files) (see the section on DAB),
  3. the libsndfile and libsamplerate libraries and the accompanying development files,
  4. the fftw3 library and development files.

Also new is that - as with the DAB-rpi - the WFM-rpi software - when configured to do so - sends its output to port 20040 - for remote listening (again, my device is not in the same room where I normally stay). The same "listener", as for the dab-rpi program, i.e. soundClient program can be used for listening.

The more general sdr-j-fm software is also still available. As can be seen from the picture the GUI contains more elements, such as a spectrum.

Fm Reception-3

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

SW software.

The SW software aims to be the SDR equivalent of a classical SW radio. It originated as a small package for shortwave listening with the Elektor SDR card from 2007 and it evolved into the current program. The program supports a number of input devices and nearly a dozen decoders. I use it to listen to amateur bands, to psk, rtty and usb and lsb transmissions and - occasionally - to listen to RRI, sometimes to radio Nigeria and - depending on the conditions - to the DRM transmission of Bangalore. i.e. the few remaining DRM transmissions.

The SDRplay and DABstick are directly spported devices, both in the Linux and the Windows version. The SDRplay supports frequency selection from app 10 kHz and up and is used to listen to short wave. For DABsticks, there are libraries with which a decent reception from 12mHz up is possible.
Under Linux, there is also direct support for the Elad-s1 (I don't own one, but a friend does). Furthermore, under Linux support for the Elektor card and the pmSDR can be compiled in (both devices need a cardreader for data input), or just a cardreader without device can be used.
Finally, there is support for receiving the raw antenna data using the WiFi, a simple server is part of the software, supporting the SDRplay, and sending the (decimated) data to an IP port. The receiver site is equipped with a scall client program as one of the "device-handlers".

In the precompiled Windows version, direct support for the Elektor card and for the pmSDR disappeared since using the ExtIO-XXX dll for these devices is an excellent alternative. Handling of devices for which a Winrad compatible dll exist is now extended with support for fast devices, i.e. devices such as DABsticks and SDRplay that deliver their data through the usb. I tested it with the ExtIO-XXX dll's for the SDRplay and DABsticks.

Since the decoders in the software are all "small-band" (for CW and PSK I normally set the width of the decoder screen to 6kHz, and select the preconfigured USB bandwidth of 2.5 kHz, while for DRM a bandwidth of 12kHz is really needed), the sample rate of the data from the fast devices such as the SDRplay, is reduced to 96000 or 48000 (it can be set to different values in the configuration file though, but 96000 samples/second leads to a spectrum-width of 96000 Hz which functions well on a common laptop screen).

My personal use is listening to SW using the aforementioned simple "server", running on the Raspberry PI 2 in the neighbourhood of a loop antenna with a simple amplifier on the attick, that provides the (decimated) sample-stream from the SDRplay to the home WiFi, allowing me to listen to shortwave radio from within the "lazy chair". The sources for the software, implementing a simple server for the SDRplay are part of the SW sources. The sources for the client are also part of the software tree.

SW Reception Setting paths

The screen depicted in first picture shows this "normal" way of working. The window of the SW program in the middle, with at the left the widget for the selected device, which is "remote SDRplay". The widget of the SDRplay server - which runs through an SSH connection on my Raspberry - is on the right.

The various pieces of software for interfacing to a device as well as the various decoder are implemented as plugins. Adding or deleting a device or a decoder is simple, just add the plugin code to the appropriate directory, and does not require recompilation of the main program.

On start up, the main program will look into an ".ini" file for the path-names that specify where to find these plugins. If no ".ini" file exists as yet, defaults "input-plugins" and "decoder-plugins" are chosen. To set up the paths for the decoder plugins and the input plugins in an ".ini" file, a small configuration utility ("configure") is included. The second picture above shows the widget for this configurator. It merely asks for the paths names and creates (or updates) an ".ini" file in the home directory of the user.

A variety of decoders is implemented
  1. A decoder for the common analog modes, i.e. AM, USB, LSB and FM,
  2. An rtty decoder,
  3. A psk decoder,
  4. A CW decoder,
  5. A weather-fax decoder,
  6. An AMTOR (Navtex) decoder,
  7. An MFSK decoder,
  8. A DRM decoder (experimental) for DRM broadcast transmissions,
  9. A Hell decoder,
  10. and some others that are under development.
On the 7 mHz band there are plenty of CW and psk calls. The 3855 Khz frequency is often used by me to receive weatherfaxes. There are not a lot of DRM transmissions, here, we normally receive the Radio Rumenia International, the DRM program of the Indian radio and radio Nigeria.

For use under Windows, a pre-compiled version of the sw-receiver software is here available in the same zipped folder as for the other programs. That folder contains plugins for input and decoders in subdirectories input-plugins resp. decoder-plugins and it contains many of the required DLL's. Using the SDRplay as input device does require installing the software from the producer of the device.
For use under Linux, one might want to download the sources from "https://github.com/JvanKatwijk/sdr-j-sw". The source tree contains subdirectories for the configurator, for the sw software proper and for the "server". The tree for the SW software itself contains subdirectories for the plugins, implementing the decoders and plugins implementing the support for input devices.
For compiling the main program one needs - obviously - the C++ compiler, the Qt libraries and development files and the QWT library and development files. Furthermore, the fftw3 library, the portaudio library, the libsndfile and libsamplerate libraries are also required.

For compiling the plugins (to be found in the subdirectory "plugins/input" and "plugins/decoders") one might need more libraries, depending on the plugin. E.g. for the rtlsdr as device one needs the rtlsdr library and libusb. Have a look at the configuration file. In the subdirectories for the input and for the decoder there is a small script to generate the plugins

Note that for the drm decoder plugin, one needs an adapted version of the "faad" library, a version compiled for DRM. The internet is full of examples on how to do that (./configure --with-DRM). Note further that, depending on the selected estimator, one might need additionally the "armadillo" library is needed (for some complex matrix operations), the default setting is such that armadillo is not needed.

The Windows version of the plugin for DRM has the correct library compiled in.

Spectrumviewer.

The spectrumviewer software is a simple program, it just shows the spectrum, up to a selected bandwidth, determined by the selected samplerate. The spectrumviewer software can be configured with the DABstick, the SDRplay, the AIRspy, the sw-elad-s1 and a soundcard.

Spectrum viewer

Operation of the spectrumviewer software is straightforward. The selector, marked "airspy" on the picture is used to select a device. 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 selector "viewmode" makes selection between spectrum or waterfall mode possible, touching the button "freeze" will - as the name suggests freeze - the spectrum shown.
The "set scan" selector starts (or stops) scanning though the frequencies The 4 selectors to the right 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 here together with the DAB and WFM software. The configuration of the pre-compiled version contains, next to the DABstick, the AIRspy, the SDRPlay and the soundcard, a handler for devices supported by an Extio-XXX dll.
The sources, for compilation under Linux, are in "https://github.com/JvanKatwijk/sdr-j-spectrumviewer".
For compilation, one needs, next to the C++ compiler and the Qt and Qwt libraries,

  1. the fftw3 library and its development files,
  2. the libraries for the devices included in the configuration,

Documentation.

Since the interest is more in programming than in writing manuals (that no one ever reads), the manuals are not up-to-date. There is a manual for the dab receiver, for the wfm software, and one for the sw-receiver (note that the latter manual still refers to the previous version where the control box for the selected device is on the GUI and where there is no mention of the DRM decoder). However, in the version distributed now, the GUI's are extended with tooltips, telling the function of the various elements of the GUI.

An informal description of the synchronization in the DRM decode is given in this description the document continues to be a draft, but contains quite some information on issues with decoding digital signals.

DAB software in Ada

As an exercise in programming, basically to renew my knowledge of the language after a period of 20 years, a - slightly limited - version of the DAB-rpi program was rewritten in Ada. For implementing the - simplified - GUI the Ada binding to gtk, gtkAda, is used.
The resulting program runs pretty well on my laptop and it was a nice and interesting exercise to create it.
I did not manage (yet) to compile the Ada sources on the Raspberry PI 2 and did not attempt to generate a Windows executable.
The current version has support for the input device "compiled in", i.e. the device is determined by the configuration settings (see the file "main.adb" for instructions how to select a configuration for one of the other supported devices). The Mode and Band can be selected though in the command line (defaults are Mode 1 and Band III).
The audio output is sent to a "default" device, no selection for other output devices is possible (yet). Contrary to the very first version, the current version heavily depends on the use of generics.

The sources were compiled using the gnat compiler and gtkAda3. The Ada sources bind to C libraries for fftw, libsndfile, libfaad, portaudio and - obviously - to the libraries for the device.

Receiving DAB

The sources are available at "https://github.com/JvanKatwijk/ada-dab".

To make life easy, a compressed 8G image of a Debian Jessie distro for the Raspberry PI 2 with both the DAB-rpi and WFM-rpi software installed (sources, required libraries and executables) is available on request. Apart from the additions needed to compile and run the DAB-rpi and WFM programs, the distribution is clean.
Note, however, that this image will only run on an Raspberry PI 2, not on an Raspberry PI 3. Note further that different distributions for the Raspberry PI 2 sometimes support pretty old compilers. The g++ compiler in the Jessie distribution is a 4.XXX, while on the other hand the g++ compiler in the arch distribution (that is what I am normally using) on the Raspberry PI 2 is from the 6.XXX range.
The difference in performance is noticeable: while the average load on the 4 cores on the Raspberry PI 2 running the Arch distro is between 50 and 60 percent, the load on the cores on the same box running the Jessie distro is up to 85 to 90 percent.

Finally...

All software is being developed as a hobby project and is available under a GPL. It is - obviously - nice if this software is useful, but 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 the SDRplay and to Benjamin Vernoux for providing me the possibility to use the AIRSPY, both wonderful devices.
Suggestions and contributions (material and immaterial) are welcome.
Have Fun!!!

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