Primer: *nix P25 decoding with SDR

Status
Not open for further replies.

russinnes

Member
Joined
Jun 29, 2010
Messages
19
I thought I'd post this, as I have seen many people ask about various pieces of decoding P25 in *nix using an SDR. I will use DSD and Unitrunker in this example, but the applications are endless.
This will cover SDR (rtl_fm), DSD , and Unitrunker running under WINE. I know you can do this with a true receiver using an audio input, but that ties up an input and a requires a real receiver.
This is easily done with an $8 SDR.

Scenario: There are numerous p25 decoders, but piping audio between them can be a bit of a pain. Some users are running virtual machines for windows (to only use "virtual audio cables"), etc, etc. Here are a couple of options to keep it in the *nix environment.

#1: Using DSD with GQRX:

First things first: Get your SDR tuning bang on. The most user friendly way to do this is to use GQRX
-Open GQRX, under the audio tab, ensure it is streaming raw audio via UDP (default port is 7355). Click the computer icon beside it to start streaming audio packets over UDP.
-Center the frequency on the channel you wish to decode, get it as close as you can. Use your existing ppm correction on the reciever.
Second : DSD:
-Download and build DSD/IT++/MBElib (google if you are unsure)
-Install Socat via APT
-In a terminal, run the following:
socat stdout udp-listen:7355 | dsd -i - -o /dev/null
This will pipe the UDP raw audio into DSD via STDIN. You may/may not see DSD start printing P25 data. It's ok if its not.
Back to GQRX, slowly adjust your PPM 1 step at a time (and wait a few seconds) until you see data flowing through DSD. A difference of 1ppm will make it or break it.
Once you have this - write down the PPM setting somewhere, as we will use RTL_FM which uses far less CPU.

At this point, if you like using GQRX, you can just use it as the source. Alter your DSD command to suit for output to audio devices etc.
You may need to use padsp to direct the DSD audio output to a pulseaudio sink but you can google that on your own.

If you don't want to use GQRX and would rather just use rtl_fm, there are a few more steps. Remember we mainly used GQRX just to get the PPM tuning exact.
This will allow you to use Unitrunker as well under WINE without a real radio.

#2 rtl_fm:
-Install/compile it
-Install SoX (APT)
A bit of preamble: rtl_fm uses way less overhead than GQRX, but has no GUI interface. rtl_fm is also happiest at an output rate of 22.5KHz.
Although it can resample, it is not very good at it, so we use SoX instead to resample prior to sending the raw audio to DSD.
DSD takes raw audio in at 48KHz.

The following command will get you up and running:
rtl_fm -f <your freq> -p <your PPM from above> -s 22050 -g 42 - | sox -traw -r22050 -es -L -b16 -c1 -V1 -v 2 - -traw -es -L -b16 -c1 -r48000 - | dsd -i - -o /dev/null

Basically, rtl_fm tunes the frequency, output at 22050. Sox converts it (16b Signed Int, LE) to 48000hz, and pipes it to DSD.
Running this with your parameters, you should see DSD streaming P25 data.

#3 Unitrunker:
Similar to above, RTL_FM can tune it, SoX can resample it. Rather than pipe it to DSD, we can send it to an actual audio sink/source
This is handy if your program (ie: Unitrunker in WINE) can only take audio as an input. I know under windows you can use an SDR, but not so much in WINE.

-Install ALSA loopback audio (sudo modprobe snd-aloop). This will give you a virtual audio device which you can do a ton with.
-"aplay -l" will list the audio devices, note the loopback adapter (plughw1,1 or similar)

Now that we have a new audio device, we can pipe audio to it:

rtl_fm -f <your freq> -p <your PPM from above> -s 22050 -g 42 - | sox -traw -r22050 -es -L -b16 -c1 -V1 -v 2 - -traw -es -L -b16 -c1 -r48000 - | aplay -t raw -r 48000 -c 1 -f S16_LE -D plughw:x,y

-At this point you have audio on the loopback audio device. You can select this device in Unitrunker running in WINE, or use the wine soundmapper.
-I recommend using pavucontrol (pulse audio vol control) to select the audio source for wine. You can select Loopback Audio/ Monitor of Loopback Audio. As with any audio input, you will have to mess with the levels a little.

If you want to use GQRX with Unitrunker, you can set the audio output in GQRX to the Loopback device after installing snd-aloop and go from there as well.

I've had success with all of these methods. If anyone else has more to add or has used similar methods, please post them :)
 

br0adband

Member
Joined
Apr 8, 2005
Messages
1,567
Location
Springfield MO
You could also install and set up OP25 to monitor P25 Phase I and II trunked systems (it won't do conventional monitoring as I understand it, only trunked systems). It works remarkably well too, at least in my rather limited experience of using it but at least it's an option. Very CPU and resource intensive, however, so on older hardware the solution presented above using DSD (not DSD+ which is a Windows only application) is more efficient.

OP25 is a "dedicated" application meaning it doesn't do anything else - it's not a typical SDR application like GQRX is and doesn't allow you to just monitor anything at all anytime, it's purpose is very narrow and defined but for what it offers and does, it's actually a great application. If you have conventional aka single frequency non-trunked comms using P25 Phase I (which DSD can decode quite well) or Phase II (which DSD cannot decode at all) then OP25 isn't a workable solution, but for trunked P25 Phase I or Phase II systems it could be just what someone needs on the *nix platform.
 

Dygear

Member
Joined
Nov 18, 2010
Messages
74
Location
Levittown, NY
The quickest way to install OP25 on Linux is pybombs. They allow you to install any thing that's Out of Tree (OOT) from that interface so it's very powerful.

So, I should probably explain what OOT (Out of Tree) means. Anything that's not built by GNURadio, anything where GNURadio Devs don't have direct control of are directly responsible for the source code of a block or module is considered out of tree. These are third party authors who are adding items to the GNURadio. You can add these out of tree modules to GNURadio to increase it's functionality.
 
Last edited:

natedawg1604

Member
Premium Subscriber
Joined
Jun 29, 2013
Messages
2,726
Location
Colorado
OP-25 is basically amazing. The sound quality is awesome, and best of all, it fully supports simulcast systems out of the box. I love it.
 

KA1RBI

Member
Joined
Aug 15, 2008
Messages
799
Location
Portage Escarpment
You could also install and set up OP25 to monitor P25 Phase I and II trunked systems (it won't do conventional monitoring as I understand it, <snip>

OP25 will tune and receive conventional P25 (FDMA) channels without needing or using a trunking control channel. To do this, run the scope.py program in "manual" mode; that is, run it without the -T parameter. In manual mode the frequency to be tuned to can be entered on the command line (using -f), or there is a box (in the lower left hand corner of the display). Select the box by clicking on it, then enter the desired frequency (must be entered in Hz !) to change frequencies without needing to exit the program. Of course, the PPM adjustment must already have been done prior to this. The manual mode also allows you to select and tune individual voice channels that are part of a trunked system, just as in a regular scanner (P25 Phase I only, not phase II).

73

Max

p.s. thanks for the kind words about OP25
 

br0adband

Member
Joined
Apr 8, 2005
Messages
1,567
Location
Springfield MO
Well duh, I had forgotten about the -T parameter, it's been quite some time since I've actually used OP25 but I still consider it to be a fantastic tool in our toolkits, certainly, and you're welcome. Might have to reinstall Linux Mint and redo the OP25 install as well, I saved the config files I had created so I'd guess they'll still work exactly the same.
 
Status
Not open for further replies.
Top