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
  #81 (permalink)  
Old 05-15-2013, 9:49 PM
Member
  Premium Subscriber
Premium Subscriber
 
Join Date: Aug 2005
Posts: 1,090
Default

Quote:
Originally Posted by davidVT View Post
Andy would you consider a heartbeat subroutine that we could use to flash a user supplied LED/resistor on the PI? I want to end up with a headless setup but knowing the program itself is still running is crucial.
It's certainly possible, but not quite as easy as you would think. Accessing the GPIO pins on the Pi requires super user (sudo) access. Running TTD as sudo doesn't play well with pyaudio, since pyaudio is set up per-user. There is a way to run pyaudio in system mode, and that may be one solution, but I haven't messed with it yet. Running a second script in parallel with TTD that blinks and LED would be really simple, but I don't think that's what you're looking for.

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
Sponsored links
  #82 (permalink)  
Old 05-15-2013, 9:52 PM
Member
  Premium Subscriber
Premium Subscriber
 
Join Date: Aug 2005
Posts: 1,090
Default

In the "level" column, does it look like the level is maxing out or clipping? I'm wondering if your audio levels are causing distortion. Do the values in the frequency column look reasonable?

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
  #83 (permalink)  
Old 05-16-2013, 2:27 AM
davidVT's Avatar
Member
  Audio Feed Provider
Audio Feed Provider
 
Join Date: Aug 2010
Location: Washington County,Vermont
Posts: 102
Default

Hello Andy,
As to the watchdog idea, if a second routine (systemWD) were to run at sudo level to ping the GPIO, can it take input from the TTD script running at user level?
TTD(user) >>systemWD(sudo)>>GPIO(hw)>>LED(hw)

As to sound levels, the jury is still out on the sound levels. I rebooted the PI after my report last night and I am awake now after the 4 th successful page from PI by 2:30am. No changes to settings, just a reboot.

The irony here is that my request for a watchdog would not have helped during that strange failure period as TTD seems to have been running despite zero detections.

If I drop Debian on one of my old Dell Optiplex P4 test boxes, I should be able to duplicate the PI TTD experience fairly easily including,the USB sound card, correct? Not giving up on the PI, just looking to understand the TTD and OS interaction on hardware I am more familiar with.

As to the PI,I will purchase a few SD cards. I want to try the recently posted image and also make a fresh new image of my own.
Reply With Quote
  #84 (permalink)  
Old 05-16-2013, 4:33 AM
Member
  Audio Feed Provider
Audio Feed Provider
 
Join Date: Feb 2011
Location: Massachusetts
Posts: 970
Default

Quote:
Originally Posted by DC31 View Post
Okay, Mike, let's try this again. I have saved the image and it is in a compressed file at:



Download piTTD from SourceForge.net

This is my first experience with SourceForge so I don't really know if I did it right. The compressed file is around 1 Gb so don't expect a quick download. Then you will need to extract the file to your computer and then flash the resulting .img file to your SD card. no guarantees...

Good luck with it and let me know how it works out.
Hey Pi Guys:

I extracted the image file from my computer (the source file that I uploaded) and then flashed it to an SD card to see if it worked. Yes, it does. Then put the card into the Pi and it works perfectly, so I am cautiously optimistic that you might find the image that I uploaded useable. After I uploaded it, I realized that I didn't change the boot username and password so send me an email or PM when you have it flashed to an SD card and I will provide you that information. You might ask why not just change them and make a new image? The creation of the image file took over 8 hours (like the screen says "be patient, this may take a long time"), then about another half hour to upload it to SourceForge.

When you flash your SD card, it again says "be patient". Flashing my SD card took 2 hours. (9422 seconds to be exact)

Good luck

Jim
Reply With Quote
  #85 (permalink)  
Old 05-16-2013, 5:52 AM
davidVT's Avatar
Member
  Audio Feed Provider
Audio Feed Provider
 
Join Date: Aug 2010
Location: Washington County,Vermont
Posts: 102
Default PI AUDIO

