Author Topic: Raspberry to Stream Scanner Air Band Audio  (Read 73691 times)

Offline av8tor172

  • Full Member
  • ***
  • Posts: 115
    • Military Air Communication Frequenices, Live MilAir Streaming, Recorded MilAir Comms.
Raspberry to Stream Scanner Air Band Audio
« on: March 10, 2014, 10:17:09 AM »
I am trying to stream audio using a Raspberry Pi and a Sound Blaster USB sound card. I am having limited success.

I am using DarkIce on the Raspberry as the streaming software.  I am trying to stream this audio to a Windows PC where I have an Icecast Server running.  My Icecast server has been performing perfectly while streaming from some other PC’s so I don’t think its my Windows PC/Icecast Server causing problems.

When I start DarkIce on the Raspberry all seems ok until someone connects to the DarkIce stream, at that time it seems like my internet speed gets super slow, in fact my other PC’s streaming to Icecast will time-out and disconnect. Also, I will start getting Data Overruns from DarkIce.

Any suggestions?

Thanks
George
www.MilAirComms.com



Offline dave

  • Site Founder
  • Administrator
  • Hero Member
  • *****
  • Posts: 4597
    • LiveATC.net
Re: Raspberry to Stream Scanner Air Band Audio
« Reply #1 on: March 10, 2014, 11:07:42 AM »
Hi George-

Need a little more info…what is your darkice config?  Format?  Bitrate and sample rate?  If you can post that config here (without server addresses and passwords) that would help.

Thanks,
Dave

Offline av8tor172

  • Full Member
  • ***
  • Posts: 115
    • Military Air Communication Frequenices, Live MilAir Streaming, Recorded MilAir Comms.
Re: Raspberry to Stream Scanner Air Band Audio
« Reply #2 on: March 10, 2014, 11:14:15 AM »
Thanks Dave, here is the darkice.cfg file I'm currently using:

# darkice configuration file

[general]

duration = 0 # 0 means forever
bufferSecs = 5 # Internal buffer
reconnect = yes # reconnect if stream broken? default: yes

[input]

device = plughw:1,0 # Assuming USB is 2ed sound device
sampleRate = 22050 # 11025, 22050, or 44100
bitsPerSample = 16 # 8 or 16
channel = 1 # 1 for mono, 2 for stereo

# Next section describes a streaming connection to an IceCast server
# there may be up to 8 of these sections, named [icecast-0] ... [icecast-7]
# these can be mixed with [icecast2-x] and [shoutcast-x] sections

# Don't forget, the name [icecast2-0] needs to change to [icecast2-1]
# and 2 and 3 as you add more feed destinations.

[icecast2-0]

bitrateMode = cbr #
format = mp3 # we are using mp3 format
bitrate = 16 # 16 for mono, 32 for stereo
quality = 0.2 # between >0 & <=1 1.0 being the highest quality
# .1-.2 is good for scanner feed and takes less
# bandwidth than higher settings
channel = 1 # mixes input down to a mono output for the feed.
lowpass = 5000 # lowpass cuts off freqs above the specified value
# such as hiss. Might inhibit paging tones also.
sampleRate = 22050 # 22050 is the best for scanner feeds

############# From your "Feed Technical Details":
server = 111.111.111.111 # use the name or ip address of the icecast server
port = 8000 # Usually 8000
password = passwrd # ENTER your password
mountPoint = 123456789 # ENTER your mountpoint without leading "/"
#############
name = Anytown MilAirComms Feed # ENTER name of your feed


#### use "man darkice.cfg" for more information about this file.

Offline dave

  • Site Founder
  • Administrator
  • Hero Member
  • *****
  • Posts: 4597
    • LiveATC.net
Re: Raspberry to Stream Scanner Air Band Audio
« Reply #3 on: March 10, 2014, 12:34:20 PM »
Most of that looks fine but I would lose the quality line in the [icecast2-0] section.  That won't contribute much help at a 16kb/s bitrate.

But I also don't think that's what's croaking your Icecast server.

Also, the 'channel =1' inside the [icecast2-0] is redundant - you only need that in the [input] section.

What version  of darkice is this?  And what version of Icecast?

And did you check the Icecast error log?  You should log in debug mode so you get as much output in the error log as you can.

Also, how are you feeding darkice from the SDR?  Via rtl_fm to a sound device?  At what sampling rate for the SDR?

Thanks Dave, here is the darkice.cfg file I'm currently using:

# darkice configuration file

[general]

duration = 0 # 0 means forever
bufferSecs = 5 # Internal buffer
reconnect = yes # reconnect if stream broken? default: yes

[input]

device = plughw:1,0 # Assuming USB is 2ed sound device
sampleRate = 22050 # 11025, 22050, or 44100
bitsPerSample = 16 # 8 or 16
channel = 1 # 1 for mono, 2 for stereo

# Next section describes a streaming connection to an IceCast server
# there may be up to 8 of these sections, named [icecast-0] ... [icecast-7]
# these can be mixed with [icecast2-x] and [shoutcast-x] sections

# Don't forget, the name [icecast2-0] needs to change to [icecast2-1]
# and 2 and 3 as you add more feed destinations.

[icecast2-0]

bitrateMode = cbr #
format = mp3 # we are using mp3 format
bitrate = 16 # 16 for mono, 32 for stereo
quality = 0.2 # between >0 & <=1 1.0 being the highest quality
# .1-.2 is good for scanner feed and takes less
# bandwidth than higher settings
channel = 1 # mixes input down to a mono output for the feed.
lowpass = 5000 # lowpass cuts off freqs above the specified value
# such as hiss. Might inhibit paging tones also.
sampleRate = 22050 # 22050 is the best for scanner feeds

############# From your "Feed Technical Details":
server = 111.111.111.111 # use the name or ip address of the icecast server
port = 8000 # Usually 8000
password = passwrd # ENTER your password
mountPoint = 123456789 # ENTER your mountpoint without leading "/"
#############
name = Anytown MilAirComms Feed # ENTER name of your feed


#### use "man darkice.cfg" for more information about this file.

Offline av8tor172

  • Full Member
  • ***
  • Posts: 115
    • Military Air Communication Frequenices, Live MilAir Streaming, Recorded MilAir Comms.
Re: Raspberry to Stream Scanner Air Band Audio
« Reply #4 on: March 10, 2014, 03:39:03 PM »
Darkice version is 1.0
Icecast version is 2.3.2

On the Raspberry it is taking its audio via a Sound Blaster USB Soundcard connected to the headphone jack of a scanner.

After turning on the debug option on Icecast one thing I noticed is that my non-raspberry streams are putting this line into the debug log when they connect:
[2014-03-10  14:27:40] DBUG format-mp3/format_mp3.c sending metadata interval 1000

My Rasberry stream is putting this line into the debug log when it connects:
2014-03-10  14:40:16] DBUG format-mp3/format_mp3.c sending metadata interval 16000
A much larger 'interval' value. Does that make a difference?

All my non-raspberry streams seem to play very well together, they are feeding my Icestream server via ProScan scanner software, again connected to scanners.  They can run for days without problems and have an average of 10 users listening to the stream at the same time. The non-raspberry streams seem to have perfect audio where as the raspberry stream break up from time-to-time.

Another difference I've noticed in the debug log is that once per minute my non-raspberry streams have this line in the debug log:
[2014-03-10  14:16:24] DBUG admin/admin.c Admin request (/admin/listclients)
[2014-03-10  14:16:24] DBUG admin/admin.c Got command (listclients)
[2014-03-10  14:16:24] INFO admin/admin.c Received admin command listclients on mount "/1013"
[2014-03-10  14:16:24] DBUG fserve/fserve.c Adding client to file serving engine
[2014-03-10  14:16:25] DBUG stats/stats.c update node clients (3)
[2014-03-10  14:16:25] DBUG stats/stats.c update node connections (6)
[2014-03-10  14:16:25] DBUG stats/stats.c update node client_connections (4)
[2014-03-10  14:16:25] DBUG stats/stats.c update node clients (2)


But the raspberry stream never has this series of entries in the log.

And a final thing is that when I'm running 3 non-raspberry streams (using ProScan) my internet speed while they're running averages around 23 Mbps, but with just 1 non-raspberry/ProScan stream and 1 raspberry/darkice stream running my internet download speed goes down to about 3 Mbps. I'm using the website SpeedTest.net to test my internet speed.

Thanks
George
www.MilAirComms.com





Offline av8tor172

  • Full Member
  • ***
  • Posts: 115
    • Military Air Communication Frequenices, Live MilAir Streaming, Recorded MilAir Comms.
Re: Raspberry to Stream Scanner Air Band Audio
« Reply #5 on: March 10, 2014, 06:56:01 PM »
I'm starting to wonder if its the Sound Card causing problems.  Everytime the raspberry get kicked off my Icecast server, darkice is still running on the rasberry. Then I'll hit CRTL-C to kill darkice but when I try to restart darkice I'll get an error saying:
DarkIce: AlsaDspSource.cpp:195: can't set hardware parameters

At that time I have to reboot the rasberry in order to get it working again.

During the last crash here is the debug log from Icecast, looks like it just timed out and kicked the raspberry off the Icecast server:
[2014-03-10  18:17:31] DBUG source/source.c last 1394489840, timeout 10, now 1394489851
[2014-03-10  18:17:31] WARN source/source.c Disconnecting source due to socket timeout
[2014-03-10  18:17:31] INFO source/source.c Source "/1017" exiting
[2014-03-10  18:17:31] DBUG source/source.c clearing source "/1017"
[2014-03-10  18:17:31] DBUG source/source.c freeing source "/1017"
[2014-03-10  18:17:31] DBUG stats/stats.c delete source node /1017
[2014-03-10  18:17:31] DBUG stats/stats.c update node clients (4)
[2014-03-10  18:17:31] DBUG stats/stats.c update node listeners (0)
[2014-03-10  18:17:31] DBUG stats/stats.c update node clients (3)
[2014-03-10  18:17:31] DBUG stats/stats.c update node sources (2)

Offline dave

  • Site Founder
  • Administrator
  • Hero Member
  • *****
  • Posts: 4597
    • LiveATC.net
Re: Raspberry to Stream Scanner Air Band Audio
« Reply #6 on: March 10, 2014, 06:58:39 PM »
I've been thinking a bit about your issue, and it's quite strange.  Let's take this offline.

Offline av8tor172

  • Full Member
  • ***
  • Posts: 115
    • Military Air Communication Frequenices, Live MilAir Streaming, Recorded MilAir Comms.
Re: Raspberry to Stream Scanner Air Band Audio
« Reply #7 on: March 11, 2014, 09:41:30 AM »
PROBLEM SOLVED! The Raspberry streaming system ran through the night without any problems with several people connected.

I've posted a How-To article on my website here:
http://milaircomms.com/raspberry_pi_scanner_streaming.html

The article includes what NOT to do so you don't run into the same problems I did.  You can listen to the Raspberry Pi streaming system live here:
http://milaircomms.com/live_streaming_index.html it will be the stream named "Experimental Raspberry Pi Computer Streaming Daytona Beach Police Talkgroups"  Ok, I know streaming police comms yuch, but I wanted something that had a lot of chatter to experiment with. Plus this is Bike Week in Daytona Beach so there is more chatter and excitement than normal...

This is a great system for those who want to stream to Icecast servers but don't want to use a "real PC" for streaming.

George
www.MilAirComms.com

Offline kinabalu tower

  • Newbie
  • *
  • Posts: 24
Re: Raspberry to Stream Scanner Air Band Audio
« Reply #8 on: March 11, 2014, 11:27:02 PM »
Hi,

any chance it could be uploaded to somewhere else to view/download? This is because I cannot go into the website - 403 Forbidden

Thanks

Offline av8tor172

  • Full Member
  • ***
  • Posts: 115
    • Military Air Communication Frequenices, Live MilAir Streaming, Recorded MilAir Comms.
Re: Raspberry to Stream Scanner Air Band Audio
« Reply #9 on: March 12, 2014, 07:18:27 AM »
Hi,

any chance it could be uploaded to somewhere else to view/download? This is because I cannot go into the website - 403 Forbidden

Thanks

what country are you in? If you give me the first part of your IP address I'll unblock it. Had a lot of hackers from Asian countries attempting to hack and spam my site.
George
www.MilAirComms.com

Offline kinabalu tower

  • Newbie
  • *
  • Posts: 24
Re: Raspberry to Stream Scanner Air Band Audio
« Reply #10 on: March 12, 2014, 10:15:50 AM »
Hello again,

I am in Malaysia. eek... hackers :oops:

First part of wan ip 60.52.xx.xxx

I am interested in using the dongle + pi and stream air band to liveatc, plausible? Or is it better to get a receiver like uniden bearcat scanner? Thanks.

Offline InterpreDemon

  • Hero Member
  • *****
  • Posts: 514
Re: Raspberry to Stream Scanner Air Band Audio
« Reply #11 on: March 12, 2014, 12:18:10 PM »
It depends upon how "RF dense" your environment is because the front end of the dongle is pretty wide making it vulnerable to intermod and other interference.  Even scanners need band pass filters in some urban environments and/or when superior antenna locations are in use. You also have a limited range, usually around 250 kHz, if you want to receive multiple frequencies with a dongle, which generally makes them a single channel receiver whereas a scanner can receive multiple channels anywhere in the aircraft band. If it were me, I would start by picking up a used scanner and seeing what you can pull in from your location, then take it from there as far as whether it is even worth attempting a feed.

Offline av8tor172

  • Full Member
  • ***
  • Posts: 115
    • Military Air Communication Frequenices, Live MilAir Streaming, Recorded MilAir Comms.
Re: Raspberry to Stream Scanner Air Band Audio
« Reply #12 on: March 12, 2014, 12:48:54 PM »
Hello again,

I am in Malaysia. eek... hackers :oops:

First part of wan ip 60.52.xx.xxx

I am interested in using the dongle + pi and stream air band to liveatc, plausible? Or is it better to get a receiver like uniden bearcat scanner? Thanks.

You should be able to access the entire MilAirComms.com website now, Yes, Malaysia was a problem with spammers spamming my Spotters Network.

From what I've played with so far I would say you would be better off with a Uniden Scanner.  Now you still can use a Raspberry Pi to stream the scanners audio to the web. I'm doing that in this article: http://milaircomms.com/raspberry_pi_scanner_streaming.html

George
www.MilAirComms.com

Offline kinabalu tower

  • Newbie
  • *
  • Posts: 24
Re: Raspberry to Stream Scanner Air Band Audio
« Reply #13 on: March 12, 2014, 09:49:22 PM »
It depends upon how "RF dense" your environment is because the front end of the dongle is pretty wide making it vulnerable to intermod and other interference.  Even scanners need band pass filters in some urban environments and/or when superior antenna locations are in use. You also have a limited range, usually around 250 kHz, if you want to receive multiple frequencies with a dongle, which generally makes them a single channel receiver whereas a scanner can receive multiple channels anywhere in the aircraft band. If it were me, I would start by picking up a used scanner and seeing what you can pull in from your location, then take it from there as far as whether it is even worth attempting a feed.

Ok thanks for sharing... will give it a thought and plans things.

Offline kinabalu tower

  • Newbie
  • *
  • Posts: 24
Re: Raspberry to Stream Scanner Air Band Audio
« Reply #14 on: March 12, 2014, 09:50:02 PM »
Hello again,

I am in Malaysia. eek... hackers :oops:

First part of wan ip 60.52.xx.xxx

I am interested in using the dongle + pi and stream air band to liveatc, plausible? Or is it better to get a receiver like uniden bearcat scanner? Thanks.

You should be able to access the entire MilAirComms.com website now, Yes, Malaysia was a problem with spammers spamming my Spotters Network.

From what I've played with so far I would say you would be better off with a Uniden Scanner.  Now you still can use a Raspberry Pi to stream the scanners audio to the web. I'm doing that in this article: http://milaircomms.com/raspberry_pi_scanner_streaming.html

George
www.MilAirComms.com

Hi George yup I am able to go into the website now cheers for that!

Offline av8tor172

  • Full Member
  • ***
  • Posts: 115
    • Military Air Communication Frequenices, Live MilAir Streaming, Recorded MilAir Comms.
Re: Raspberry to Stream Scanner Air Band Audio
« Reply #15 on: March 13, 2014, 11:09:11 AM »
I am trying to use one Raspberry to stream 2 different audio sources to an Icecast server.

I have 1 stream working perfectly.

I have one Darkice.cfg file setup for device = plughw:0,0 and a second Darkice.cfg file setup for device plughw:1,0

I can have either Darkice / sound card playing perfectly however when I try to start up a second Darkice using the second sound card the audio on both streams gets very chopping and it sounds like the audio is playing faster (kind of like a Mickey Mouse sound).

Any Suggestions?
George
www.MilAirComms.com

Offline dave

  • Site Founder
  • Administrator
  • Hero Member
  • *****
  • Posts: 4597
    • LiveATC.net
Re: Raspberry to Stream Scanner Air Band Audio
« Reply #16 on: March 13, 2014, 11:14:04 AM »
George-

Two possible issues:

1) Power drain on the 5V power supply.  Make sure you have a 1A or greater 5V power supply.
and/or
2) Some sound devices misbehave on the USB bus.  You may have to slow the USB bus down (which may screw up your keyboard if you actually use a keyboard attached to USB):

Edit /boot/cmdline.txt and add the highlighted piece:

dwc_otg.lpm_enable=0 dwc_otg.speed=1 console=ttyAMA0,115200 kgdboc=ttyAMA0,115200 console=tty1 root=/dev/mmcblk0p2 rootfstype=ext4 elevator=deadline rootwait

Offline av8tor172

  • Full Member
  • ***
  • Posts: 115
    • Military Air Communication Frequenices, Live MilAir Streaming, Recorded MilAir Comms.
Re: Raspberry to Stream Scanner Air Band Audio
« Reply #17 on: March 13, 2014, 11:50:03 AM »

2) Some sound devices misbehave on the USB bus.  You may have to slow the USB bus down (which may screw up your keyboard if you actually use a keyboard attached to USB):

Edit /boot/cmdline.txt and add the highlighted piece:

dwc_otg.lpm_enable=0 dwc_otg.speed=1 console=ttyAMA0,115200 kgdboc=ttyAMA0,115200 console=tty1 root=/dev/mmcblk0p2 rootfstype=ext4 elevator=deadline rootwait

Perfect! It was the USB speed. Got 2 different USB Soundcards streaming different audio through the same Raspberry Pi.

Didn't think voltage was a question, I'm running USB devices on a powered USB hub.  Oh, I never plug keyboard into USB port, PuTTY all the way here!

Thanks
George
www.MilAirComms.com

Offline dave

  • Site Founder
  • Administrator
  • Hero Member
  • *****
  • Posts: 4597
    • LiveATC.net
Re: Raspberry to Stream Scanner Air Band Audio
« Reply #18 on: March 13, 2014, 01:02:38 PM »
Great!  Glad it worked out.

Offline av8tor172

  • Full Member
  • ***
  • Posts: 115
    • Military Air Communication Frequenices, Live MilAir Streaming, Recorded MilAir Comms.
Re: Raspberry to Stream Scanner Air Band Audio
« Reply #19 on: March 13, 2014, 07:15:41 PM »
Now that I've had success with running more than 1 sound card on a single Raspberry Pi I have updated my article to describe how you can do the same thing here:

http://milaircomms.com/raspberry_pi_scanner_streaming.html

I have also included a picture of the multi-sound card / scanner setup (excuse my crappy drawing ability, but I tried to label the parts)

Thanks
George
www.MilAirComms.com

Offline SteveJWR

  • Newbie
  • *
  • Posts: 9
  • Steve JW Roberts
Re: Raspberry to Stream Scanner Air Band Audio - DAVE
« Reply #20 on: March 28, 2014, 07:23:12 AM »
I am looking to get a Rasberry Pi to stream my feed. However I have no idea how or what.
So I am looking for a preconfigured setup, so all i have to do is plug it in, and plug in the signal from my transceiver.
Dave, anyone doing this? How much inc shipping to Aus?
Cheers
Steve

Offline dave

  • Site Founder
  • Administrator
  • Hero Member
  • *****
  • Posts: 4597
    • LiveATC.net
Re: Raspberry to Stream Scanner Air Band Audio
« Reply #21 on: March 28, 2014, 07:34:09 AM »
Hi Steve… We sell preconfigured raspberry pi systems. Please contact me privately for pricing

Offline squibcakes

  • Newbie
  • *
  • Posts: 6
Re: Raspberry to Stream Scanner Air Band Audio
« Reply #22 on: March 30, 2014, 08:52:57 PM »
Hi George, You are a legend.  Thanks for the easy to follow instructions I had my Rpi up and running in no time!

I'm using one of those el' cheapo ebay usb sound cards for $3.95 which is terrible for windows but works suprising well on  linux.

Now to reconcider my install and feed to liveatc...

Steve, Did Dave sort you out? If not I can point you in right direction.

Offline av8tor172

  • Full Member
  • ***
  • Posts: 115
    • Military Air Communication Frequenices, Live MilAir Streaming, Recorded MilAir Comms.
Re: Raspberry to Stream Scanner Air Band Audio
« Reply #23 on: March 31, 2014, 08:08:11 AM »
Hi George, You are a legend.  Thanks for the easy to follow instructions I had my Rpi up and running in no time!

I'm using one of those el' cheapo ebay usb sound cards for $3.95 which is terrible for windows but works suprising well on  linux.


Glad you got it working. 

Do you know the make/model of the el' cheapo USB sound card you're using? 

So far I've got 2 sound cards working on 1 Raspberry for streaming.  It works great however I was in a hurry and didn't want to wait for a cheap USB sound card to arrive by mail.  I bought mine locally. 

My first one was Sound Blaster Pro I bought at Best Buy for $30.99, a few days after writing my how-to article I went back to the same store to get another.  The price jumped to $37.99. (Maybe they read my article and expected a run on the Sound Blaster card LOL) That was upsetting so I called a local computer store and found a StarTech.com model ICUSBAUDIO7 for $27.99.  It turned out the StarTech has better audio and less noise than the more expensive Sound Blaster.  Both sound cards are working well on the 1 Raspberry.

You can see pictures of my 2 Sound Card / Raspberry setup here: http://milaircomms.com/raspberry_pi_scanner_streaming.html or listen to the live audio from the set up here: http://milaircomms.com/live_streaming_index.html

When I get time I want to try some of those el' cheapo sound cards.

Thanks
George
www.MilAirComms.com

Offline dave

  • Site Founder
  • Administrator
  • Hero Member
  • *****
  • Posts: 4597
    • LiveATC.net
Re: Raspberry to Stream Scanner Air Band Audio
« Reply #24 on: March 31, 2014, 08:18:15 AM »
The cheap USB sound dongles are not all created equal.  One thing to keep in mind is that they are all mic level inputs.  So you need to use an attenuating audio cable or your own audio transformer in order to keep the audio input level from the scanner reasonable.  Or....you have to very carefully control the scanner volume, usually needing to keep it *very* low.  If that scanner volume then gets above that level it doesn't have to get very far at all for the feed audio to become very high and distorted.

These two sound cards provide the best results - and I have tested a lot of them

1) Griffin iMic
http://www.amazon.com/Griffin-Technology-iMic-Audio-Device/dp/B000BVV2IC

2) HDE 6 Channel 5.1 PCI External USB Sound Card
http://www.amazon.com/HDE-Channel-External-Laptop-Notebook/dp/B009NVS6KS

The HDE device has a Line In input (that actually works with the generic Linux USB sound driver) and the Griffin has a slide switch that allows for either mic or line input.  The Griffin is far more expensive so I have started to like the HDE units better since we do a lot of feeds and it's important to keep costs reasonable.