Scanner feed using Rasberry Pi ?

Status
Not open for further replies.

Uplink

Member
Joined
Feb 17, 2006
Messages
444
Location
Los Angeles County
Great info everyone! Just an update, running 2 simultaneous feeds successfully on one Rasberry Pi. :D No overclocking necessary, or slowing of the USB port necessary, and it's staying cool and happy. Running 2 Griffin I-mic USB cards with line inputs and it sounds great.

Just create 2 different config files each with it's own filename, (such as darkice-feed1.cfg) unique sound card inputs, mountpoints and passwords, ect.


audio input for my 1st feed:
device = plughw:1,0

audio input for my 2nd feed:
device = plughw:0,0

open 2 shells, then run the feeds like this:

sudo nano /etc/darkice-feed1.cfg
sudo nano /etc/darkice-feed2.cfg

more tips on the other R-PI thread here...


How wonderful it was to shut down my Windows XP machine after running it 24/7 after all these years!

:)
 
Last edited:

bibbles10504

Member
Joined
Nov 20, 2007
Messages
8
Set up raspberry pi - Horrible Audio

I just set up my raspberry Pi using my scanner. I'm following the instructions I found on here:

https://docs.google.com/viewer?a=v&...pbnxnbHltYW4zaG9tZXxneDo0NzRlZGQ3ZjBjYWZkODk2
(Great instructions btw!)

The feed is broadcast at: Westchester County Fire Dispatch, Armonk Fire, North Castle Police (I'm just broadcasting weather right now until I get the sound right)

I have 2 problems...

The most important problem is that the audio sounds horrible. It sounds very staticey and is muffled. I tried adjusting the volume on the scanner, and I tried changing the usb to 1.1 by doing:

just use nano or pico and edit /boot/cmdline.txt

Add "dwc_otg.speed=1" to /boot/cmdline.txt.
(Is this right?? It seems very simple)

That didn't make a difference, so I removed that line.

The sound card I'm using is: Amazon.com: Syba SD-CM-UAUD USB Stereo Audio Adapter, C-Media Chipset, RoHS: Computers & Accessories

Any help and ideas on how I can improve the sound quality?



My next question is...
I tried to set up the pi to start darkice on start up, but it doesn't seem to be working. Here is what I did (and the error):

sudo update-rc.d darkice defaults
update-rc.d: using dependency based boot sequencing
insserv: Service pulseaudio has to be enabled to start service darkice
insserv: exiting now!
update-rc.d: error: insserv rejected the script header



My final request...
I am recording all the audio to:
/home/pi/scanneraudio
2013-05-18-Sat-1400_trimmed.mp3 2013-05-18-Sat-1500_trimmed.mp3 _trimmed.mp3

Is there a way I can make another cron job to take all the audio from the last 24 hours, FTP it to a remote server and then remove those files from the pi so the pi doesn't get full?

Thanks!
 

bibbles10504

Member
Joined
Nov 20, 2007
Messages
8
a few tips needed

Not Sure if this will make a difference, but here are my config options:

bitrateMode = cbr # RR/broadcastify default is cbr (vs vbr)
format = mp3 # RR/broadcastify wants mp3
bitrate = 16
# The quality of encoding a value between 0.0 .. 1.0 with 1.0 being the highest quality
# .2 is good for scanner feed and takes less bandwidth than higher settings
quality = 0.6 # Scanner feed default: .2
channel = 1 # 1 = mono, 2 = stereo
# lowpass cuts off low freqs which is fine for scanner feeds and also lowers bandwidth
lowpass = 5000
sampleRate = 22050
 
Last edited:

IredellMon

Member
Joined
Jan 23, 2012
Messages
90
Location
North Carolina
re sound quality, how does it sound if you just use arecord to capture a sound file (aplay to listen to it).. in other words if you don't use darkice and listen to the feed but instead just do a simple local recording.. does it still sound as bad? It rather sounds like over driving on your feed. Perhaps nothing more than playing with the recording levels and scanner audio level (volume) is needed. Trying using alsamixer to get the recording level right. Try using a microphone instead of a scanner and adjust levels till it sounds good on playback.. then try the mike with darkice and listen the feed.. still good?

as for FTPing the files.. that sure can be done and is a fine idea. The original RadioPlay script that Matt wrote used scp to copy the sound files to a server. Look for this line in the script:
"# Uncomment the following if uploading the file...
# scp $LIBDIR_FOLDER/$RPINDEX.mp3 $REMOTEUSER@$REMOTESITE:$REMOTEFOLDER/$DPINDEX.mp3"
(and also see comments at the start of the script and the var set up in the cfg file)...
You could use scp or put your ftp commands at this point in the script. Actually the rm command just before it should not be done until after the file upload if saving the $RPINDEX.mp3 file. If your uploading the saved or trimmed and saved versions then the rm can stay where it is. You can do a check to make sure the file got uploaded and if it did ok then delete it on the pi.

These were quick answers because I dont have the time today to go into it, or access to my pi to check what out what I am saying.. so look into it and get back to us.. maybe someone else can provide more help, esp on the start at boot question. I would have to spend some time on that one.
 
Last edited:

DC31

Member
Feed Provider
Joined
Feb 19, 2011
Messages
1,567
Location
Massachusetts
Quote

I have 2 problems...

The most important problem is that the audio sounds horrible. It sounds very staticey and is muffled. I tried adjusting the volume on the scanner, and I tried changing the usb to 1.1 by doing:



Any help and ideas on how I can improve the sound quality?

Quote

Try turning the scanner volume way down and use Alsamixer to increase the volume in the software. no guarantees but if you are using a mic input on the sound card this might make a difference.
 

bibbles10504

Member
Joined
Nov 20, 2007
Messages
8
Thanks for the tips... It was a problem with the USB 2.0 I tried changing it to 1.1 originally (by adding that 1 line) The problem was, I added it into a new line (not in the same line) So I guess that was the difference. The sound quality is great now!

My next problem is:
I have the script to trim all the dead sound from the recording and save it. The problem is that when you listen to the broadcast, the sound is never 100% silent. There is like a slight static. As a result, there is never any dead time to trim out. Is there a way to set it up so it either doesn't pick up that slightly static, or a way for the recording to trim all that out?

The feed is: Westchester County Fire Dispatch, Armonk Fire, North Castle Police

Thanks!
 

btrogdon

Member
Joined
Jun 15, 2010
Messages
19
Location
Forsyth County, North Carolina
Thanks for the tips... It was a problem with the USB 2.0 I tried changing it to 1.1 originally (by adding that 1 line) The problem was, I added it into a new line (not in the same line) So I guess that was the difference. The sound quality is great now!


Can you send a snippit of the one liner and the target file? I would like to try that too.

Thanks in advance.

-Brad
 

DC31

Member
Feed Provider
Joined
Feb 19, 2011
Messages
1,567
Location
Massachusetts
Can you send a snippit of the one liner and the target file? I would like to try that too.

Thanks in advance.

-Brad

The following is the single line in my boot/cmdline.txt file. It is all one line, word wrap here makes it run onto the second line.

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

(END)
 

bibbles10504

Member
Joined
Nov 20, 2007
Messages
8
The following is the single line in my boot/cmdline.txt file. It is all one line, word wrap here makes it run onto the second line.

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

(END)


Yea, my problem was I put it on 2 lines.. Just make sure it's all on one line. I put "dwc_otg.speed=1" at the end of the line. I guess it doesn't make any difference.
 

IredellMon

Member
Joined
Jan 23, 2012
Messages
90
Location
North Carolina
....
My next problem is:
I have the script to trim all the dead sound from the recording and save it. The problem is that when you listen to the broadcast, the sound is never 100% silent. There is like a slight static. As a result, there is never any dead time to trim out. Is there a way to set it up so it either doesn't pick up that slightly static, or a way for the recording to trim all that out?

The feed is: Westchester County Fire Dispatch, Armonk Fire, North Castle Police

Thanks!
Two thoughts…

1. The static might be line noise of some sort: ground loop, bad connection, etc.. Fix that and the recording might have silence, or close enough to it, to work without any other modifications.

2. You can adjust the silence filter threshold parameter for the sox command, referred to as $THSHOLD in my version of the radioplay script. It is a variable set in the radioplay.conf file. Threshold is used to indicate what sample value you should treat as silence. The higher the value, the “louder” the audio must before it is considered to be NOT silence. Set it too high and some of your radio traffic will be considered silence by sox, and it will be cut out. Set it to a small value and low value static, line noise, etc. will be processed as desired audio and it will NOT be removed.

I found it took a little trial and error so I suggest you capture a short audio clip from your scanner, preferable with a little talk along with the “silence.” Then run the sox command as it is in the script with the value 3 where the $THSHOLD variable is and whatever output file name you wish. Listen to the result and then raise or lower the value from 3 and run the command again until you find a good result.

However if the level of “static” is too close to the level of the radio traffic too often, then there is no value that will give really good results.

Also see The SoX of Silence
And be patient if need be.. I had to re-read that article over ten times.
 

DC31

Member
Feed Provider
Joined
Feb 19, 2011
Messages
1,567
Location
Massachusetts
I just set up my raspberry Pi using my scanner. I'm following the instructions I found on here:




My next question is...
I tried to set up the pi to start darkice on start up, but it doesn't seem to be working. Here is what I did (and the error):

sudo update-rc.d darkice defaults
update-rc.d: using dependency based boot sequencing
insserv: Service pulseaudio has to be enabled to start service darkice
insserv: exiting now!
update-rc.d: error: insserv rejected the script header



My final request...
I am recording all the audio to:
/home/pi/scanneraudio
2013-05-18-Sat-1400_trimmed.mp3 2013-05-18-Sat-1500_trimmed.mp3 _trimmed.mp3



Thanks!
Bibbles,
I hope you got your sound working all right. The real trick that worked for me was putting the information in cmdline.txt all in one line.

Did you ever figure out your "next" question above? I set up a Pi RR feed yesterday and have the same issue and error message.

Also I don't seem to be getting any archives saved to the home/pi/scanneraudio folder. Did you have to tweak something to make that work?

Thanks to Glyman for the well-written instructions! Too bad my Pi/Linux skills are so limited.

Jim
 

IredellMon

Member
Joined
Jan 23, 2012
Messages
90
Location
North Carolina
Bibbles,....

Did you ever figure out your "next" question above? I set up a Pi RR feed yesterday and have the same issue and error message.

Also I don't seem to be getting any archives saved to the home/pi/scanneraudio folder. Did you have to tweak something to make that work?
...

Jim

Lets work on the 2ed problem first... is there any clues listed in /var/log/messages ?
What is the output when you run the radioplay script manually with:
sudo /usr/local/bin/radioplay cron
(It might take a minute or two to run)
 

DC31

Member
Feed Provider
Joined
Feb 19, 2011
Messages
1,567
Location
Massachusetts
Lets work on the 2ed problem first... is there any clues listed in /var/log/messages ?
What is the output when you run the radioplay script manually with:
sudo /usr/local/bin/radioplay cron
(It might take a minute or two to run)

After i posted my note i set up a second SD card with Darkice and Radioplay. The second time through the instuctions made more sense to me and i am sure that i followed them more closely. The second card worked well from the start so i think some of my problems were making mistakes. This card had TwoToneDetect installed on it previously. That included installing pulseaudio so i suspect that took care of the "next" problem. The audio archives are also working. I suspect that my problem there was rooted in the permissions. I think i may have been working in a different directory than the instructions were. I am on the road in a hotel tonight so don't have access to the pi to try stuff out.

My project: TTD running on one pi (B) with 45 tone sets. Audio (playback_during_record) from that pi into a second Model A pi running a Radioreference feed. This creates a feed where you only hear the dispatches. The Model A doesn't have an ethernet jack so that is running through a wireless adapter in a usb hub. Started it up Saturday night and it hasn't gone down yet.

I will try running that radioplay script manually when i get back home, maybe tomorrow night.

Jim
 

btrogdon

Member
Joined
Jun 15, 2010
Messages
19
Location
Forsyth County, North Carolina
Trying to configure 2 feeds same Pi.. Here is the error I get when trying to launch the 2nd feed.

sudo: unable to resolve host darkpi-ice

What do you mean by open two shells?

My current configuration runs headless and automaticaly starts the streaming when powered up. Would like to do this as well for a second stream if the Pi can support it as you described.

Thanks in advance and please be gentle as I am a Linux novice. :)

