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
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