DSD for Raspberry Pi

Status
Not open for further replies.

cg

Member
Premium Subscriber
Joined
Dec 13, 2000
Messages
4,574
Location
Connecticut
Pi is not exclusive to Linux but I did say a Pi 2 so I guess that is off topic as well.:roll:
Not confused, moving on.

chris
 

clemfm

Member
Joined
Sep 11, 2014
Messages
78
I have finally built DSD on my Pi 2b+ and it 'appears' to be working, albeit barely:

An error occured while using the portaudio input stream
Error number: -9981
Error message: Input overflowed
Sync: -X2-TDMA mod: C4FM inlvl: 19% src: 0 tg: 0 slot0 [SLOT1] VOICE e:========R====R===E====R=====R===================R=====R====R
An error occured while using the portaudio input stream
Error number: -9981
Error message: Input overflowed

I 'simply' have scrolling screens with the above intermittently breaking the endless 9981 errors.

Any thoughts?
 
Last edited:

clemfm

Member
Joined
Sep 11, 2014
Messages
78
... I'd recommend the iMic or the Strtech 96khz sampling rate USB sound cards. They're actually quite small and light. I can't see how a Pi with a power source wound be lighter or smaller for portable use.

I am using the iMic, however I am not successfully decoding, yet:

An error occured while using the portaudio input stream
Error number: -9981
Error message: Input overflowed
Sync: -X2-TDMA mod: C4FM inlvl: 19% src: 0 tg: 0 slot0 [SLOT1] VOICE e:========R====R===E====R=====R===================R=====R====R
An error occured while using the portaudio input stream
Error number: -9981
Error message: Input overflowed
 
Last edited:

slicerwizard

Member
Joined
Sep 19, 2002
Messages
7,643
Location
Toronto, Ontario
I would guess that DSD isn't reading the audio samples fast enough, so they're continually piling up and being discarded. Sounds like the processor can't keep up with the million cosine calculations per second that DSD grinds through while synthesizing voice.
 

clemfm

Member
Joined
Sep 11, 2014
Messages
78
I would guess that DSD isn't reading the audio samples fast enough, so they're continually piling up and being discarded. Sounds like the processor can't keep up with the million cosine calculations per second that DSD grinds through while synthesizing voice.

That sounds like a reasonable guess. I will shut down various other services on the Pi and try once more. I am pushing the envelope here, as my Pi B+ is also running Darkice/icecast, with the goal of streaming the decoded target P25 signals.

If reducing the CPU load fails, I will likely order a Pi3:

"The 900MHz 32-bit quad-core ARM Cortex-A7 CPU complex has been replaced by a custom-hardened 1.2GHz 64-bit quad-core ARM Cortex-A53. Combining a 33% increase in clock speed with various architectural enhancements, this provides a 50-60% increase in performance in 32-bit mode versus Raspberry Pi 2, or roughly a factor of ten over the original Raspberry Pi."
https://www.raspberrypi.org/blog/raspberry-pi-3-on-sale/
 

clemfm

Member
Joined
Sep 11, 2014
Messages
78
I would guess that DSD isn't reading the audio samples fast enough, so they're continually piling up and being discarded. Sounds like the processor can't keep up with the million cosine calculations per second that DSD grinds through while synthesizing voice.

I shut Darkice and Icecast down and used the top command to check CPU utilization and I am only at 70%... so it appears that something else is not quite right...
 

clemfm

Member
Joined
Sep 11, 2014
Messages
78
It has a quad core processor, doesn't it? So at 70%, DSD could easily be maxing out a core and falling behind.

So, you are saying that DSD is a single-threaded application? I suspect that is not the case, however I will do some research...
 

clemfm

Member
Joined
Sep 11, 2014
Messages
78
I've found this (from a closed thread):

"Here are some audio samples for P25 Phase 1 and MoTDMA. These were generated from saved .imb and .amb files with the -u 16 and -w options so it is output at the natvie 8k sample rate. Unfortunately version 1.0.3 was missing the code to write to wav files when playing from saved mbe files, but that will be fixed in the next bugfix release. Watch out for the noise burst at the end of the tdma clips.

dsdsamles.zip Download

The P25 Phase 1 audio is better than the MoTDMA. I'm not sure if this reflects the actual difference between the codecs or if it is due to bugs in the decoder.

If these sound alot better than what you are getting live, you are probably using a single sound device for in/out. That means the output has to be upsampled to 48k. The upsampling function in dsd is fast and low-latency (uses only 4 input samples) but does introduce some
distortion. A proper upsampling function would have noticalbe delay and use more cpu.

Many have complained about high cpu usage. While the synthsis algorithims are very cpu intensive, using cheap on-board audio devices can also have a massive impact on cpu usage
and/or error levels. That is because they are very inefficient with cpu interrupts and do most or all of the audio processing in the main cpu. Some onboard devices even upsample native 8k audio to 48k with a very nasty upsampling algorithim.

If at all possible use real hardware based sound cards/dongles. If you have two you can tell dsd to use a difference device for in and out (-i /dev/audio -o /dev/audio1 for example). This will enable native 8k audio out in live scanner mode. dsd will always synthesize in 8k when outputting to wav files or when playing mbe data files.

