RadioReference on Facebook   RadioReference on Twitter   RadioReference Blog
 

Go Back   The RadioReference.com Forums > Computer Aided Monitoring and Programming > Streaming / Broadcasting / Audio Recording


Streaming / Broadcasting / Audio Recording - Interested in putting your scanner online for others to hear? Want to listen to other radios on the internet. This forum is here for you to discuss these topics related to streaming scanners online.

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #101 (permalink)  
Old 05-20-2013, 11:22 PM
davidVT's Avatar
Member
  Audio Feed Provider
Audio Feed Provider
 
Join Date: Aug 2010
Location: Washington County,Vermont
Posts: 96
Default

First install screen
Sudo apt-get install screen

Crontab last line: (thanks Jim for sharing that @reboot and screen)
@reboot screen -dmS ttd-screen ./TTD.sh

TTD.sh. In the pi directory:
#!/bin/sh
cd /home/pi/dist
python TwoToneDetect60Pi.pyc

Then follow the link above to automatically login to pi. (Post at 2:59 am)

Seems to work great so far.
I am slowly learning the screen commands. I am typing this on my iPad while an SSH app has the pi connected so I could read the scripts for you.

Once connected, if not familiar with screen, this is helpful:
Linux Screen Tutorial and How To - rackAID

After login use the top command to see if python comes up. 'I' (letter eye) to remove idle stuff
You can use 'q' to leave that.
Top cmd reference:
http://linux.about.com/od/commands/l/blcmdl1_top.htm

If screen is working,
screen -list. Should list out a line with ttd-screen that is the name I gave that in the scripts above.
screen -x ttd-screen Should connect you to the TTD output screen where noise should generate the familiar two columns. You can leave that with. CTRL-a,d for detach

YMMV. Hopefully the iPad has not mangled or autocorrected too much here.. Good luck

Last edited by davidVT; 05-20-2013 at 11:51 PM..
Reply With Quote
Sponsored links
  #102 (permalink)  
Old 05-21-2013, 5:56 AM
Member
  Audio Feed Provider
Audio Feed Provider
 
Join Date: Feb 2011
Location: Massachusetts
Posts: 946
Default

Quote:
Originally Posted by davidVT View Post
I powered down the PI, pulled the HDMI and the usb keyboard/mouse, and powered it back on. In about 30 seconds the sound card led started flashing. I believe TTD is thus working so I will leave it from now to tomorrow night to make sure the notifications work properly before making any more changes.

When running headless, are there any special actions or configuration changes to minimize sd card corruption during power cycles?

Anyone have an opinion about this power down idea?
Raspberry Pi Shutdown Switch – Safely Turning off the Pi | 3cc Internet

I can confirm that it generated emails from several tones in this headless mode in the last 20 minutes.
No experience with card corruption here. And lots of power cycles. I have read through the info at the link about power off button including the RPi forum stuff. Excuse my beginner's ignorance but I can't figure out how one turns the pi back on after using the button. Power cycle it?
Reply With Quote
  #103 (permalink)  
Old 05-21-2013, 9:54 AM
Member
  Premium Subscriber
Premium Subscriber
 
Join Date: Aug 2005
Posts: 1,089
Default

Alright I'm baffled, this autostart should be working but it's not.

I have the cron line set up, and when I check the cron log after reboot, it seems to show that it ran the @reboot line.

If I run that line manually after startup, it starts a new screen with TTD. What am I missing?

Andy
__________________
Using TwoToneDetect? Show us where! Add yourself to the user map here or PM me with your location and I'll add you.

If you need help with TwoToneDetect please read this post first
Reply With Quote
  #104 (permalink)  
Old 05-21-2013, 12:26 PM
davidVT's Avatar
Member
  Audio Feed Provider
Audio Feed Provider
 
Join Date: Aug 2010
Location: Washington County,Vermont
Posts: 96
Default

Andy,

Don't take this the wrong way but we should check the easy stuff first:

1) Maybe it is running?
How can you tell if the program is running or not? When mine starts, there is no obvious sign of it running but for the led flashing on my sound card. When I use the Top command with 'i', I can see python running.

2)Are you in the user crontab? This needs to be a crontab created from within PI user. crontab -e from the pi command line

3)Punctuation? I doubt this one but maybe the ./ before the script is missing the '.' ?

4)Screen? You did install GNU Screen, right?

Good luck
You will soon be successful. I am confident in that.

Ironically I had a house power failure this morning. The only thing in my 'electronics suite' that started properly was the TTDpi.
Reply With Quote
  #105 (permalink)  
Old 05-21-2013, 12:35 PM
Member
  Audio Feed Provider
Audio Feed Provider
 
Join Date: Feb 2011
Location: Massachusetts
Posts: 946
Default

There are lots of little variables, Andy, and they all have to be right. Mine wasn't working either as the launching of TTD was failing due to the "global stream" error. So it would end up at the Linux prompt with nothing running in Screen. I had fooled around and made a change in pavucontrol turning off the ALSA input and that was the cause of the problem. I turned it back on, then shut down TTD, then simply unplugged the pi and plugged it back in. Then sent a test tone in through the audio cable and it detected and sent the email.

Here is the change to the inittab file:

# Note that on most Debian systems tty7 is used by the X Window System,
# so if you want to add more getty's go ahead but skip tty7 if you run X.
#
#1:2345:respawn:/sbin/getty --noclear 38400 tty1
1:2345:respawn:/bin/login -f pi tty1 </dev/tty1 >/dev/tty1 2>&1
2:23:respawn:/sbin/getty 38400 tty2
3:23:respawn:/sbin/getty 38400 tty3
4:23:respawn:/sbin/getty 38400 tty4
5:23:respawn:/sbin/getty 38400 tty5
6:23:respawn:/sbin/getty 38400 tty6


here is the entry in the crontab file:

# For more information see the manual pages of crontab(5) and cron(8)
#
# m h dom mon dow command

@reboot cd TTD60/dist && screen -d -m python TwoToneDetect60Pi.pyc


Then when I reboot the pi it comes up at the linux command line, no directory shown. type screen -list to see a list of active screens.

Here is what I see:
pi@raspberrypi /etc $ screen -list
There is a screen on:
866..raspberrypi (21/05/13 12:50:58) (Detached)
1 Socket in /var/run/screen/S-pi.

To reattach that screen type screen -r at the linux prompt.

You might want to double check your input device assignment. I was finding when I had ALSA turned off it would fail on booting to input device 2. Then it would change to 3 so that second attempt would be successful. This might be what you are seeing when you run that command manually after startup.
Reply With Quote
Sponsored links
  #106 (permalink)  
Old 05-21-2013, 3:01 PM
davidVT's Avatar
Member
  Audio Feed Provider
Audio Feed Provider
 
Join Date: Aug 2010
Location: Washington County,Vermont
Posts: 96
Default

Jim,
The card corruption concern just comes from reading around the web. Time will tell if an issue for us or not. I plan to leave mine running once it goes into production.

As to the auto startup, yours seems to follow mine but for mine calling a script first in my case. I tried to call the TTD pyc file directly as you did but kept having problems. Adding the script step seemed to make a difference. With a few days of confidence I will go back to the pyc directly and see if I can eliminate the TTD.sh step.

I had been in the pavucontrol to adjust input levels recently. I also adjusted the devices. Reading your post I wonder if the stream error on restart I was having was unknowingly resolved by those adjustments. I kick myself for not taking notes.

I will try to log in from my laptop tonight and capture screens from putty so I can post exact lines from the PI.. The iPad is less forgiving at trying to capture things except for screen prints.
Reply With Quote
  #107 (permalink)  
Old 05-21-2013, 4:46 PM
Member
  Premium Subscriber
Premium Subscriber
 
Join Date: Aug 2005
Posts: 1,089
Default

Quote:
Originally Posted by DC31 View Post
You might want to double check your input device assignment. I was finding when I had ALSA turned off it would fail on booting to input device 2. Then it would change to 3 so that second attempt would be successful. This might be what you are seeing when you run that command manually after startup.
I think this may be my issue. I'm losing my mind, I thought I had put the code into v60Pi to automatically select the pulseaudio device regardless of index, but I guess I forgot. When I get some time I'll roll that in and see if that helps with the autostart headaches.

[and to further prove I'm losing my mind, I broke rule #1 of programming and somehow lost the source file for the "regular" v60! Good thing I have the Pi version for a comparison...need to reconstruct the regular v60 on a rainy day...ugh]

Andy
__________________
Using TwoToneDetect? Show us where! Add yourself to the user map here or PM me with your location and I'll add you.

If you need help with TwoToneDetect please read this post first
Reply With Quote
  #108 (permalink)  
Old 05-22-2013, 8:55 PM
davidVT's Avatar
Member
  Audio Feed Provider
Audio Feed Provider
 
Join Date: Aug 2010
Location: Washington County,Vermont
Posts: 96
Default

I was able to make a copy of my working TTDpi SD card and file it away. I just installed webmin via the following link and am now updating it as I type this.
Webmin Setup On Raspberry Pi | Raspberry Pi | 512MB of Awesome
Webmin should allow me easier access for quick peaks of the headless TTDpi and a clean way to shut it down.
Reply With Quote
  #109 (permalink)  
Old 05-22-2013, 9:20 PM
Member
  Premium Subscriber
Premium Subscriber
 
Join Date: Aug 2005
Posts: 1,089
Default

Alright, I've only lost half my mind.

Turns out I did make the changes in v60Pi to automatically select the 'pulse' audio device, but failed to take out some other code that overrode that and still selected the device from config.cfg. I have uploaded a v60aPi version to the program page (direct file link) that will automatically select 'pulse'. Using this file has gotten my autostart working, thanks for the idea Jim.

Also, I realized that the "regular" v60 was actually just a rename of v59d that I never released, so I haven't lost any source code, I just didn't rename everything as I should have. So all is well. Whew!

Andy
__________________
Using TwoToneDetect? Show us where! Add yourself to the user map here or PM me with your location and I'll add you.

If you need help with TwoToneDetect please read this post first
Reply With Quote
  #110 (permalink)  
Old 05-22-2013, 9:57 PM
davidVT's Avatar
Member
  Audio Feed Provider
Audio Feed Provider
 
Join Date: Aug 2010
Location: Washington County,Vermont
Posts: 96
Default

Andy,
v60a installation overwrote the configuration files.
I should have known better. Just a warning for others.

Fortunately I just did a backup so I can pull the config files from the other SD card.
Reply With Quote
  #111 (permalink)  
Old 05-23-2013, 6:15 AM
Member
  Audio Feed Provider
Audio Feed Provider
 
Join Date: Feb 2011
Location: Massachusetts
Posts: 946
Default

Quote:
Originally Posted by davidVT View Post
I was able to make a copy of my working TTDpi SD card and file it away. I just installed webmin via the following link and am now updating it as I type this.
Webmin Setup On Raspberry Pi | Raspberry Pi | 512MB of Awesome
Webmin should allow me easier access for quick peaks of the headless TTDpi and a clean way to shut it down.
Dave, I installed Webmin and get to here:

Webmin has been installed and started successfully. Use your web
browser to go to

http://raspberrypi:10000/

and login with the name and password you entered previously.

I type in the http address as shown above and get an error message. Am I missing something? that address just seems too simple.
Reply With Quote
  #112 (permalink)  
Old 05-23-2013, 6:41 AM
davidVT's Avatar
Member
  Audio Feed Provider
Audio Feed Provider
 
Join Date: Aug 2010
Location: Washington County,Vermont
Posts: 96
Default

Hi Jim,
We have to use our IP address rather than 'raspberry pi' in that example. You still need the port. :10000
We can fix the name issue but I am too lazy at the moment. (Actually mine did work just now, seems by DNS and dhcp seem to be working)

Works well for me. I have used webmin in the past at my Internet company but that was 7+ years ago and it seems to have improved considerably. I am curious how much load it will put on the tiny PI.

I am updating my PI via webmin at this moment. Time will tell if there are any issues doing so.

Social commentary: Yesterday I fired up the dusty laptop and must admit winscp and putty are much easier to use than trying to run the PI remotely from the iPad. The utilities on the iPad are nice but the ease of use with the old windows utilities are more user friendly. Up to this point I had done all via the iPad or USB keyboard to the PI before going headless. Fixing my dumb overwrite of the TTD config files took no time with winscp. I have not looked for an iOS alternative to winscp, surely there is one.

Question: Is there an easy way to open the SD image files on windows? At best I only see the small partition.

Last edited by davidVT; 05-23-2013 at 7:02 AM.. Reason: DNS actually worked
Reply With Quote
  #113 (permalink)  
Old 06-01-2013, 8:16 PM
Member
  Premium Subscriber
Premium Subscriber
 
Join Date: Aug 2005
Posts: 1,089
Default Streaming Audio + TTD on Pi

I think I have streaming audio working alongside TTD on a Pi. Haven't had any pages yet to know that everything is working 100%, but it appears ok. I followed the instructions here to get the streaming audio going (installing darkice and icecast):

Live mp3 streaming from audio-in with DarkIce and Icecast2 on Raspberry Pi

To use pulseaudio as the audio source, in the darkice.cfg, I simply changed this:
Code:
device = hw:1,0
to this:
Code:
device = pulse
Edit: I found that when trying to get darkice streaming to autostart along with TTD, it caused some issues, so I now have my cron jobs set up so that TTD starts immediately, and then darkice starts two minutes later. This seems to work so far. My crontab -e looks like this:

Code:
@reboot screen -dmS ttd-screen /home/pi/TTD/startTTD.sh
@reboot /bin/sleep 120 ; screen -dmS darkice-screen darkice
Have fun!

Andy
__________________
Using TwoToneDetect? Show us where! Add yourself to the user map here or PM me with your location and I'll add you.

If you need help with TwoToneDetect please read this post first

Last edited by aaknitt; 06-01-2013 at 10:15 PM.. Reason: added info on autostart
Reply With Quote
  #114 (permalink)  
Old 06-01-2013, 8:43 PM
aliby19's Avatar
Member
  Audio Feed Provider
Audio Feed Provider
 
Join Date: Mar 2005
Location: McCordsville, IN
Posts: 194
Default

I have had stubborn issues getting TTD for the Pi to detect sound coming out of my soundcard. At one point, when running LevelMeter.pyc, I was actually able to get numbers to appear showing the threshold. However, now when I run it, I get the following:

Code:
Enter input device index: 8
Enter output device index: 8
ALSA lib pcm_dsnoop.c:612:(snd_pcm_dsnoop_open) unable to open slave
ALSA lib pcm.c:2217:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.rear
ALSA lib pcm.c:2217:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.center_lfe
ALSA lib pcm.c:2217:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.side
ALSA lib pcm.c:2217:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.hdmi
ALSA lib pcm.c:2217:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.hdmi
ALSA lib pcm.c:2217:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.modem
ALSA lib pcm.c:2217:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.modem
ALSA lib pcm.c:2217:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.phoneline
ALSA lib pcm.c:2217:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.phoneline
ALSA lib pcm_dmix.c:957:(snd_pcm_dmix_open) The dmix plugin supports only playback stream
Cannot connect to server socket err = No such file or directory
Cannot connect to server request channel
jack server is not running or cannot be started
Any help/thoughts? I saw this covered in the thread earlier and tried disabling the ALSA device in the Pulseaudio Volume Control panel, but that did not seem to help.

Thanks!
__________________
FF/EMT | Hancock Co, IN Public Safety Feed
Radios: Moto 1550XLS VHF, Yaesu VX7R, FT51R, 7800R, FTM400
Scanners: BCD396XT, BCD996XT, HomePatrol-1, Pro-163, Pro-164, Regency MX3000
Reply With Quote
  #115 (permalink)  
Old 06-01-2013, 10:04 PM
Member
  Premium Subscriber
Premium Subscriber
 
Join Date: Aug 2005
Posts: 1,089
Default

Quote:
Originally Posted by aliby19 View Post
I have had stubborn issues getting TTD for the Pi to detect sound coming out of my soundcard. At one point, when running LevelMeter.pyc, I was actually able to get numbers to appear showing the threshold. However, now when I run it, I get the following:

Code:
Enter input device index: 8
Enter output device index: 8
ALSA lib pcm_dsnoop.c:612:(snd_pcm_dsnoop_open) unable to open slave
ALSA lib pcm.c:2217:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.rear
ALSA lib pcm.c:2217:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.center_lfe
ALSA lib pcm.c:2217:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.side
ALSA lib pcm.c:2217:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.hdmi
ALSA lib pcm.c:2217:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.hdmi
ALSA lib pcm.c:2217:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.modem
ALSA lib pcm.c:2217:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.modem
ALSA lib pcm.c:2217:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.phoneline
ALSA lib pcm.c:2217:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.phoneline
ALSA lib pcm_dmix.c:957:(snd_pcm_dmix_open) The dmix plugin supports only playback stream
Cannot connect to server socket err = No such file or directory
Cannot connect to server request channel
jack server is not running or cannot be started
Any help/thoughts? I saw this covered in the thread earlier and tried disabling the ALSA device in the Pulseaudio Volume Control panel, but that did not seem to help.

Thanks!
What is device "8" that you're trying to use with LevelMeter.py? I haven't seen a number that high...are you using multiple sound cards?

Andy
__________________
Using TwoToneDetect? Show us where! Add yourself to the user map here or PM me with your location and I'll add you.

If you need help with TwoToneDetect please read this post first
Reply With Quote
  #116 (permalink)  
Old 06-01-2013, 10:18 PM
aliby19's Avatar
Member
  Audio Feed Provider
Audio Feed Provider
 
Join Date: Mar 2005
Location: McCordsville, IN
Posts: 194
Default TwoToneDetect on a Raspberry Pi - How To

Yep. I have two feeds running on the Pi. Here's the device listing from LevelMeter:

Output Device 0: C-Media USB Audio Device: USB Audio (hw:0,0)
Output Device 1: C-Media USB Audio Device: USB Audio (hw:1,0)
Output Device 2: bcm2835 ALSA: bcm2835 ALSA (hw:2,0)
Output Device 3: sysdefault
Output Device 4: front
Output Device 5: surround40
Output Device 6: iec958
Output Device 7: spdif
Input Device 8: pulse
Output Device 8: pulse
Output Device 9: dmix
Input Device 10: default
Output Device 10: default
__________________
FF/EMT | Hancock Co, IN Public Safety Feed
Radios: Moto 1550XLS VHF, Yaesu VX7R, FT51R, 7800R, FTM400
Scanners: BCD396XT, BCD996XT, HomePatrol-1, Pro-163, Pro-164, Regency MX3000

Last edited by aliby19; 06-01-2013 at 10:21 PM..
Reply With Quote
  #117 (permalink)  
Old 06-01-2013, 10:26 PM
Member
  Premium Subscriber
Premium Subscriber
 
Join Date: Aug 2005
Posts: 1,089
Default

Quote:
Originally Posted by aliby19 View Post
Yep. I have two feeds running on the Pi. Here's the device listing from LevelMeter:

Output Device 0: C-Media USB Audio Device: USB Audio (hw:0,0)
Output Device 1: C-Media USB Audio Device: USB Audio (hw:1,0)
Output Device 2: bcm2835 ALSA: bcm2835 ALSA (hw:2,0)
Output Device 3: sysdefault
Output Device 4: front
Output Device 5: surround40
Output Device 6: iec958
Output Device 7: spdif
Input Device 8: pulse
Output Device 8: pulse
Output Device 9: dmix
Input Device 10: default
Output Device 10: default
See my last post. I seem to need to start TTD before starting my feed to get it all to play nice together...not sure if that's an issue for you or not.

Andy
__________________
Using TwoToneDetect? Show us where! Add yourself to the user map here or PM me with your location and I'll add you.

If you need help with TwoToneDetect please read this post first
Reply With Quote
  #118 (permalink)  
Old 06-02-2013, 10:11 PM
aliby19's Avatar
Member
  Audio Feed Provider
Audio Feed Provider
 
Join Date: Mar 2005
Location: McCordsville, IN
Posts: 194
Default

Ok, that seemed to work (starting before starting the streams).

However, the way I have things set up, I have one scanner/feed that is used soely for our dispatch channels (UHF/VHF) and one that is used for all other communications (800mhz).

It appears that LevelMeter is currently only seeing the 800mhz scanner audio, which is plughw:0,0. The UHF/VHF scanner is plughw:1,0. Any ideas there?

It would be an awesome feature to be able to select a specific USB soundcard to monitor, like in Windows
__________________
FF/EMT | Hancock Co, IN Public Safety Feed
Radios: Moto 1550XLS VHF, Yaesu VX7R, FT51R, 7800R, FTM400
Scanners: BCD396XT, BCD996XT, HomePatrol-1, Pro-163, Pro-164, Regency MX3000

Last edited by aliby19; 06-02-2013 at 10:20 PM..
Reply With Quote
  #119 (permalink)  
Old 06-02-2013, 11:23 PM
Member
  Premium Subscriber
Premium Subscriber
 
Join Date: Aug 2005
Posts: 1,089
Default

Quote:
Originally Posted by aliby19 View Post
Ok, that seemed to work (starting before starting the streams).

However, the way I have things set up, I have one scanner/feed that is used soely for our dispatch channels (UHF/VHF) and one that is used for all other communications (800mhz).

It appears that LevelMeter is currently only seeing the 800mhz scanner audio, which is plughw:0,0. The UHF/VHF scanner is plughw:1,0. Any ideas there?

It would be an awesome feature to be able to select a specific USB soundcard to monitor, like in Windows
You may need to make some changes to your pulseaudio setup to get the correct USB card flowing into pulse as the source. There's probably a way to do this from the command line, but I do it from the X-windows interface using pavucontrol.

Right now TTD/LevelMeter are limited to using pulseaudio as the input because using the hardware directly doesn't let you change the sample rate. I may get smart enough to figure out a better way some day, but that's a rainy day project.

Andy
__________________
Using TwoToneDetect? Show us where! Add yourself to the user map here or PM me with your location and I'll add you.

If you need help with TwoToneDetect please read this post first
Reply With Quote
  #120 (permalink)  
Old 06-04-2013, 3:25 PM
aliby19's Avatar
Member
  Audio Feed Provider
Audio Feed Provider
 
Join Date: Mar 2005
Location: McCordsville, IN
Posts: 194
Default

I tried disabling the 800 MHz/SafeT sound card in pavucontrol, leaving only the audio from my scanner that is dedicated to our dispatch frequency. However, it hasn't seemed to help/do anything.

Any other thoughts?
__________________
FF/EMT | Hancock Co, IN Public Safety Feed
Radios: Moto 1550XLS VHF, Yaesu VX7R, FT51R, 7800R, FTM400
Scanners: BCD396XT, BCD996XT, HomePatrol-1, Pro-163, Pro-164, Regency MX3000
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 4:39 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