DAB, Digital Audio Broadcasting is gaining popularity. While in e.g, Norway the traditional FM broadcasting is already replaced by DAB, in other countries FM will be phased out and replaced by DAB or DAB+ in the next decade. Most countries provide for DAB+ transmissions, a few stay with DAB.
The SDR-J-DAB programs implement a pretty large part of the DAB(+) standard. They are implemented for use under Linux on x86_64 computers and the RPI 2, as well as under Windows: they are open source, available and large parts have been reused by others as well.
There is a variety of mature DAB decoding programs, two with, others without a GUI.
The two versions of the DAB software with GUI are shown. The one on the right, dabradio is a simple one and just to be used as listening device. The one on the left, called Qt-DAB, does have more features and displays.
Both programs support the SDRplay, the AIRspy and rtlsdr based DABsticks as input device. Furthermore, both versions support input from a file, either a "raw" file (".iq" or ".raw") as produced by e.g. osmocom tools or a "wav" file (named ".sdr") generated by the Qt-DAB program.
Furthermore, both programs support MOT handling from subchannels of audio services.
For both versions there exist a so-called AppImage, a "ready-to-run" image, one for x86_64 based Linux boxes and one for use with Raspbian Stretch on an Raspberry PI 2. For such an AppImage to run, one needs to have the device library of the device of choice to be installed (most modern distros do have them in the repositories), the AppImage itself contains all further dependencies.
For Windows, a "zip-file" is available, containing a zipped folder with the executables of these program and the required DLL's. The zip file and the AppImage for Qt are to be found at the "releases" section of the github repository for Qt-DAB. The AppImage for dabradio is to be found at the releases section of the github repository for dabradio.
Simplicity of use was the design choice in developing dabradio. While Qt-DAB tends to grow and get more and more features, dabradio is made by omitting lots of features, remaining just those to decode DAB audio services (both programs obviously share large parts of the code).
One of the simplifications of the dabradio program from Qt-DAB is device selection. If a device (one of the supported ones) is connected, the software will automatically open it when started. If no device is found, the software assumes that a file as input is to be selected and will present a file selection menu.
A second simplification is the availability of a scanning function to collect the names of all audio services in the channels in the "current" band (the GUI could have been simplified even further by omitting the channel selector).
Furthermore the "Quit" button disappeared, just closing the window will terminate the program.
The Mode and Band are set to default values (Mode 1 and VHF Band III), they can not be changed from the GUI. They can be set to a different value in a simple configuration file (".dabradio.ini" in the home directory).
The resulting GUI then has only 4 buttons/selectors on the GUI
The channel selector. With this selector one selects a channel in the current band. If the channel contains a DAB signal, the names of the audio services will show on the GUI. Selecting a service is just by clicking a name;
The audio out selector for selecting a channel on the sound card. Default is here "default";
The technical data selector. When touched, a widget will show technical data of the selected service. Touching the button again will cause that widget to disappear;
The Scan button.When touched the software will scan through all channels of the selected band and will show the names of all (audio) services detected in these channels. Touching a name of a service will cause the tuner to select the channel on which that service was detected and subsequently select the service.
Qt-DAB provides more features than dabradio. It provides selection of an input device, selection of a channel, selection of the Band, and selection of the Mode. It also supports - in limited way - handling of data services. It handles MOT data, and if TPEG data is selected it provides a server to enable clients to do whatever they want to do with the 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 input devices with an Extio plugin, 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.
Qt-DAB shows - if so configured -:
the spectrum of the received input, together with the constellation of the decoded data, as well as a measure of the deviation of the dots in the constellation from the average, an indication of the quality of the signal;
the impulse response, 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;
An (educated) guess on the main Id and the subId of the Transmitter Identification Information as - with most transmissions - transmitted in the signal null-period (at the bottom of the "Technical Data" Widget).
Qt-DAB also supports dumping the input in a ".wav" file format (the ".sdr" files). The resulting file can be processed by both Qt-DAB and dabradio. Furthermore, Qt-DAB supports dumping the audio output in a ".wav" file format.
On (normal) termination of the program, a number of settings (i.e. device selection, channel selection program selection) is stored in the ".ini" file, they are used to set sliders and selectors when starting the program a next time.
The ".ini" file (.qt-dab.ini) contains furthermore some configuration parameters that can be changed (the ".ini" file is to be found in the home directory).
Source to create a library version of the DAB handling software are available. They allow the creation of versions with a different GUI or no GUI at all (i.e. a pure command line version). The sources can be compiled into a shareable library, or the sources can be included in an application. To show examples of the use of this library, a number of sources for example programs is provided for (Each directory contains a CMakeLists.txt file that can be used to create an executable).
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;
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;
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;
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
Example 5 implements the functionality of example 2, with as addition the possibility of selecting the "next" service in the channel;
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.
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 the SDRplay as device is
./linux/dab-sdrplay-2 -M 1 -B "BAND III" -C 12C -P "Radio 4" -G 80 -A default
In this example Mode 1 is selected (which happens also to be the default one), VHF Band III is selected (which happens also 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 80 (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. Feel free tot adapt.
A java version of the software is also made. Functionality of the java implementation is roughly the same as that of the dabradio. The java implementation uses a number of native libraries for device handling, audio output, and for some resource consuming computations (e.g. FFT computations and viterbi decoding).
As with dabradio, device selection is automated, if a device is connected, an attempt is made to open it. If no external device can be opened, it is assumed that the user wants to use file input and a menu for file selection is shown.
Output device is the default device, no selection is (yet) possible.
The java GUI is therefore extremely simple, it provides a channel selector and a gain slider, only Mode 1 and VHF Band III are supported. The channel selector is hidden when reading, in that case the gain slider is not functioning either.
The sources for Qt-DAB are maintained on github.
The README in the repository contains a pretty extensive description of what libraries have to be installed and how to generate an executable. Furthermore, two AppImages are stored in the releases section, one for x86_64 based computers and one ARM based for running on an RPI2 under Stretch. Furthermore, the releases section contains a zipped windows folder , windows-bin.zip with executables and DLL's, ready to run under Windows.
The sources for dabradio are maintained on its own github repository.
The README contains -also here- a fairly extensive description of how to generate an executable. And here as well, the releases section contains two AppImages, one for x86_64 based computers and one ARM based for running on an RPI2 under Stretch. A Windows executable is contained in the zipped folder mention with Qt-DAB, newer executable - if any - are made part of the releases section.
The sources for dab-cmdline are also maintained on github .
Note that device handlers are not part of the library. The "example" programs manage the device handling, the library takes a reference to a class implementing the device handling functionality.
The Java sources are available on github
To run the software one does need some native language libraries, contact the author.
Development of SDR-J programs started with an attempt to get some sound out of a PC, using an Elektor SDR card (Elektor May 2007) as radio device, it evolved into the current set of programs.
The pictures show (from left to right) screenshots of
Software is developed under Linux, and can be (and is)
cross-compiled to Windows.
The precompiled (Windows) versions are compiled against
recent libraries for the devices (2.11 for the SDRplay, 1.08 for the AIRspy).
The software will probably
not work with versions of the SDRplay library before 2.05.
Furthermore, the programs are equipped with tooltips, where the function of a button, slider or other widget is shown after moving the cursor over the widget (further documentation is "slightly underdeveloped").
For Windows, the above mentioned zipped windows folder contains for each of these programs an executable. The DLL for the SDRplay has to be downloaded from www.sdrplay.com.
All sources are available on github.
The (Wideband)FM software contains a simple FM receiver, configured to be used in conjunction with a specified device, one of DABstick, SDRplay or AIRspy (depending on the configuration). The software runs under Windows (precompiled versions for all three mentioned devices as well as for Extio-XXX.dll's). The sources are to be found on its 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 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.
Operation of the WFM receiver software is straightforward, tooltips tell the function of the various buttons and sliders.
The more general sdr-j-fm software is also still available. As can be seen from the picture the GUI contains more elements, it shows e.g the spectrum of the incoming signal as well as the spectrum of the decoded signal.
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 the Windows executable is in the windows distribution, the sources can be downloaded from github .
For experimental purposes a simple command line based version of the FM software was created. The software sends it output to stdout, rather than to a soundcard. it can be used e.g. to see what is happening on the P2000 band on 169650 kHz.
sdrplay_radio -f 169650000 [-p3] |multimon-ng -a FLEX -t raw /dev/stdin
Of course one can use the program to listen to FM transmissions as well.
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 .
The SW software 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 the SDRplay as input device and implements half a dozen decoders. I use it to listen to amateur bands, to psk, rtty and usb and lsb transmissions and - occasionally - to listen to DRM DRM transmissions from RRI, sometimes to radio Nigeria and - depending on the conditions - to Bangalore. i.e. the few remaining DRM transmissions.
The inputrate of the SDRplay is set to just over 2M, and decimated (and filtered) to a rate of 96000. The front end will further filter and select a band with a width of 12K, a band of 12 K will be send to the selected decoder. (Different values can be set in the ".ini file).
Implemented decoders are:
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. 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.
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 station.
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 device. The library for the SDRplay can be downloaded from SDRplay.com.
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.
Note that for compiling the drm decoder, 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 AppImage and the Windows version, the latter part of the aforementioned zipped windows folder, both have the correct faad library for DRM reception compiled in.
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.
Operation of the spectrumviewer software is straightforward, tooltips tell the function of the various buttons and sliders.
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 available on the github repository for Qt-DAB .
The sources, for compilation under Linux, are in their own repository .
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 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.
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.
The full set of sources is available at the gitub repository.
Since the interest is more in programming than in writing manuals (that no one ever reads), the manuals are pretty much outdated. There is a manual for a predecessor of Qt-DAB, the dab receiver, for the wfm software, and one for a predecessor of the sw-radio-8 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 decoder is given in this description, the document continues to be a draft, but contains quite some information on issues with decoding the DRM signal.
A description - also informal - of the processing of DAB, as implemented in the Ada version is given here. This (draft) report describes in some detail - 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.
All software is being developed as a hobby project, and
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 for improving the programs are always welcome, but I do not work on a call-basis. Material contributions are - of course - very welcome.
Pijnacker, March 2018
Jan van Katwijk
Lazy Chair Computing