TwoToneDetect TwoToneDetect on a Raspberry Pi - How To

Status
Not open for further replies.

agaede2

Member
Joined
Jan 24, 2015
Messages
30
Location
Eau Claire, WI
Does anybody know how to FTP from pi to a desktop automatically? Im trying to send the audio files to my desktop where i have all the calls archived and from there im hosting them so people can go back and listen.
 

DC31

Member
Feed Provider
Joined
Feb 19, 2011
Messages
1,555
Location
Massachusetts
Finally got it figured out. TTD on reboot kept hanging up and would not start, most of the time pulseaudio wouldnt start, most of the time my sound card would not be seen.

To fix this, I made a script that issued the "arecord -l" command to make the pi look for the card. Then i delayed for 10 sec, and then issued "pulseaudio --start". and put that script in crontab -e. Also i have TTD waiting 20 sec to start, then another 20 seconds later darkice starts. So for this has worked for multiple reboots.

Thanks for the help. Unfortunately, it didn't work for me. TTD would still simply hang when I tried to startt it. Pulseaudio --start would also not start anything. pacmd would returne Daemon not running. Still odd that it ran for a day the other day just fine.

So I did some more googling and found this:


Check if daemon is running
#sudo /etc/init.d/pulseaudio status

Manually start pulseaudio in system mode
Using config in /etc/pulse/system.pa
#sudo pulseaudio -vvv --system


When I ran the status check it warned me that I was running in per user mode.

So I tried the next line to start it in system mode and voila! it now works. Time will tell if it stays working.

Now to figurre out how to get it to boot in system mode.

Jim
 

DC31

Member
Feed Provider
Joined
Feb 19, 2011
Messages
1,555
Location
Massachusetts
Does anybody know how to FTP from pi to a desktop automatically? Im trying to send the audio files to my desktop where i have all the calls archived and from there im hosting them so people can go back and listen.

I have an ftp upload script that uploads each alert to a web server. I don't know if that will work to put it on your desktop but it almost sounds like you want it to end up at a web server in the end anyway.

Also have another python script that uploads each alert to audioboo. Then audioboo posts each alert to Twitter. @ShelburneFire

Do either of these sound like something you could use. They are quite small and simple scripts that work well. Let me know and I will strip out my credentials and post them.
 

DC31

Member
Feed Provider
Joined
Feb 19, 2011
Messages
1,555
Location
Massachusetts
Upload scripts

here are links to the two python scripts that will upload the audio files created by TTD.


Audioboo upload:
https://drive.google.com/file/d/0B9sLdBjMInCVaThCc0ZOVE9sc1U/view?usp=sharing

FTP upload:
https://drive.google.com/file/d/0B9sLdBjMInCVblR3NmN0bUI5bEk/view?usp=sharing

Then in your tones.cfg section:

post_email_command = ftpupload.py [mp3]

Make sure that the file name matches that of the script. The script needs to be saved in the same directory as the TTD program file. Same for the audioboo script.

You will need to put in all your email and ftp server credentials in the scripts to make them work. In Linux on the pi use the nano text editor or you can sometimes use the plain text editor on your computer to make the changes before putting the files on the pi.

You will need to have an FTP server set up to receive the files from the ftpupload script.

You will need to set up and audioboo.com account and get your special email address to set up the audioboo upload. Then from audioboo, you can autopost to Twitter if you are so inclined.

Jim
 

Taylor_425

Member
Premium Subscriber
Joined
Jul 24, 2012
Messages
52
Location
Fort Erie, Ontario
Well another 24hrs, still getting good detection's. Had to tweak some of the long tones to correct from what I am assuming is the audio card I am using is different from my Windows PC. I also had to tweak my crontab restart command. But haven't had any other issues.

DC31 I ran that status check command and got the same warning [warn] PulseAudio configured for per-user sessions ... (warning)..... I remember reading here that running PulseAudio in System mode is not recommended WhatIsWrongWithSystemWide
 

DC31

Member
Feed Provider
Joined
Feb 19, 2011
Messages
1,555
Location
Massachusetts
Well another 24hrs, still getting good detection's. Had to tweak some of the long tones to correct from what I am assuming is the audio card I am using is different from my Windows PC. I also had to tweak my crontab restart command. But haven't had any other issues.

DC31 I ran that status check command and got the same warning [warn] PulseAudio configured for per-user sessions ... (warning)..... I remember reading here that running PulseAudio in System mode is not recommended WhatIsWrongWithSystemWide

Correct, but it also says that you may want to run it this way on thin clients. Most of the issues are one user changing another users settings. I am the only user.
 

agaede2

Member
Joined
Jan 24, 2015
Messages
30
Location
Eau Claire, WI
here are links to the two python scripts that will upload the audio files created by TTD.


Audioboo upload:
https://drive.google.com/file/d/0B9sLdBjMInCVaThCc0ZOVE9sc1U/view?usp=sharing

FTP upload:
https://drive.google.com/file/d/0B9sLdBjMInCVblR3NmN0bUI5bEk/view?usp=sharing

Then in your tones.cfg section:

post_email_command = ftpupload.py [mp3]

Make sure that the file name matches that of the script. The script needs to be saved in the same directory as the TTD program file. Same for the audioboo script.

You will need to put in all your email and ftp server credentials in the scripts to make them work. In Linux on the pi use the nano text editor or you can sometimes use the plain text editor on your computer to make the changes before putting the files on the pi.

You will need to have an FTP server set up to receive the files from the ftpupload script.

You will need to set up and audioboo.com account and get your special email address to set up the audioboo upload. Then from audioboo, you can autopost to Twitter if you are so inclined.

Jim

Thanks Jim, That is what im looking for.
 

agaede2

Member
Joined
Jan 24, 2015
Messages
30
Location
Eau Claire, WI
here are links to the two python scripts that will upload the audio files created by TTD.


Audioboo upload:
https://drive.google.com/file/d/0B9sLdBjMInCVaThCc0ZOVE9sc1U/view?usp=sharing

FTP upload:
https://drive.google.com/file/d/0B9sLdBjMInCVblR3NmN0bUI5bEk/view?usp=sharing

Then in your tones.cfg section:

post_email_command = ftpupload.py [mp3]

Make sure that the file name matches that of the script. The script needs to be saved in the same directory as the TTD program file. Same for the audioboo script.

You will need to put in all your email and ftp server credentials in the scripts to make them work. In Linux on the pi use the nano text editor or you can sometimes use the plain text editor on your computer to make the changes before putting the files on the pi.

You will need to have an FTP server set up to receive the files from the ftpupload script.

You will need to set up and audioboo.com account and get your special email address to set up the audioboo upload. Then from audioboo, you can autopost to Twitter if you are so inclined.

Jim

so i had a hard time with the python script, but i know shell script. So i got the ftp working, but want i want is if the file DID copy to my server then i want it to delete the file on the pi. Do you know a way to do that?
 

DC31

Member
Feed Provider
Joined
Feb 19, 2011
Messages
1,555
Location
Massachusetts
so i had a hard time with the python script, but i know shell script. So i got the ftp working, but want i want is if the file DID copy to my server then i want it to delete the file on the pi. Do you know a way to do that?

I use a crontab job to delete the audio files daily. Would that work for you?
 

aaknitt

Member
Feed Provider
Joined
Aug 27, 2005
Messages
1,303
That would but if the server goes down and the files dont get copied then i dont want them to be deleted.

You can set up a script to only delete files that are more than X days old. That way they'd stay on the Pi for a few days to increase the odds that they got copied.

Andy
 

DC31

Member
Feed Provider
Joined
Feb 19, 2011
Messages
1,555
Location
Massachusetts
im starting to play with TTD Redundant.cfg. What happends if one or both TTD's cant find the common text file?

If it can't find the common text file, it sends you an email telling you that TTD is down on one of your computers.

I have had redundant TTD's running on two pi's at remote locations for about two weeks now. Initiallly, I had a couple false emails telling me that one was down and a couple duplicate emails on tone decode. Setting the delay up to 60 seconds seems to have corrected this. otherwise, they are working fine.
 

aaknitt

Member
Feed Provider
Joined
Aug 27, 2005
Messages
1,303
Still the same thing, power up the pi and i get a solid green light for 1 sec then nothing.

I uploaded a new image last night. Hopefully third time's the charm. Let me know if this one works for you.

Andy
 

kenmaples

Member
Joined
Feb 1, 2010
Messages
73
Location
Port Orchard, WA
After years of running TTD on Windows, I have finally decided to migrate to a Raspberry Pi 2. I have the basics up and running. One sound card feeding TTD via pulse, a second sound card feeding darkice directly for broadcasting working channels, and a no-ip client running to keep my DNS updated.

I have not done anything with maintenance yet. Are the start up and maintenance scripts are posted somewhere? I would like to reuse the work that has already been completed if possible.

Thanks!
 

DC31

Member
Feed Provider
Joined
Feb 19, 2011
Messages
1,555
Location
Massachusetts
Ken, How did you get it up and running on the Pi2? Did you simply follow the instructions that Andy has posted on setting it up on a Pi? Or did you download an image and go from there? I have been running a test setup on a Pi2 for a week or so now. It runs fine but I have an awful time getting pulseaudio loaded if I reboot the pi. As long as I stop and restart only TTD, not a problem, it is when I do a full reboot. I haven't really figured out what it is that I do the times that I do get it to load.

I have noticed the audio processes quite a bit quicker with the Pi2. The conversion to .mp3 or .amr used to be 6-7 seconds. now it is more like 2-3 seconds. I am also streaming audio but from the same sound card as TTD uses.

What type of maintenance scripts are you looking for? A daily reboot?

Jim
 

kenmaples

Member
Joined
Feb 1, 2010
Messages
73
Location
Port Orchard, WA
Ken, How did you get it up and running on the Pi2? Did you simply follow the instructions that Andy has posted on setting it up on a Pi? Or did you download an image and go from there? I have been running a test setup on a Pi2 for a week or so now. It runs fine but I have an awful time getting pulseaudio loaded if I reboot the pi. As long as I stop and restart only TTD, not a problem, it is when I do a full reboot. I haven't really figured out what it is that I do the times that I do get it to load.

I have noticed the audio processes quite a bit quicker with the Pi2. The conversion to .mp3 or .amr used to be 6-7 seconds. now it is more like 2-3 seconds. I am also streaming audio but from the same sound card as TTD uses.

What type of maintenance scripts are you looking for? A daily reboot?

Jim

I followed Andy's instructions for TTD, and a separate post for installing darkice and icecast2. I was not able to get the image to boot and chose not to mess with it as I know it was created for the original B\B+

I am currently booting into the GUI and allowing it to autostart my services (~/.config/autostart/). pulseaudio seems to work fine this route, but I see the same issues you are facing when not loading the GUI.

I am looking for the recording purge and start up scripts if you have them. I would like to eventually move away from booting to the GUI, but so far it is working fine.

Thanks
 
Status
Not open for further replies.
Top