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: 1,140
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: 1,140
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: 1,140
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: 1,140
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: 43
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: 1,140
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: 43
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: 1,140
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: 106
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
  #435 (permalink)  
Old 07-28-2018, 5:03 PM
Member
  Audio Feed Provider
Audio Feed Provider
Amateur Radio Operator
Amateur Radio
 
Join Date: Nov 2011
Location: Quebec Canada
Posts: 35
Default Multi_RX.py

Hello, Trying to use multi_rx.py to receive 2 digital modes local ham repeaters; one on DStar at 144,950 MHz, and the other on C4FM Fusion at 147,120 MHz. Since they are 2,17 MHz apart, i figured they should be copied by a RTL-SDR dongle, which is capable of 2,4 MHz bandwidth. Don't know if this is possible, thought.

Using a json file:

{
"channels": [

{
"demod_type": "fsk4",
"destination": "udp://127.0.0.1:56122",
"excess_bw": 0.2,
"filter_type": "gmsk",
"frequency": 144950000,
"if_rate": 24000,
"name": "dstar",
"symbol_rate": 4800
},
{
"demod_type": "fsk4",
"destination": "udp://127.0.0.1:56124",
"excess_bw": 0.2,
"filter_type": "rrc",
"frequency": 147120000,
"if_rate": 24000,
"name": "ysf",
"symbol_rate": 4800
},
],
"devices": [
{
"args": "rtl:0",
"frequency": 146035000,
"gains": "lna:48",
"name": "rtl0",
"offset": 0,
"ppm": 60,
"rate": 1000000,
"tunable": false
}
]
}
_______________

I've set the rtl:0 value at 146,035 MHz, which is right in the middle of both repeaters.

When I try using the command line, i get this error message:

pi@raspberrypi:~/op25/op25/gr-op25_repeater/apps $ python multi_rx.py -c DIGITAL.json -v 9
linux; GNU C++ version 4.9.1; Boost_105500; UHD_003.007.003-0-unknown

Traceback (most recent call last):
File "multi_rx.py", line 216, in <module>
rx = rx_main()
File "multi_rx.py", line 203, in __init__
config = json.loads(open(options.config_file).read())
File "/usr/lib/python2.7/json/__init__.py", line 338, in loads
return _default_decoder.decode(s)
File "/usr/lib/python2.7/json/decoder.py", line 366, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "/usr/lib/python2.7/json/decoder.py", line 384, in raw_decode
raise ValueError("No JSON object could be decoded")
ValueError: No JSON object could be decoded
pi@raspberrypi:~/op25/op25/gr-op25_repeater/apps $
_______________

Is what I'm trying to do possible ? Any ideas ?

Thanks
Reply With Quote
  #436 (permalink)  
Old 07-28-2018, 5:24 PM
dseven's Avatar
Member
  Premium Subscriber
Premium Subscriber
Amateur Radio Operator
Amateur Radio
 
Join Date: Sep 2008
Location: SF Bay / Delta, CA
Posts: 286
Default

Quote:
Originally Posted by ve2vag View Post
Hello, Trying to use multi_rx.py to receive 2 digital modes local ham repeaters; one on DStar at 144,950 MHz, and the other on C4FM Fusion at 147,120 MHz. Since they are 2,17 MHz apart, i figured they should be copied by a RTL-SDR dongle, which is capable of 2,4 MHz bandwidth. Don't know if this is possible, thought.

Using a json file:

{
"channels": [

{
"demod_type": "fsk4",
"destination": "udp://127.0.0.1:56122",
"excess_bw": 0.2,
"filter_type": "gmsk",
"frequency": 144950000,
"if_rate": 24000,
"name": "dstar",
"symbol_rate": 4800
},
{
"demod_type": "fsk4",
"destination": "udp://127.0.0.1:56124",
"excess_bw": 0.2,
"filter_type": "rrc",
"frequency": 147120000,
"if_rate": 24000,
"name": "ysf",
"symbol_rate": 4800
},
],
"devices": [
{
"args": "rtl:0",
"frequency": 146035000,
"gains": "lna:48",
"name": "rtl0",
"offset": 0,
"ppm": 60,
"rate": 1000000,
"tunable": false
}
]
}
_______________

I've set the rtl:0 value at 146,035 MHz, which is right in the middle of both repeaters.

When I try using the command line, i get this error message:

pi@raspberrypi:~/op25/op25/gr-op25_repeater/apps $ python multi_rx.py -c DIGITAL.json -v 9
linux; GNU C++ version 4.9.1; Boost_105500; UHD_003.007.003-0-unknown