I came across some information for audio on the PI if anyone else is trying to come up to speed on the PI audio as it relates to TTD.

How do capture audio using Python? - Raspberry Pi Stack Exchange

I will experiment with this one which also provides an idea to allow real time playback to another computer.

Raspberry Pi into an audio spying device | Masumi Mutsuda

So I just tried some of this from the 'spy' link above (see below) and did record the test.wav file but I am unable to play back to anything thus far. I viewed the file in MC and can see the header and what looks like sound content. During the recording I see the LED on the USB sound card flashing. That should mean I can use it to see if TTD is sampling the card in the future as a stop gap heartbeat.

------- content from the above link -------
Now we can try to record some audio into a file by running:

arecord -D plughw:1,0 test.wav
Just press CTRL+C once you think you’ve got enough recording. Now let’s play it to see if it works! But first, plug your earphones to the audio output of your Raspberry Pi!

aplay test.wav
--------

Now to fire TTDpi back up, hoping I did not break anything during my sound experiments.

Last edited by davidVT; 05-16-2013 at 6:17 AM..
Reply With Quote
Sponsored links
  #86 (permalink)  
Old 05-18-2013, 6:24 AM
davidVT's Avatar
Member
  Audio Feed Provider
Audio Feed Provider
 
Join Date: Aug 2010
Location: Washington County,Vermont
Posts: 102
Default

Andy I did find the audio was being clipped by observing the right column was going full scale. Using your instructions and pavucontrol I was able to improve the audio quality. Waiting for a few days of tones before declaring that issue resolved. As to getting any sound out of my PI or the USB audio card, that remains a struggle.
Reply With Quote
  #87 (permalink)  
Old 05-18-2013, 11:25 PM
Member
  Premium Subscriber
Premium Subscriber
 
Join Date: Aug 2005
Posts: 1,090
Default

Jim or anyone else, have you figured out a way to start TTD automatically when the Pi starts? I've been trying for an hour and am giving up for the night.

I'd like to be able to have it start but still be able to check on it remotely after it starts. As far as I can tell the only way to do this is to start X-Windows, have TTD start in a terminal window, and then use VNC to log in to monitor it later.

I've been trying to create a .desktop file that executes the script and/or a terminal window with the script, but can't seem to get the right combination nailed down. Any advice?

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
  #88 (permalink)  
Old 05-19-2013, 4:53 AM
Member
  Audio Feed Provider
Audio Feed Provider
 
Join Date: Feb 2011
Location: Massachusetts
Posts: 970
Default

Quote:
Originally Posted by aaknitt View Post
Jim or anyone else, have you figured out a way to start TTD automatically when the Pi starts? I've been trying for an hour and am giving up for the night.

I'd like to be able to have it start but still be able to check on it remotely after it starts. As far as I can tell the only way to do this is to start X-Windows, have TTD start in a terminal window, and then use VNC to log in to monitor it later.

I've been trying to create a .desktop file that executes the script and/or a terminal window with the script, but can't seem to get the right combination nailed down. Any advice?

Andy
The only thing that i have tried is the script that i discussed earlier in this thread. I found that it didn't work well and also really ate up processor resources. I didn't invest more effort into it. Let me check with my linux guru...

Otherwise, the pi has been running continuously without a hitch since i figured out the problem with the wireless and went to wired ethernet. But yes, auto start on boot up would be nice.
Reply With Quote
  #89 (permalink)  
Old 05-19-2013, 1:45 PM
davidVT's Avatar
Member
  Audio Feed Provider
Audio Feed Provider
 
Join Date: Aug 2010
Location: Washington County,Vermont
Posts: 102
Default

We are probably finding the same links in our searches but have you tried this? It wants the desktop running which I want to avoid if possible..

Raspberry Pi - Autostarting a Python Program

It is about first making the desktop link work and then moving that into .config/autostart.

Andy I believe I am having the same issue as you are with finding the proper way to call your compiled routine via the link. I am going to do a simple hello world script for a sanity check.

