Off-air monitors?

User avatar
Slab Bulkhead
Posts: 97
Joined: Thu Jun 20, 2013 9:34 pm

Re: Off-air monitors?

Post by Slab Bulkhead » Fri Sep 02, 2016 9:33 am

Sure! I'll try and go from memory as I had to do a lot of fiddling with it to get it to work. Most of this involved the code to control the RadioShark which is somewhat old now and depends on old USB HID libraries that weren't available on the Raspbian package archives, so I had to hunt them up and build them. If you install a USB sound device and drive it from an external tuner source it gets a lot simpler because all you have to do is configure the streaming part.

You'll find some of the information here: https://javier.rodriguez.org.mx/2006/06 ... n-gnulinux

What I had to do was more or less the following (I may be forgetting some steps):
Set up Raspbian (I got the current distro which is based on debian Jessie)
Install libhid-dev from the Raspbian archives
Download and build libhid and (I think) libusb. I ran into a problem getting libhid to build, the fix is here: https://matthewcmcmillan.blogspot.com/2 ... ux-on.html
Download and compile shark.c (see the first link in my post)
Once you get shark.c compiled you can control the RadioShark and set its frequency to whatever station you want to monitor.

Then to get the streaming side of it, get darkice (the encoder) and icecast2 (the server) from the Raspbian package archives. Configuration info is back at the first link as well. By default, darkice only comes with open source encoders (ogg vorbis and maybe some others) but you can get LAME (for mp3), FAAC (for AAC), as well as others (AAC+, Opus, etc.). You have to rebuild darkice to add the support for those but I was able to find instructions for that online too. The RadioShark (or other USB device) will show up as a capture device if you list the ID's using the command "arecord -l". You can then specify the proper capture device in the DarkIce config and send the stream to the icecast2 server.

On the pi 3 it looks like there is enough CPU oomph to do 2 or 3 streams. I was able to use both a radioshark and a USB sound card and encode 2 different AAC+ streams from the 2 sound devices. Looking in "top" it says each is using about 15-18% CPU.

Since this thing is essentially a small Linux computer you can do pretty much any other trick you can do on a full Linux system. I am sure there is some way to make a silence sense by periodically polling the level on the audio capture device and sending an email if it's below some threshold for a certain number of checks.

lewiscallaway
Posts: 48
Joined: Sat Nov 28, 2015 8:02 pm

Re: Off-air monitors?

Post by lewiscallaway » Sat Sep 03, 2016 10:08 am

I'll try that as soon as I can get my hands on a radioshark. Thanks so much!

lewiscallaway
Posts: 48
Joined: Sat Nov 28, 2015 8:02 pm

Re: Off-air monitors?

Post by lewiscallaway » Sun Oct 09, 2016 4:13 pm

Slab,

I sent you a PM as well, but I'm wondering what your configuration for dark ice is? I can get everything to work if I have a separate sound card, but still have the radioshark connected and use the Pi to tune the shark. I just can't get audio out of the shark without using a sound card.

Thanks!

lewiscallaway
Posts: 48
Joined: Sat Nov 28, 2015 8:02 pm

Re: Off-air monitors?

Post by lewiscallaway » Sun Oct 09, 2016 7:00 pm

Never mind, I figured it out!

You need to set the sample rate in dark ice to: sampleRate = 32000

User avatar
Slab Bulkhead
Posts: 97
Joined: Thu Jun 20, 2013 9:34 pm

Re: Off-air monitors?

Post by Slab Bulkhead » Mon Oct 10, 2016 8:27 am

That's odd, I have mine running at 44.1. I think the RadioShark went through a number of different hardware iterations, maybe yours has a 32k sample rate instead. I had 2 different Shark units for testing since they were going for so cheap on eBay, one is an original white model and the second is a "Radioshark2" in black. The older white one is mono only on FM and the tuner is quite deaf, the newer model has an improved tuner and will do stereo on a strong signal.

The issue of it only working with another sound card plugged in almost sounds like having the wrong hardware ID in the darkice.cfg file. If you look at the output of the command "arecord -l" with just the Shark plugged in it should give you the hardware ID from the ALSA sound system.

You can try "alsamixer" as well but the RadioShark has no level controls when I tried it.

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest