• Effective immediately we will be deleting, without notice, any negative threads or posts that deal with the use of encryption and streaming of scanner audio.

    We've noticed a huge increase in rants and negative posts that revolve around agencies going to encryption due to the broadcasting of scanner audio on the internet. It's now worn out and continues to be the same recycled rants. These rants hijack the threads and derail the conversation. They no longer have a place anywhere on this forum other than in the designated threads in the Rants forum in the Tavern.

    If you violate these guidelines your post will be deleted without notice and an infraction will be issued. We are not against discussion of this issue. You just need to do it in the right place. For example:
    https://forums.radioreference.com/rants/224104-official-thread-live-audio-feeds-scanners-wait-encryption.html

DSD for Raspberry Pi

Status
Not open for further replies.
Joined
Dec 6, 2012
Messages
9
#1
Hello everyone!

I decided to share my successes/failures so far in compiling DSD on the Raspbian Wheezy distribution for the Raspberry Pi.

---Setup---
- Raspberry Pi Model-B with 256MB of RAM.
- USB Microphone-in for discriminator audio-in (C-Media device: http://dx.com/p/virtual-5-1-surround-usb-2-0-external-sound-card-22472)
- Raspbian Wheezy distro, 2012-10-28-wheezy-raspbian
- 4GB SD card
- MbeLib 1.2.3 https://github.com/szechyjs/mbelib
- DSD 1.4.1 https://github.com/szechyjs/dsd (I am using the copy from here since other people have not been releasing their source code for their patches/forks)

---OS Install---
1. Download Raspbian "wheezy", (http://www.raspberrypi.org/downloads)
2. Install onto SD card using Win32DiskImager or dd (http://www.raspberrypi.org/downloads)
3. Connect RaspberryPi to an internet connection with DHCP
4. Attach Keyboard and USB sound card
5. Boot RaspberryPi and login with user: pi password: raspberry
6. Close the config tool that first comes up by hitting Esc.
7. Update/upgrade system utils. I used the command: "sudo apt-get update && sudo apt-get upgrade" (this will take a while)

If you can't get to this point, see: http://elinux.org/R-Pi_Troubleshooting

---DSD Install---
7. Type the following lines:
cd ~
mkdir dsd-src
cd dsd-src
wget -O mbelib.zip https://github.com/szechyjs/mbelib/archive/master.zip
wget -O dsd.zip https://github.com/szechyjs/dsd/archive/master.zip
unzip mbelib.zip
unzip dsd.zip
cd mbelib-master
sudo make
sudo make install
cd ..
cd dsd-master
sudo make
sudo make install
cd /
dsd -h


---Running DSD (Experimental)---
By default, Raspbian won't have a /dev/audio or /dev/dsp for DSD to use. You have to enable OSS emulation.

8. Enable OSS emulation: sudo modprobe snd-pcm-oss

Now there should be a /dev/dsp and /dev/dsp1 (as well as a /dev/audio and /dev/audio1). dsp1 is most likely your USB sound card.



10. Start DSD by typing: dsd -i /dev/dsp1 -o /dev/dsp1 [Options].
For example, I use: dsd -i /dev/dsp1 -o /dev/dsp1 -fp -v 1



Current issues:
-Whenever I try to use the RaspberryPi audio output (via HDMI or built-in output jack), DSD causes a kernel panic. So I just stick with the USB in/out (/dev/dsp1). I don't know if this is a USB stack issue, and OSS emulation issue, or what.

-Decoding is very slow and almost unusable. I have only tested ProVoice at this point, so I'll be tweaking the settings/DSD code to hopefully optimize it.

-You may want to try overclocking your RaspberryPi, see: http://lifehacker.com/5944867/overclock-a-raspberry-pi-without-voiding-your-warranty


I would like to hear everyone else's opinions and experiences concerning anything OSS/ALSA/DSD.

Cheers.
 
Joined
Mar 27, 2004
Messages
12
Location
rick10
#2
DSD on Rasberry PI

I also am trying to get DSD running on my Rasberry PI. I did the same as you show and wasn't getting much. I added the compiler options:
-march=armv6
-mfpu-vfp
-mfloat-abi=hard

This helped a little. Then I setup over clocking to 800Mhz.
I set the boot variable dwc_otg.speed=1 to lower the USB speed. Not sure this did anything.

I still don't really have decent decode? It may just be that the hardware is just not enough.
 
Joined
Dec 6, 2012
Messages
9
#3
I'm wondering if OSS emulation is causing a performance hit, and if implementing ALSA audio would improve the capture/playback?

I tried aplay/arecord to make sure the audio device could record and playback 48000 bit audio and it worked fine, no underruns.

I'm going to try determining which piece of code is struggling so bad.
 
Joined
Dec 6, 2012
Messages
9
#4
I have done some further tests with a Provoice IMB file. Right now it takes RPi DSD 17 seconds to decode 7 seconds worth of audio, versus an Ubuntu VM that takes < 1 second to decode the same audio.

Tried this with the gcc flags you mentioned as well.
 
Joined
Mar 27, 2004
Messages
12
Location
rick10
#5
I did some tests on my system and ran both my system and the pi at the same time and I agree the PI is way behind in decode. I am afraid the difference is so great we may not be able to fix it. I ran dsd with valgrind on my system to see where we could look to optimize but I think this is just beyond my capabilites. I am testing on Nexedge signal so my results will be different but the most time is predictably spent in the mbelib section for getframe. There is a lot of floating point math so someone that is good with C may be able to optimize some of it.
 
Joined
Dec 6, 2012
Messages
9
#6
I've started converting the library and DSD to use a 32-bit fixed-point numbering system. Once I've got all the bugs worked out I'll share my findings. I hope that I can maintain the level of precision required, and if the floating point tables are any indicator of that, then it should work. We'll see if its any faster though.

The fixed point library I'm using is based on this: Fixed Point Math Library for C | Free software downloads at SourceForge.net
 
Joined
Sep 19, 2002
Messages
5,278
Location
Toronto, Ontario
#7
I did some tests on my system and ran both my system and the pi at the same time and I agree the PI is way behind in decode. I am afraid the difference is so great we may not be able to fix it.
Of course it can be fixed. DSD wastes resources (RAM and CPU) just about everywhere in the code. You may want to start with the million cosine values that are calculated every second - a full one third of which aren't even used! That 33% reduction in CPU load alone almost gets you to your real time decoding goal.
 
Joined
Mar 27, 2004
Messages
12
Location
rick10
#9
DSD running on odroid-x2

I got DSD to run on a odroid-x2 platform which has a 1.6g clock rate. The boards are $135.00 so no where near as cheap as the raspberry pi.

I converted DSD to use pulseaudio so I didn't have to worry about the emulation and that does seem to save some cpu cycles on the pulseaudio server. I guess the next step is to see if I can make it work on android with all these smart phones out there that would be a cheap and packaged way to run DSD.
 

psointu

Member
Premium Subscriber
Joined
Nov 3, 2009
Messages
7
Location
oxford,ma
#10
raspberry pi and dsd update

as pi's firmware, raspbian, mbelib, and dsd have all been updated in the months since the original post, i decided to try this myself using a raspberry pi "b", rs pro-2048 w/discriminator tap, homemade patch cable and logitech usb dongle (i've used the scanner, cable and dongle for several years with unitrunker running on windows 7).

installed from 2013-07-26-wheezy-raspbian.img and did all the usual sysadmin tasks such as updating packages and firmware, etc., etc., then did the following:

sudo apt-get install cmake
cd ~
mkdir dsd-src
cd dsd-src
wget -O mbelib.zip https://github.com/szechyjs/mbelib/archive/master.zip
wget -O dsd.zip https://github.com/szechyjs/dsd/archive/master.zip
unzip mbelib.zip
unzip dsd.zip
rm *.zip
cd mbelib-master
mkdir build
cd build
cmake ..
make
sudo make install
sudo ldconfig /usr/local/lib
cd ~/dsd-src/dsd-master
mkdir build
cd build
cmake ..
make
sudo make install
add snd-pcm-oss to /etc/modules
amixer cset numid=3 1
<reboot>

moved the dongle over to the pi and ...

for a brief few (10 or so) seconds i was getting informational output for a live p25 transmission after executing "dsd -i /dev/dsp1 -n -v 1"

then ... nothing ... not a single bit of output for the past three days ... i've rebooted multiple times and quadruple checked everything i can think of that could help and even over-clocked ... suspecting an issue with the scanner/cable/dongle i moved them back over to the win7 pc, d/l'ed dsd106.exe and a cygwin1.dll and was immediately presented with textual information regarding live p25 transmissions along with dstar from my dvap/id51a combo.

not really sure what this all means ... it was working for a few seconds and has not since for many hours ... no idea what to look at to see if it can be persuaded to function again ... if anyone has any ideas or suggestions, i'm open.

-p
 

Markb

Member
Premium Subscriber
Joined
Feb 21, 2002
Messages
1,088
Location
Planet Earth
#11
I may be barking up the wrong tree here, but I was just reading this in the DSD source code on github:

" The best sound and minimum cpu usage is achieved with separate sound
cards for input and output
********

if you specify different input/output devices DSD will use 8k as the
output sample rate and the lack of resampling results in much better
audio as well as lower cpu consumption."

Could having a sound card on the output side be enough to get the Pi to decode?


Sent from my Samsung Galaxy S4 using Tapatalk
 
Joined
Sep 19, 2002
Messages
5,278
Location
Toronto, Ontario
#12
Could having a sound card on the output side be enough to get the Pi to decode?
No. Upsampling adds 80,000 floating point multiplies and 120,000 floating point divides every second, but that's a drop in the bucket compared to the one million cosine values calculated every second. If you want your Pi, implement a cosine lookup table.
 
Joined
Feb 24, 2001
Messages
65,126
Location
Virginia
#13
I noted the ram Raspberry Pi Model-B with 256MB of RAM.
from my notes of dsd the ram should be 512MB of Ram Min
and the cpu speed needs to be ??? Speed ??? because I don't know the
speed off hand I have the info written down some where
will post later
 
Joined
Sep 11, 2014
Messages
78
#14
Model B+

I have not conducted thorough research on running DSD on a Raspberry, however from earlier posts here is appears the issue has been insufficient RAM i.e. 256MB on the Pi.

Well, the new Model B+ which was released in July has 512MB.

Has anyone begun to look once more at Pi DSD decoding?
 

mancow

Member
Database Admin
Joined
Feb 19, 2003
Messages
5,838
Location
N.E. Kansas
#16
Would this be of any use or improvement?

https://www.sparkfun.com/products/13025

Powered by the Intel® Atom™ SoC dual-core CPU and including an integrated WiFi, Bluetooth LE, and a 70-pin connector to attach a veritable slew of shield-like “Blocks” which can be stacked on top of each other. It’s no wonder how this little guy is lowering the barrier of entry on the world of electronics!

The Intel® Edison packs a robust set of features into its small size, delivering great performance, durability, and a broad spectrum of I/O and software support.
 

Forts

Mentor
Database Admin
Joined
Dec 19, 2002
Messages
5,520
Location
Ontario, Canada
#18
Odd... I can run DSD+ on my atom powered netbook with perfect decoding and it barely breaks a sweat.

Sent from my SGH-I747M using Tapatalk
 
Joined
Dec 19, 2005
Messages
764
#19
- Odd... I can run DSD+ on my atom powered netbook with perfect decoding and it barely breaks a sweat.

Same for me. I did find though that the quality/sampling rate of the soundcard can make a massive difference
 
Status
Not open for further replies.
Top