Last edited by davidVT; 05-19-2013 at 2:16 PM..
Reply With Quote
  #90 (permalink)  
Old 05-19-2013, 4:07 PM
Member
  Premium Subscriber
Premium Subscriber
 
Join Date: Aug 2005
Posts: 1,090
Default

Quote:
Originally Posted by davidVT View Post
We are probably finding the same links in our searches but have you tried this? It wants the desktop running which I want to avoid if possible..

Raspberry Pi - Autostarting a Python Program

It is about first making the desktop link work and then moving that into .config/autostart.

Andy I believe I am having the same issue as you are with finding the proper way to call your compiled routine via the link. I am going to do a simple hello world script for a sanity check.
Yep, that's what I've been trying. No luck yet. I've also tried using the same technique to start a bash script that in turn starts the python program, but no luck with that either.

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
  #91 (permalink)  
Old 05-19-2013, 4:31 PM
davidVT's Avatar
Member
  Audio Feed Provider
Audio Feed Provider
 
Join Date: Aug 2010
Location: Washington County,Vermont
Posts: 102
Default

Andy,
I was able to start your script with the bash script finally. However I can not yet do it from a startup process.

Another item you might help with?
I have to reboot every time I shut down TTDpi. The second or more start attempt always errors with NameError: global name 'stream' is not defined. With reference to lines 706 and 695
Perhaps I am not shutting down properly??
Reply With Quote
  #92 (permalink)  
Old 05-19-2013, 7:36 PM
Member
  Audio Feed Provider
Audio Feed Provider
 
Join Date: Feb 2011
Location: Massachusetts
Posts: 970
Default

Quote:
Originally Posted by davidVT View Post
Andy,
I was able to start your script with the bash script finally. However I can not yet do it from a startup process.

Another item you might help with?
I have to reboot every time I shut down TTDpi. The second or more start attempt always errors with NameError: global name 'stream' is not defined. With reference to lines 706 and 695
Perhaps I am not shutting down properly??
Dave,

I haven't experienced the rebooting problem. I am usually running TTD under Screen. When I want to shut down TTD I simply do a Cntrl-C. If I want to shut down my Terminal window but keep TTD running (this is usually the case) it is Cntrl-A, D. this detaches the screen from terminal. To reattach the screen type screen -r at the Linux prompt.

Probably not telling you anything you don't know already...

Do you have any experience with Crontab? Cron seems that it could be set up to start TTD on booting the Pi. I am working on it with my guru to see if we can configure it. If you have tried it already, please let me know if we are going down a dead end.

Jim
Reply With Quote
  #93 (permalink)  
Old 05-19-2013, 8:12 PM
davidVT's Avatar
Member
  Audio Feed Provider
Audio Feed Provider
 
Join Date: Aug 2010
Location: Washington County,Vermont
Posts: 102
Default

I am trying to stay in the command line only.
I like to use CTRL-Z and bg fg commands to hide TTD while working elsewhere.
This link is helpful about it.
Bash: send a running process to background

The stream fault thing on restart is a problem. Perhaps from me playing around with sound settings?

CRONTAB It has been years and I only used for things like restarting simple programs based on time of day, or moving log files, but never for something like this.

I looked at python daemon tutorials but quickly realized Andy is the only one that can work on that angle at this point.

I think several of us are trying to make this work so the solution is near!
Reply With Quote
  #94 (permalink)  
Old 05-19-2013, 9:03 PM
Member
  Audio Feed Provider
Audio Feed Provider
 
Join Date: Feb 2011
Location: Massachusetts
Posts: 970
Default

Quote:
Originally Posted by davidVT View Post
I am trying to stay in the command line only.
I like to use CTRL-Z and bg fg commands to hide TTD while working elsewhere.
This link is helpful about it.
Bash: send a running process to background

The stream fault thing on restart is a problem. Perhaps from me playing around with sound settings?

CRONTAB It has been years and I only used for things like restarting simple programs based on time of day, or moving log files, but never for something like this.