-Brad

Great info everyone! Just an update, running 2 simultaneous feeds successfully on one Rasberry Pi. :D No overclocking necessary, or slowing of the USB port necessary, and it's staying cool and happy. Running 2 Griffin I-mic USB cards with line inputs and it sounds great.

Just create 2 different config files each with it's own filename, (such as darkice-feed1.cfg) unique sound card inputs, mountpoints and passwords, ect.


audio input for my 1st feed:
device = plughw:1,0

audio input for my 2nd feed:
device = plughw:0,0

open 2 shells, then run the feeds like this:

sudo nano /etc/darkice-feed1.cfg
sudo nano /etc/darkice-feed2.cfg

more tips on the other R-PI thread here...


How wonderful it was to shut down my Windows XP machine after running it 24/7 after all these years!

:)
 

IredellMon

Member
Joined
Jan 23, 2012
Messages
90
Location
North Carolina
Trying to configure 2 feeds same Pi.. Here is the error I get when trying to launch the 2nd feed.

sudo: unable to resolve host darkpi-ice (1)

What do you mean by open two shells? (2)

-Brad

1. Post the results of this command: sudo cat /etc/hosts
2. Open two terminal windows. Does that make sense?
 

btrogdon

Member
Joined
Jun 15, 2010
Messages
19
Location
Forsyth County, North Carolina
1. Post the results of this command: sudo cat /etc/hosts
2. Open two terminal windows. Does that make sense?


