RadioReference on Facebook   RadioReference on Twitter   RadioReference Blog
 

Go Back   The RadioReference.com Forums > Computer Aided Monitoring and Programming > Software Defined Radio


Software Defined Radio - A forum for general discussion of software defined radio (SDR) receiver equipment.

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #421 (permalink)  
Old 07-01-2018, 2:48 AM
Member
  Premium Subscriber
Premium Subscriber
 
Join Date: Mar 2007
Location: Talbot Co, MD
Posts: 994
Default

Quote:
Originally Posted by atms169 View Post
I'm a ham radio operator and I'm trying to figure out how to use rx.py output to Wireshark (OP25). I want to see the packet stream.

I am also using a Raspberry Pi3.

So far, I can get the rx.py to run but can't figure out how to monitor the packets in Wireshark.

Any help apprecaited
The wireshark patches are out of date and not being actively developed at present. You can however see some protocol by turning the log level up (-v 10).
Reply With Quote
Sponsored links
  #422 (permalink)  
Old 07-01-2018, 8:25 AM
Newbie
  Premium Subscriber
Premium Subscriber
 
Join Date: May 2011
Posts: 4
Default

Hello. This is awesome.

I just got my Pi 3B+ set up. One of the things I prefer to do is to stream audio over mp3 to my phone. I'm sharing how I am doing this here in case it helps someone and maybe someone can suggest a simpler method for doing this.

How I stream mp3 audio from a Pi with other (non-SDR) radios.
- add a USB sound card to the Pi
- connect the audio out of the radio to the input of the sound card
- use VLC to encode the mp3 and serve the stream.

The VLC stream can be played directly by the phone in a browser or with the VLC client on the phone. With the VLC client you can adjust the latency and keep it low even streaming over the internet.

For op25 I have added a USB sound card (Behringer UCA222) and I send the decoded audio out of this device and then wrap it back into the inputs with an RCA cable physically connecting the outputs to the inputs.

For sending the audio out, the -U command is causing heavy stuttering and is completely unusable. This was also the case with the default sound card on the Pi (the headphone jack). So instead I am using netcat | aplay which works OK for either the headphone jack or the USB sound card.

./rx.py setup for netcat | aplay : -w -W 127.0.0.1 -u 56122

netcat | command for USB sound card: nc -kluvw 1 127.0.0.1 56122 | aplay -c1 -f S16_LE -r 8000 -D plughw:CARD=CODEC,DEV=0
(I used aplay -L to get the -D information)

