Digital Speech Decoder (DSD) rewritten as a C++ library
DSDcc is a complete rewrite from the original DSD (Digital Speech Decoder) project.
It is rewritten along the following lines:
stdin
/ stdout
to be integrated in a pipe command. There is no direct usage of audio devices nor fancy side reading from or writing to .wav
or .mbe
files.mbelib
usage is optional at compile time. Without mbelib
only the raw MBE samples can be extracted to be processed outside of DSDcc with the help of a hardware dongle for example thus lifting the possible copyright violations (See next)These points have been retained from the original:
mbelib
or upsampled to 48kS/sWhile DSDcc is intended to be patent-free, mbelib
that it uses describes functions that may be covered by one or more U.S. patents owned by DVSI Inc. The source code itself should not be infringing as it merely describes possible methods of implementation. Compiling or using mbelib
may infringe on patents rights in your jurisdiction and/or require licensing. It is unknown if DVSI will sell licenses for software that uses mbelib
.
If you are not comfortable with this just do not compile with mbelib
support and you will still be able to extract the MBE frames and process them outside DSDcc with the help of a hardware dongle for example (e.g. ThumbDV USB dongle). The provided binary dsdccx
can use such a dongle with SerialDV. See the Building section for details.
If you still want mbelib
support you have to use the -DUSE_MBELIB=ON
directive on the cmake
command line and of course you need to have mbelib
installed in your system.
These are a subset of the ones covered by the original DSD project plus other formats. A large part of the code was rewritten more noticeably the symbol timing and the DMR processing improving a lot from the original DSD. For now we have:
Next we may like to add NXDN exploiting similarities with the already implemented dPMR.
As usual with projects based on cmake create a build
directory at the root of the cloned repository and cd into it.
For mbelib
support you will need to specify the -DUSE_MBELIB=ON
directive on the cmake
command line and you will need to have mbelib installed in your system. If you use custom installation paths like /opt/install/mbelib
for example you will need to add the include and library locations to the cmake command line with these directives: -DLIBMBE_INCLUDE_DIR=/opt/install/mbelib/include -DLIBMBE_LIBRARY=/opt/install/mbelib/lib/libmbe.so
For DVSI AMBE3000 serial device support (e.g. ThumbDV) in the binary dsdccx
you will need to install SerialDV. Please refer to the Readme.md
in this package to install SerialDV. If you have SerialDV installed in a custom directory say /opt/install/serialdv
you will need to add the include and library locations to the cmake command line with these directives: -DLIBSERIALDV_INCLUDE_DIR=/opt/install/serialdv/include/serialdv -DLIBSERIALDV_LIBRARY=/opt/install/serialdv/lib/libserialdv.so
So the full cmake command with a custom installation directory and mbelib
support will look like: cmake -Wno-dev -DCMAKE_INSTALL_PREFIX=/opt/install/dsdcc -DUSE_MBELIB=ON -DLIBMBE_INCLUDE_DIR=/opt/install/mbelib/include -DLIBMBE_LIBRARY=/opt/install/mbelib/lib/libmbe.so ..
The full cmake command with a custom installation directory no mbelib
support and SerialDV support for the binary will look like: cmake -Wno-dev -DCMAKE_INSTALL_PREFIX=/opt/install/dsdcc -DLIBSERIALDV_INCLUDE_DIR=/opt/install/serialdv/include/serialdv -DLIBSERIALDV_LIBRARY=/opt/install/serialdv/lib/libserialdv.so
Then:
make
or make -j8
on a 8 CPU machinemake install
A binary dsdccx
is produced and gets installed in the bin
subdirectory of your installation directory. A typical usage is to pipe in the input from a UDP source of discriminator output samples with socat
and pipe out to sox
play
utility to produce some sound:
socat stdout udp-listen:9999 | /opt/install/dsdcc/bin/dsdccx -i - -fa -o - | play -q -t s16 -r 8k -c 1 -
You can also run the example files in the samples
directory. Please refer to the readme in this directory for instructions.
For more details refer to the online help with the -h
option: dsdccx -h
Since version 1.6 dsdccx has the capability of sending regularly the traffic status messages to a file using the -M
option. See messagefile.md for details.
⚠ (For use with serialDV) Since kernel 4.4.52 the default for FTDI devices (that is in the ftdi_sio kernel module) is not to set it as low latency. This results in the ThumbDV dongle not working anymore because its response is too slow to sustain the normal AMBE packets flow. The solution is to force low latency by changing the variable for your device (ex: /dev/ttyUSB0) as follows:
echo 1 | sudo tee /sys/bus/usb-serial/devices/ttyUSB0/latency_timer
or sudo setserial /dev/ttyUSB0 low_latency
DSDcc
namespaceDSDDecoder
object handles the core functions of synchronization and global orchestration of the decoding. It also hosts the options and state objects. It collaborates with specialized objects that have full access to the decoder public and private areas using the C++ friend
directive.DSDOpts
object handles the options configuring the behaviour of the decoderDSDState
object handles the run time data and data related to the current state of the decoderDSDSymbol
object is responsible for symbol and dibit processing. It receives a new sample with its pushSample()
method. It processes it and when enough samples have been receives it can produce a new symbol that it stores internally.DSDMBEDecoder
object is responsible of taking in AMBE frames and producing the final audio output at 8 kS/s. It is a wrapper around the mbelib
library. It also handles the optional upsampling of audio to 48 kS/s.DSDDMR
object is responsible of handling the processing of DMR frames. It uses the service of DSDMBEDecoder
to produce the final audio output.DSDdPMR
object is responsible of handling the processing of dPMR frames. It uses the service of DSDMBEDecoder
to produce the final audio output.DSDDstar
object is responsible of handling the processing of D-Star frames. It uses the service of DSDMBEDecoder
to produce the final audio output.DSDYSF
object is responsible of handling the processing of Yaesu System Fusion frames. It uses the service of DSDMBEDecoder
to produce the final audio output.Descramble
object contains static data and methods mainly used in the decoding of D-Star frames. It is based on Jonathan Naylor G4KLX code.DSDFilters
object as the name implies contains methods to perform various forms of DSP filtering.You can look at the source of the dsdccx
binary to get an idea. Basically it involves the following steps:
DSDDecoder
object (stack or heap)DSDDecoder
methods.mbelib
support:Of course this loop can be run in its own thread or remain synchronous with the calling application. Unlike with the original DSD you have the choice.