I looked at python daemon tutorials but quickly realized Andy is the only one that can work on that angle at this point.

I think several of us are trying to make this work so the solution is near!
I found it pretty simple to use Crontab to load TTD on reboot. The only problem is that I need to get past the login screen for it to work.

My line in Crontab is:

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

after rebooting the pi and signing in this loads TTD in a detached screen.

I seem to still be having problems with the audio input settings jumping around between 2 & 3. Many times when first loaded after a reboot it will try to use input 2. Simply restarting TTD will correct this and it will choose 3.
Reply With Quote
  #95 (permalink)  
Old 05-20-2013, 4:57 AM
Member
  Audio Feed Provider
Audio Feed Provider
 
Join Date: Feb 2011
Location: Massachusetts
Posts: 970
Default Usb sound issues

Andy,

I'd like to suggest a clarification in your setup instructions. I found the following note in another duscussion on the forums:


"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. "

I, likewise had added a line to the file, rather than modifying the one line that was there.

Here is what mine looks like now:


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


Thanks.
Reply With Quote
  #96 (permalink)  
Old 05-20-2013, 4:59 AM
davidVT's Avatar
Member
  Audio Feed Provider
Audio Feed Provider
 
Join Date: Aug 2010
Location: Washington County,Vermont
Posts: 102
Default

I get past the login prompt ( cmd line)with the first part of this article:
Auto Login and Auto Start in Raspberry Pi

I used the cron idea but changed the entry to my simple start script. I can confirm after two reboots that my sound card LED is flashing after boot and I see python in my 'top' output. I do not see the audio stream columns when I kick the scanner to weather. I do see a new log file in the TTD directory.

Maybe this is almost there... This effort is to gain autostart without the x-windows.
Python and pulse audio are top two on 'top' with 'I' command. Load average .15,.27,.13

Forgot I had to add 'screen' to the PI. AUTOSTART IS WORKING NOW!!

I will leave it running in this mode for today.

Back to the real job for now...

Last edited by davidVT; 05-20-2013 at 6:29 AM..
Reply With Quote
  #97 (permalink)  
Old 05-20-2013, 1:30 PM
Member
  Premium Subscriber
Premium Subscriber
 
Join Date: Aug 2005
Posts: 1,090
Default

Quote:
Originally Posted by DC31 View Post
Andy,

I'd like to suggest a clarification in your setup instructions. I found the following note in another duscussion on the forums:


"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. "

I, likewise had added a line to the file, rather than modifying the one line that was there.

Here is what mine looks like now:


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


Thanks.
Updated, thanks.

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
  #98 (permalink)  
Old 05-20-2013, 5:33 PM
davidVT's Avatar
Member
  Audio Feed Provider
Audio Feed Provider
 
Join Date: Aug 2010
Location: Washington County,Vermont
Posts: 102
Default

A quick update:
The auto started TTD sent me several pages today successfully. I came home and did a reboot with a successful hands off restart of TTD. Curiously the stream error has not occurred since I started doing the auto start.
Sound, despite my initial impression, is less that stellar. Usable but needs more work. I know nothing of Linux sound so it is a place for me to start digging.
Reply With Quote
  #99 (permalink)  
Old 05-20-2013, 8:58 PM
davidVT's Avatar
Member
  Audio Feed Provider
Audio Feed Provider
 
Join Date: Aug 2010
Location: Washington County,Vermont
Posts: 102
Default

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?
http://www.3cc.org/blog/2013/01/rasp...ng-off-the-pi/

I can confirm that it generated emails from several tones in this headless mode in the last 20 minutes.

Last edited by davidVT; 05-20-2013 at 10:17 PM.. Reason: Working in headless mode
Reply With Quote
  #100 (permalink)  
Old 05-20-2013, 10:43 PM
Member
  Premium Subscriber
Premium Subscriber
 
Join Date: Aug 2005
Posts: 1,090
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.
David,

Would you be able to post the contents of your cron file and the bash script you're using? I still haven't been able to get the magic combination figured out.

Thanks,

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
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 7:50 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