Traceback (most recent call last):
File "multi_rx.py", line 216, in <module>
rx = rx_main()
File "multi_rx.py", line 203, in __init__
config = json.loads(open(options.config_file).read())
File "/usr/lib/python2.7/json/__init__.py", line 338, in loads
return _default_decoder.decode(s)
File "/usr/lib/python2.7/json/decoder.py", line 366, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "/usr/lib/python2.7/json/decoder.py", line 384, in raw_decode
raise ValueError("No JSON object could be decoded")
ValueError: No JSON object could be decoded
pi@raspberrypi:~/op25/op25/gr-op25_repeater/apps $
_______________

Is what I'm trying to do possible ? Any ideas ?
The error is caused by the comma after the last item in the "channels" list (between the "}" and the "]") - that's not allowed in JSON

I haven't really tried multi-RX, so not sure if it works that way, but fixing that syntax error should get you closer.....

Last edited by dseven; 07-28-2018 at 5:29 PM..
Reply With Quote
  #437 (permalink)  
Old 07-28-2018, 6:03 PM
Member
  Audio Feed Provider
Audio Feed Provider
Amateur Radio Operator
Amateur Radio
 
Join Date: Nov 2011
Location: Quebec Canada
Posts: 35
Default

Thanks dseven, you nailed it !

Now, this is what I'm getting:

pi@raspberrypi:~/op25/op25/gr-op25_repeater/apps $ python multi_rx.py -c DIGITAL.json -v 9
linux; GNU C++ version 4.9.1; Boost_105500; UHD_003.007.003-0-unknown

device: {'gains': 'lna:48', 'args': 'rtl:0', 'tunable': False, 'rate': 1000000, 'frequency': 146035000, 'ppm': 60, 'offset': 0, 'name': 'rtl0'}
gr-osmosdr 0.1.3 (0.1.3) gnuradio 3.7.5
built-in source types: file osmosdr fcd rtl rtl_tcp uhd miri hackrf bladerf rfspace airspy
Using device #0 Realtek RTL2838UHIDIR SN: 00000001
Found Rafael Micro R820T tuner
Exact sample rate is: 1000000.026491 Hz
* * * Frequency 144950000 not within spectrum band of any device - ignoring!
* * * Frequency 147120000 not within spectrum band of any device - ignoring!
_________________________

Well, guess my intuition was wrong... I tought that since they were 2,17 MHz apart, it would be under the 2,4 MHz bandwidth limit the the RTL-SDR dongle has, seems I was wrong...

If I set the "frequency": 145400000, it seems to be OK with the 144950000, but it ignores the 147120000. HIgher than 145400000, it ignores both

My intention was to make this work at first, then set this up to stream at Broadcastify. Back to square one, I guess.
Reply With Quote
  #438 (permalink)  
Old 07-28-2018, 6:10 PM
dseven's Avatar
Member
  Premium Subscriber
Premium Subscriber
Amateur Radio Operator
Amateur Radio
 
Join Date: Sep 2008
Location: SF Bay / Delta, CA
Posts: 286
Default

If you want to try to cover 2.17MHz, you'll need to set "rate" to something higher than 1000000! Try 2400000 ....
Reply With Quote
  #439 (permalink)  
Old 07-28-2018, 6:41 PM
Member
  Audio Feed Provider
Audio Feed Provider
Amateur Radio Operator
Amateur Radio
 
Join Date: Nov 2011
Location: Quebec Canada
Posts: 35
Default

Quote:
Originally Posted by dseven View Post
If you want to try to cover 2.17MHz, you'll need to set "rate" to something higher than 1000000! Try 2400000 ....
Geez.... what a gross newbie error on my part ... Thanks dseven, works now!

Now, next goal would be to use multi_rx, and combine both signals to one stream.
I've checked Boatbod's instructions in his post about setting things up to stream to Broadcastify, but he uses tx.py, not multi_rx.py.

Guess a loopback audio device combining both streams could be used; anyway with my setup, I think only one signal would be decoded at a time, so combining both frequencies to one stream should be feasible ?

Thanks
Reply With Quote
  #440 (permalink)  
Old 07-29-2018, 6:19 AM
Member
  Premium Subscriber
Premium Subscriber
 
Join Date: Mar 2007
Location: Talbot Co, MD
Posts: 1,140
Default

Quote:
Originally Posted by ve2vag View Post
Geez.... what a gross newbie error on my part ... Thanks dseven, works now!

Now, next goal would be to use multi_rx, and combine both signals to one stream.
I've checked Boatbod's instructions in his post about setting things up to stream to Broadcastify, but he uses tx.py, not multi_rx.py.

Guess a loopback audio device combining both streams could be used; anyway with my setup, I think only one signal would be decoded at a time, so combining both frequencies to one stream should be feasible ?

Thanks
Theoretically audio.py can be used to make sockaudio.py combine two streams from separate udp ports into L and R channels of a single alsa device.
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 8:51 PM.


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