If your system is tight on cpu power (if you have multiple cores you need to look at the core running dsd not the overall usage as it is single threaded) do not try to use -u values higher than about 5. The default is 3 which provides good unvoiced (noise) sounds with minimal cpu usage. Increasing values provide almost imperceptible improvement in quality with rapidly increasing cpu usage. That option is mainly there for when generating wav files."
http://forums.radioreference.com/vo...e/175853-digital-speech-decoder-mbelib-2.html

I am yet to find much else, whilst the P25 samples are no longer available.

Can anyone point me to further DSD/core utilization discussion, and/or some quality P25 WAV's?
 

clemfm

Member
Joined
Sep 11, 2014
Messages
78
It has a quad core processor, doesn't it? So at 70%, DSD could easily be maxing out a core and falling behind.

I have a few Pi's, I just checked and I am running DSD on a Pi 1 Model B+ which contains: a 700 MHz single-core ARM1176JZF-S.

So, if I am averaging 70% utilization on the single core, this is likely not the issue causing the errors?

Top (and option 1) reports:

top - 12:01:58 up 5 days, 14:30, 2 users, load average: 1.24, 1.23, 1.27
Tasks: 66 total, 3 running, 62 sleeping, 1 stopped, 0 zombie
%Cpu0 : 75.6 us, 15.6 sy, 0.0 ni, 0.7 id, 0.0 wa, 0.0 hi, 8.1 si, 0.0 st
KiB Mem: 445032 total, 302176 used, 142856 free, 126108 buffers
KiB Swap: 102396 total, 0 used, 102396 free, 101000 cached
 

slicerwizard

Member
Joined
Sep 19, 2002
Messages
7,643
Location
Toronto, Ontario
"you need to look at the core running dsd not the overall usage as it is single threaded"

There you go.

You can also look at the source code - there are no threads created anywhere; everything is done by the single main thread.
 

clemfm

Member
Joined
Sep 11, 2014
Messages
78
"you need to look at the core running dsd not the overall usage as it is single threaded"

There you go.

You can also look at the source code - there are no threads created anywhere; everything is done by the single main thread.

However, the Pi I am using is single cored and I am not exceeding 70% (see my previous post).
 

woodpecker

Member
Joined
Aug 7, 2005
Messages
729
However, the Pi I am using is single cored and I am not exceeding 70% (see my previous post).

Your load averages are over 1.00, it is overloaded, you are wasting your time trying to get the pi to decode with DSD it doesn't have the resources.
 

clemfm

Member
Joined
Sep 11, 2014
Messages
78
Your load averages are over 1.00, it is overloaded, you are wasting your time trying to get the pi to decode with DSD it doesn't have the resources.

Thank you for clarifying, i just did some reading and see what you mean.

I will order a quad core Pi 3 tomorrow and update this thread once I have completed testing.

I am not clear on whether DSD is a multithreaded app, however I suspect (hope) it is...
 

EricCottrell

Member
Premium Subscriber
Joined
Nov 8, 2002
Messages
2,413
Location
Boston, Ma
Hello,

I tried a Pi 3 and it still does not quite have the horsepower. It can decode data pretty good, but falls apart with voice.

DSD is a single thread app and there have been discussions previously about all the problems with the current DSD code,

73 Eric
 

slicerwizard

Member
Joined
Sep 19, 2002
Messages
7,643
Location
Toronto, Ontario
If the DSD maintainers implemented a cos lookup table, it might work on a Pi 3.

If not, they could split the voice synthesis / audio output to a separate thread. That thread could use two subthreads to process alternate voice frames. That would work on a Pi 3.
 

EricCottrell

Member
Premium Subscriber
Joined
Nov 8, 2002
Messages
2,413
Location
Boston, Ma
Hello,

I did some more experimenting with a RPi 3 using Ubuntu 15.10. I used the command line rather than the GUI. Raspbian uses Hardware Float for the original RPi through RPi 3. Ubuntu 15.10 also uses Hardware Float (ARMHF). So the code is already improved over using the Soft Float.

I get 100% load and bad decoding when I use mbelib. No Surprise.

When I use the NW Digital Radio ThumbDV instead, the load drops down to around 50%. Decoding improves, but is not totally clear. The problem is overruns on the audio input. Using /dev/dsp1 for input and /dev/audio for output improves things slightly, but the input overruns are still noticeable every second. Disabling the input filtering ( -l ) improves things to almost perfect, but there are still some input overruns.

So some more work is needed to improve the code.

73 Eric
 

kb9mwr

Member
Joined
Apr 8, 2003
Messages
263
Location
Green Bay, WI
There is a new C++ rewrite of dsd, the digital speech decoder, that can decode P25, DMR, D-Star etc. It's called dsdcc ( https://github.com/f4exb/dsdcc ) It also supports doing the decoding with a AMBE hardware dongle.

So I thought I'd try this again with a Raspberry Pi 2... but I run into endless problems with dsdcc and its output to the pi sound. I either get Cannot open plughw:0,0 or when I preceed with with sudo, Error writing to output and I get the same when I try /dev/audio.

I am sure it's something dumb on my part. Getting sound to work with Linux is a big headache now days.
 
Status
Not open for further replies.
Top