#1 Results Below...
root@darkpi-ice:~# sudo cat /etc/hosts
127.0.0.1 localhost
::1 localhost ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters

127.0.1.1 raspberrypi
127.0.0.1 stn7088


#2
I understand if using a GUI. However I am connecting to Raspberry Pi via PuTTY.
 

Uplink

Member
Joined
Feb 17, 2006
Messages
444
Location
Los Angeles County
Trying to configure 2 feeds same Pi.. Here is the error I get when trying to launch the 2nd feed.

sudo: unable to resolve host darkpi-ice

What do you mean by open two shells?

My current configuration runs headless and automaticaly starts the streaming when powered up. Would like to do this as well for a second stream if the Pi can support it as you described.

Thanks in advance and please be gentle as I am a Linux novice. :)

-Brad

Each Putty terminal window you connect opens a separate shell, just open another Putty for each one, and run each instance of Darkice, each with it's own config file.

Run each Darkice in the backround with the ampersand, so it won't stop when you close the Putty window....

sudo nano /etc/darkice-feed1.cfg &
sudo nano /etc/darkice-feed2.cfg &
 
Last edited:

IredellMon

Member
Joined
Jan 23, 2012
Messages
90
Location
North Carolina
Each Putty terminal window you connect opens a separate shell, just open another Putty for each one, and run each instance of Darkice, each with it's own config file.

Run each Darkice in the background with the ampersand, so it won't stop when you close the Putty window....

sudo nano /etc/darkice-feed1.cfg &
sudo nano /etc/darkice-feed2.cfg &

Isn't that the command to edit the configuration file, not to run darkice?
Maybe it should be:
sudo /usr/bin/darkice darkice-feed1.cfg
(and/or 2 of course, ans assuming your config files are "darkice-feed1.cfg" and "darkice-feed2.cfg")

or to start as a service instead (using the init script).. well, if your running two instaces then I guess you need two init scripts with each one listing a different CONFIGFILE so what is now:
sudo /etc/init.d/darkice start
might be sudo /etc/init.d/darkice1 start && sudo /etc/init.d/darkice2 start
after creating and initializing the new init scripts.
 

IredellMon

Member
Joined
Jan 23, 2012
Messages
90
Location
North Carolina
Trying to configure 2 feeds same Pi.. Here is the error I get when trying to launch the 2nd feed.

sudo: unable to resolve host darkpi-ice

-Brad

I can come up with about 1000 reasons one would see this error message, but what is really throwing me for a loop is that it seems the first time you start darkice it works, the second time it does not. And that I cannot explain (yet). The /etc/hosts file looks OK to me.
If that is correct, ask yourself what is different the second time.
Is the first instance running automatically at boot? If so, verify that it is REALLY running (and working), then stop darkice:
sudo /etc/init.d/darkice stop
verify it is stopped, then try manually starting it:
sudo /usr/bin/darkice yourfirstconfigfilename
Does it start? does it feed OK?
If OK, try a second instance:
sudo /usr/bin/darkice yoursecondconfigfilename
Cross fingers and report back...
 

Uplink

Member
Joined
Feb 17, 2006
Messages
444
Location
Los Angeles County
Isn't that the command to edit the configuration file, not to run darkice?
Maybe it should be:
sudo /usr/bin/darkice darkice-feed1.cfg
(and/or 2 of course, ans assuming your config files are "darkice-feed1.cfg" and "darkice-feed2.cfg")

or to start as a service instead (using the init script).. well, if your running two instaces then I guess you need two init scripts with each one listing a different CONFIGFILE so what is now:
sudo /etc/init.d/darkice start
might be sudo /etc/init.d/darkice1 start && sudo /etc/init.d/darkice2 start
after creating and initializing the new init scripts.

oops!, YES IredellMon!. thanks! I'm going blind here and pasting the wrong stuff, here's how I start the feeds...

$ sudo darkice -c/etc/darkice-feed1.cfg &
$ sudo darkice -c/etc/darkice-feed2.cfg &


It drives me nuts how we have such a short time to edit our forum posts, sorry bout that!

oh yea, to stop the feeds...

$ ps aux | grep darkice (gets PID numbers of Darkice programs running)
$ sudo kill "xxxx" (enter the PID number, will shutdown Darkice)
 
Status
Not open for further replies.
Top