• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Paul Clapham
  • Jeanne Boyarsky
  • Knute Snortum
Sheriffs:
  • Liutauras Vilda
  • Tim Cooke
  • Junilu Lacar
Saloon Keepers:
  • Ron McLeod
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Joe Ess
  • salvin francis
  • fred rosenberger

Netcat UDP stream hangs in MacOS; works on raspberry pi

 
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello all,

I am attempting the equivalent of crawling in the networking world. It's not going well. I have the latest version of netcat installed on my macbook from homebrew.

I'm working with an open source "software defined radio" (SDR) application to retrieve radio signals with some cheap hardware plugged into my macbook via USB. I can tune to the radio station just fine in the app, but when I attempt to stream the audio over UDP with netcat, no text prints to terminal.

As the developer suggests ( http://gqrx.dk/doc/streaming-audio-over-udp ), I tried the following in termainl:

,

,



None of these worked.

With the Raspberry Pi variant of the software, I can get the stream in terminal using any of the above commands.

Any suggestions will be much appreciated.
 
Saloon Keeper
Posts: 21595
146
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm a bit confused because it sounds like you think that the audio data is in text form and it isn't.

In theory, UDP streaming should work the same on both MacOS and Linux (including the Pi). Allowing for byte-ordering issues, anyway. Be careful with netcat, though. Some modes take exactly one packet and then terminate.

Unless you are planning to roll your own, however, there are a number of network audio streaming apps already available, however. You can probably use VLC, for one.
 
Simon McNamara
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello Tim,

On the raspberry Pi, listening on the port I specify prints jibberish while I'm streaming data. That's fine, it at least tells me I'm getting data. My next task will be implementing some demodulation so that I can get meaningful text.

On OSX, I get no terminal output whatsoever while listening on the port.

Thanks for your reply.
 
Tim Holloway
Saloon Keeper
Posts: 21595
146
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You might want to fire up tcpdump and see what's going on.

It's dangerous to pump raw binary to a terminal screen, though. The terminal control program may interpret that data has having control characters such as X-on and X-off in it. Piping to a translation program such as "od" (octal dump) from netcat might be safer.
 
Simon McNamara
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ok I'll take a look at tcpdump tomorrow morning.

On a related note; do you have any suggestions for how I can demodulate the audio into, for example, complex numbers? I plan to pipe these data to a java application that I've partially written.

Thanks for your feedback.
 
Tim Holloway
Saloon Keeper
Posts: 21595
146
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ah yes, gqrx. I've been using it myself. I'm presently constructing replacements for some remote weather sensing equipment and I use the SDR to make sure it's sending properly, among other things.

The gqrx udp data is (per the docs) in the following format:


   Channels: 1 (left)
   Sample rate: 48 kHz
   Sample format: 16 bit signed, little endian (S16LE)

I think probably VLC can play that. If not you can probably pump it into aplayer. Note that I do this sort of stuff in Linux and MacOS may have differences in its sound architecture. I'm using ALSA, which is the Linux standard these days.
 
Simon McNamara
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hey Tim,

I should have mentioned my purpose more clearly. I plan to use SDR for radio astronomy. Ultimately, I hope to demodulate the audio into complex numbers for use in another program.

Some user comments mention sox and multimon-ng. I'm going to try some of that along with netcat to see if I can get any output at all.

I'll check back when I have more details. Thanks for your input so far.
 
Tim Holloway
Saloon Keeper
Posts: 21595
146
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Actually, look more closely at the examples in your link. They're exactly the kind of stuff I'd do.

For numerical analysis of incoming radio data, look at gnuradio. It's a toolkit that has all sorts of processing blocks, including complex number conversion. I believe it will also read and demodulate straight from your SDR dongle, so you wouldn't even need to use gqrx (which is primarily a ham radio control program).

The sox program can do a lot with audio streams, but I think gnuradio is a better fit for your needs.
 
Simon McNamara
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Wow. GNURadio is a beast. Looks like I can acquire and demodulate in there and send it anywhere I like after that. Many thanks for suggesting that.

I may still be in need of some functionality like netcat to monitor my data stream as I prepare to write my program to talk to GNURadio. I'll check back in when I write something in GNURadio that I can actually transmit.

Thanks,
 
Tim Holloway
Saloon Keeper
Posts: 21595
146
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
gnuradio can capture to a file and that file can be analysed meticulously using Audacity. Which is a very common practice.

gqrx can capture to a wav file itself, but that only gives basic demodulated sound. Which is a good start.
 
Not looking good. I think this might be the end. Wait! Is that a tiny ad?
Sauce Labs - World's Largest Continuous Testing Cloud for Websites and Mobile Apps
https://coderanch.com/t/722574/Sauce-Labs-World-Largest-Continuous
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!