vlc command: cvlc -vvv pulse://alsa_input.usb-Burr-Brown_from_TI_USB_Audio_CODEC-00.analog-stereo --sout '#transcode{acodec=mp3,ab=48,channels=1}:standard{ access=http,dst=0.0.0.0:1234/audio.mp3}'
(used pacmd list-sources to get the pulse:// information)

Listen to the mp3 stream use "Pi_IP_Address:1234/audio.mp3" in a browser, or for the VLC client you'll need to specify http:// in front of the string.

My questions:

- Is there a better way to send audio to the sound card other than netcat | aplay? Like I said -U stuttering heavily so I'm not sure if it handles underruns better than netcat | aplay. I assume I'm losing some audio because of underruns. The op25 documentation mentions an "audio.sh" but I cannot find it.

- It would be great to get rid of the sound card obviously. In the past I had lots of trouble streaming rtl_fm streams because of the squelch causing the stream data to stop. boatbod's posts seem to suggest this is being handled cleanly for op25 so there might be a way to send audio info to VLC without having to use extra hardware.

Thank you for all of the contributions and helpful discussions.
Reply With Quote
  #423 (permalink)  
Old 07-01-2018, 9:55 AM
Member
  Premium Subscriber
Premium Subscriber
 
Join Date: Mar 2007
Location: Talbot Co, MD
Posts: 994
Default

Quote:
Originally Posted by falcongsr View Post
Hello. This is awesome.

I just got my Pi 3B+ set up. One of the things I prefer to do is to stream audio over mp3 to my phone. I'm sharing how I am doing this here in case it helps someone and maybe someone can suggest a simpler method for doing this.

How I stream mp3 audio from a Pi with other (non-SDR) radios.
- add a USB sound card to the Pi
- connect the audio out of the radio to the input of the sound card
- use VLC to encode the mp3 and serve the stream.

The VLC stream can be played directly by the phone in a browser or with the VLC client on the phone. With the VLC client you can adjust the latency and keep it low even streaming over the internet.

For op25 I have added a USB sound card (Behringer UCA222) and I send the decoded audio out of this device and then wrap it back into the inputs with an RCA cable physically connecting the outputs to the inputs.

For sending the audio out, the -U command is causing heavy stuttering and is completely unusable. This was also the case with the default sound card on the Pi (the headphone jack). So instead I am using netcat | aplay which works OK for either the headphone jack or the USB sound card.

./rx.py setup for netcat | aplay : -w -W 127.0.0.1 -u 56122

netcat | command for USB sound card: nc -kluvw 1 127.0.0.1 56122 | aplay -c1 -f S16_LE -r 8000 -D plughw:CARD=CODEC,DEV=0
(I used aplay -L to get the -D information)

vlc command: cvlc -vvv pulse://alsa_input.usb-Burr-Brown_from_TI_USB_Audio_CODEC-00.analog-stereo --sout '#transcode{acodec=mp3,ab=48,channels=1}:standard{ access=http,dst=0.0.0.0:1234/audio.mp3}'
(used pacmd list-sources to get the pulse:// information)

Listen to the mp3 stream use "Pi_IP_Address:1234/audio.mp3" in a browser, or for the VLC client you'll need to specify http:// in front of the string.

My questions:

- Is there a better way to send audio to the sound card other than netcat | aplay? Like I said -U stuttering heavily so I'm not sure if it handles underruns better than netcat | aplay. I assume I'm losing some audio because of underruns. The op25 documentation mentions an "audio.sh" but I cannot find it.

- It would be great to get rid of the sound card obviously. In the past I had lots of trouble streaming rtl_fm streams because of the squelch causing the stream data to stop. boatbod's posts seem to suggest this is being handled cleanly for op25 so there might be a way to send audio info to VLC without having to use extra hardware.

Thank you for all of the contributions and helpful discussions.
Whose version of op25 are you using? It makes a difference to how the alsa buffers are assigned and used. Plenty of people use -U but there might be things you need to do to optimize the installation on a pi3. (Reduce the sample rate is the single biggest help)

Have you experimented with loopback driver "aloop"? Two sound cards is definitely not the way I'd attempt to set up a loopback...
Reply With Quote
  #424 (permalink)  
Old 07-01-2018, 11:45 AM
Newbie
  Premium Subscriber
Premium Subscriber
 
Join Date: May 2011
Posts: 4
Default

Quote:
Originally Posted by boatbod View Post
Whose version of op25 are you using? It makes a difference to how the alsa buffers are assigned and used. Plenty of people use -U but there might be things you need to do to optimize the installation on a pi3. (Reduce the sample rate is the single biggest help)



Have you experimented with loopback driver "aloop"? Two sound cards is definitely not the way I'd attempt to set up a loopback...
I'm running your boatbod fork. Do you mean rtl sample rate (-S) or audio rate?

I am not familiar with "aloop". I'll take a look at it also.

I'm only using the one sound card, sending audio to the output and then back to the input. I know there should be a way to do this in software to save the extra digital-analog-digital conversion step. I was just happy to get something working in less than a day.

Every other Pi-based project took weeks of tinkering and learning, but op25 I literally just threw it together and got it working thank you.
Reply With Quote
  #425 (permalink)  
Old 07-01-2018, 1:57 PM
Member
  Premium Subscriber
Premium Subscriber
 
Join Date: Mar 2007
Location: Talbot Co, MD
Posts: 994
Default

Quote:
Originally Posted by falcongsr View Post
I'm running your boatbod fork. Do you mean rtl sample rate (-S) or audio rate?

I am not familiar with "aloop". I'll take a look at it also.

I'm only using the one sound card, sending audio to the output and then back to the input. I know there should be a way to do this in software to save the extra digital-analog-digital conversion step. I was just happy to get something working in less than a day.

Every other Pi-based project took weeks of tinkering and learning, but op25 I literally just threw it together and got it working thank you.
The pi3 works best with smaller rf sample rate (-S 370000) because otherwise so much cpu gets eaten up transferring data over the usb bus. You'll have to experiment a bit to find the optimal value that allows for reliable decode with minimal overruns.

Aloop has to be configured and modloaded but it's great for connecting alsa devices for streaming solutions. I use it for darkice.
Reply With Quote
Sponsored links
  #426 (permalink)  
Old 07-02-2018, 12:16 AM
atms169's Avatar
Member
   
Join Date: Aug 2004
Location: Laredo, Texas
Posts: 50
Default

Quote:
Originally Posted by boatbod View Post
The wireshark patches are out of date and not being actively developed at present. You can however see some protocol by turning the log level up (-v 10).
So I see the packet stream but it does not look like the raw data. I can't decipher which is the HDU and LDU packets.
Reply With Quote
  #427 (permalink)  
Old 07-02-2018, 3:19 PM
Member
  Premium Subscriber
Premium Subscriber
 
Join Date: Mar 2007
Location: Talbot Co, MD
Posts: 994
Default

Quote:
Originally Posted by atms169 View Post
So I see the packet stream but it does not look like the raw data. I can't decipher which is the HDU and LDU packets.
It it is what it is.

If you need raw data you can hack the p25 frame assembler code but be warned the data is either in bitstream or dibit form and none of the error correction will have been done yet.

If you want p25 message data you have to dive into either p25p1_fdma or p25p2_tdma
Reply With Quote
  #428 (permalink)  
Old 07-03-2018, 12:31 AM
Member
  Premium Subscriber
Premium Subscriber
 
Join Date: Oct 2016
Location: Omaha, NE
Posts: 20
Default

What is the best way to find my tuning values like sampling rate, ppm, offset, etc...? It is harder for me to see the ppt graph in detail. It seems multiple different sets of values work. I have an RTL2832U dongle.

Sent from my SM-G965U using Tapatalk
Reply With Quote
  #429 (permalink)  
Old 07-03-2018, 7:35 AM
Member
  Premium Subscriber
Premium Subscriber
 
Join Date: Mar 2007
Location: Talbot Co, MD
Posts: 994
Default

Quote:
Originally Posted by NebraskaCoder View Post
What is the best way to find my tuning values like sampling rate, ppm, offset, etc...? It is harder for me to see the ppt graph in detail. It seems multiple different sets of values work. I have an RTL2832U dongle.

Sent from my SM-G965U using Tapatalk
Sample rate can start at 960000 as that value world on any rtl dongle. In practice you may need to lower it later to reduce audio stutter on the rpi3.

ppm (-q) is usually best derived iteratively. Use the fft plot and/or mixer plot to center the control channel signal peak by adjusting ppm up or down. On tcxo dongles you usually only need a ppm value of +/-1 our so.

finetune (-d) is set after ppm to center the mixer peak. If you need fine tune greater than about +/-400 you should consider adjusting ppm again.

ftt plot shows the big picture. When you can no longer see fine enough detail, switch to the mixer plot and aim to get the 'balance' value as close to 0 as possible.
Reply With Quote
  #430 (permalink)  
Old 07-03-2018, 7:45 AM
Member
  Premium Subscriber
Premium Subscriber
 
Join Date: Oct 2016
Location: Omaha, NE
Posts: 20
Default

This is a perfect write up. Thank you! I will give this a try later here.

Sent from my SM-G965U using Tapatalk
Reply With Quote
  #431 (permalink)  
Old 07-12-2018, 7:57 AM
Newbie
  Premium Subscriber
Premium Subscriber
 
Join Date: May 2011
Posts: 4
Default

Hello, is there a way to increase the audio gain output of the decoder? I have maxed out audio settings via pulse audio but I still have low volume.

One thing I can do is use sox to add gain to the output before playing it, but I was wondering if there are any controls in rx.py. I see the -g option but it doesn't seem to affect anything.

Thanks!
Reply With Quote
  #432 (permalink)  
Old 07-12-2018, 8:21 AM
Member
  Premium Subscriber
Premium Subscriber
 
Join Date: Mar 2007
Location: Talbot Co, MD
Posts: 994
Default

Quote:
Originally Posted by falcongsr View Post
Hello, is there a way to increase the audio gain output of the decoder? I have maxed out audio settings via pulse audio but I still have low volume.

One thing I can do is use sox to add gain to the output before playing it, but I was wondering if there are any controls in rx.py. I see the -g option but it doesn't seem to affect anything.

Thanks!
No, there are no audio gain controls within op25. You may be able to use alsamixer or pavctl to adjust the underlying gain within the os's sound drivers.
Reply With Quote
  #433 (permalink)  
Old 07-12-2018, 10:03 AM
Newbie
  Premium Subscriber
Premium Subscriber
 
Join Date: May 2011
Posts: 4
Default

Thank you for the quick reply boatbod. I never got aloop working (too busy at work right now), and I am running the op25 audio out to another system right now. I realized the USB sound card I am using has a headphone output with a cheap audio amp and a volume knob, so I will use that and I will have some more adjustable audio gain before sending the audio into my streaming system. (I already maxed out everything in pavucontrol/alsamixer.)

Eventually I will consolidate both of my audio streams onto one system and eliminate the physical sound card routing, but that's a project for another year.

Thanks again.

btw, is there a way to donate to the op25 project / your fork?
Reply With Quote
  #434 (permalink)  
Old 07-14-2018, 1:37 PM
Member
  Amateur Radio Operator
Amateur Radio
 
Join Date: Apr 2003
Location: Green Bay, WI
Posts: 102
Default

Quote:
Originally Posted by falcongsr View Post
btw, is there a way to donate to the op25 project / your fork?
Max has asked if anyone has a NXDN radio, as that would aide him in adding that support:

https://forums.radioreference.com/di...ml#post2960941

Else, osmocom is the foundation behind op25, and a few other interesting Open Source Mobile Communications projects including the RTL-SDR replacement driver:

Osmocom now accepts financial contributions - Miscellaneous Projects - Open Source Mobile Communications
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT -5. The time now is 6:23 AM.


Powered by vBulletin® Version 3.8.2
Copyright ©2000 - 2018, vBulletin Solutions, Inc.
All information here is Copyright 2012 by RadioReference.com LLC and Lindsay C. Blanton III.Ad Management by RedTyger
Copyright 2015 by RadioReference.com LLC Privacy Policy  |  Terms and Conditions