TwoToneDetect TwoToneDetect on a Raspberry Pi - How To

Status
Not open for further replies.

DC31

Member
Feed Provider
Joined
Feb 19, 2011
Messages
1,545
Location
Massachusetts
Can someone host a finished, stable, image file? I've run through the setup 3 times with a couple different sound cards and its never stable. Either the program freezes after a couple days with no error or it fails to load from a psaudio error. List the sound card and I'll get it.

The image size including the gui has gotten too big to share effectively.

Have you tried the instructions listed above (#781)? Start with a freshly imaged SD card using the full Raspbian Stretch GUI install. If you use a card that you have been attempting the installation with, it is almost guaranteed to fail.

http://forums.radioreference.com/th...spberry-pi-how-to.262868/page-40#post-3029808
That should take you to post #781

Then the three dependencies that you need are in #786.
 

DC31

Member
Feed Provider
Joined
Feb 19, 2011
Messages
1,545
Location
Massachusetts
@squirrel

http://forums.radioreference.com/th...rks-python-based.216758/page-196#post-3053017

you need to autostart pavucontrol and then autostart TTD when the pi boots.

Do this by creating a sub-directory titled autostart in the /home/pi/.config directory on your pi.

Then place the two attached files in the autostart directory and change the .txt to .desktop. (pulseaudio.desktop...)

You may need to edit the twotonedetect.desktop file to point to the correct directory and the correct file name on your pi.
 

Attachments

  • pavucontrol.txt
    186 bytes · Views: 29
  • TwoToneDetect.txt
    196 bytes · Views: 27

bikeplatt

Newbie
Joined
Jan 3, 2019
Messages
3
I tried again tonight and it looks good for now.
I had a version running for a couple of years but kept having issues with it freezing up. When I tried the new install I must have missed something or should have done a true fresh install.
In the autostart I had to change the TwoToneDetect.desktop file as TwoToneDetect70.pyc was missing the "c". I'll watch how stable it is and see if a daily reboot is needed.
THANK YOU
DFD Dodgeville,WI
 

bikeplatt

Newbie
Joined
Jan 3, 2019
Messages
3
had a call and everything worked but when got home it had an error just after sending the text.

Expression 'alsa_snd_pcm_poll_descriptors_revents( self->pcm, pfds, self->nfds, &revents )' failed in 'src/hostapi/alsa/pa_linux_alsa.c', line: 3659
Expression 'PaAlsaStreamComponent_EndPolling( &self->capture, capturePfds, &pollCapture, &xrun )' failed in 'src/hostapi/alsa/pa_linux_alsa.c', line: 3876
Expression 'PaAlsaStream_WaitForFrames( stream, &framesAvail, &xrun )' failed in 'src/hostapi/alsa/pa_linux_alsa.c', line: 4423
Exception in Tkinter callback
Traceback (most recent call last):
File "/usr/lib/python2.7/lib-tk/Tkinter.py", line 1545, in __call__
return self.func(*args)
File "/usr/lib/python2.7/lib-tk/Tkinter.py", line 595, in callit
func(*args)
File "TwoToneDetect70.py", line 1054, in start
File "TwoToneDetect70.py", line 1029, in record
File "/usr/lib/python2.7/dist-packages/pyaudio.py", line 608, in read
return pa.read_stream(self._stream, num_frames, exception_on_overflow)
IOError: [Errno -9999] Unanticipated host error
 

DC31

Member
Feed Provider
Joined
Feb 19, 2011
Messages
1,545
Location
Massachusetts
had a call and everything worked but when got home it had an error just after sending the text.

Expression 'alsa_snd_pcm_poll_descriptors_revents( self->pcm, pfds, self->nfds, &revents )' failed in 'src/hostapi/alsa/pa_linux_alsa.c', line: 3659
Expression 'PaAlsaStreamComponent_EndPolling( &self->capture, capturePfds, &pollCapture, &xrun )' failed in 'src/hostapi/alsa/pa_linux_alsa.c', line: 3876
Expression 'PaAlsaStream_WaitForFrames( stream, &framesAvail, &xrun )' failed in 'src/hostapi/alsa/pa_linux_alsa.c', line: 4423
Exception in Tkinter callback
Traceback (most recent call last):
File "/usr/lib/python2.7/lib-tk/Tkinter.py", line 1545, in __call__
return self.func(*args)
File "/usr/lib/python2.7/lib-tk/Tkinter.py", line 595, in callit
func(*args)
File "TwoToneDetect70.py", line 1054, in start
File "TwoToneDetect70.py", line 1029, in record
File "/usr/lib/python2.7/dist-packages/pyaudio.py", line 608, in read
return pa.read_stream(self._stream, num_frames, exception_on_overflow)
IOError: [Errno -9999] Unanticipated host error
Are your audio input and output devices set similar to this:
731FC31A-BEA8-456F-AE40-5E45C1E94E2B.jpeg
 

squirrel

Member
Premium Subscriber
Joined
Jan 4, 2006
Messages
110
@squirrel

http://forums.radioreference.com/th...rks-python-based.216758/page-196#post-3053017

you need to autostart pavucontrol and then autostart TTD when the pi boots.

Do this by creating a sub-directory titled autostart in the /home/pi/.config directory on your pi.

Then place the two attached files in the autostart directory and change the .txt to .desktop. (pulseaudio.desktop...)

You may need to edit the twotonedetect.desktop file to point to the correct directory and the correct file name on your pi.


Thanks for the files. I was able to get pulseaudio to autostart, but have not been successful with getting TTD to start. I have verified the path and file name are correct. Not sure what I am missing? It also appears my TwoToneDetect70 has no extension.
 
Last edited:

KE5ELI

Newbie
Joined
Apr 14, 2011
Messages
1
Location
New Braunfels, TX
Hello All,

I have been running TTD on a windows machine for several years now with no issues. The hardware is finally giving up so I dusted off the RPi 3 B I purchased a few years ago and headed out to replace my windows box. I was excited to see that there was a new version out and a specific version for the Pi. I followed Andy's instructions off the TTD website and I have it up and running. My problem is that it is not stable. It will run for 2 to 5 days fine and then just quit receiving audio. I have read through a lot of this thread and I think I have gathered that this is "normal" and so I need to setup the Pi to reboot every X (daily, 3 days, something) to compensate for this. I went back in the thread to post 703 where DC31 (Jim I believe) posted a Pi image running TTD70 with most of the things needed taken care of like reboot, autostart, audio file cleanup, etc. I downloaded that image this evening, but i have not done anything with it. Reading further I see that there was some problems with that and it needed to be fixed and then hosted on torrent and so I don't know if that image is any good. So question #1, is that a good image or no??

Moving on down the thread I see where Jim later posts about the image getting to big to share and posting a procedure similar to what is on the TTD website. In Jim's directions in post 781 and dependencies in 786 he references using the windows version of TTD on the Pi. Question #2, is this the preferred method and more stable than the pi version of TTD??

My 1st goal is to get a stable system back up and running for alerting.
My 2nd goal would be to get the push alerts and hosted tones.cfg and a redundant setup up and functioning.

I want to say thanks to everyone who has shared on this thread. I think all the pieces I need are here, I am just having a hard time putting them all together in one place so I can get up and running.

Jeremy
 

DC31

Member
Feed Provider
Joined
Feb 19, 2011
Messages
1,545
Location
Massachusetts
Hello All,

I have been running TTD on a windows machine for several years now with no issues. The hardware is finally giving up so I dusted off the RPi 3 B I purchased a few years ago and headed out to replace my windows box. I was excited to see that there was a new version out and a specific version for the Pi. I followed Andy's instructions off the TTD website and I have it up and running. My problem is that it is not stable. It will run for 2 to 5 days fine and then just quit receiving audio. I have read through a lot of this thread and I think I have gathered that this is "normal" and so I need to setup the Pi to reboot every X (daily, 3 days, something) to compensate for this. I went back in the thread to post 703 where DC31 (Jim I believe) posted a Pi image running TTD70 with most of the things needed taken care of like reboot, autostart, audio file cleanup, etc. I downloaded that image this evening, but i have not done anything with it. Reading further I see that there was some problems with that and it needed to be fixed and then hosted on torrent and so I don't know if that image is any good. So question #1, is that a good image or no??

Moving on down the thread I see where Jim later posts about the image getting to big to share and posting a procedure similar to what is on the TTD website. In Jim's directions in post 781 and dependencies in 786 he references using the windows version of TTD on the Pi. Question #2, is this the preferred method and more stable than the pi version of TTD??

My 1st goal is to get a stable system back up and running for alerting.
My 2nd goal would be to get the push alerts and hosted tones.cfg and a redundant setup up and functioning.

I want to say thanks to everyone who has shared on this thread. I think all the pieces I need are here, I am just having a hard time putting them all together in one place so I can get up and running.

Jeremy

Don’t waste your time with post 703. Go to 781/786. This procedure uses the Linux version of TTD, not the Windows version. The Windows version uses the files ending in .exe. They will not work on the pi. Copy over the two python files and two .cfg files highlighted in the attached screenshot. Get TTD up and running to your satisfaction before attempting the autostart setup. Just remember to open pulse audio volume control before starting TTD. Very important that you start with a fresh updated Raspbian image also.
 

squirrel

Member
Premium Subscriber
Joined
Jan 4, 2006
Messages
110
Thanks for the files. I was able to get pulseaudio to autostart, but have not been successful with getting TTD to start. I have verified the path and file name are correct. Not sure what I am missing? It also appears my TwoToneDetect70 has no extension.

For anyone that might run into this.... I figured out how to get it going. If you follow the install instructions on TTD's website and install using curl it appears that installs a executable file. I modified my TTD autostart script as follows and all is working:

[Desktop Entry]
Version=1.0
Name=TTD
Exec=/bin/sh -c "sleep 20; cd /home/pi/TTD ; ./TwoToneDetect70"
Terminal=false
Type=Application
X-GNOME-Autostart-Phase=Initialization
NotShowIn=KDE;
 

n6oi

Member
Joined
Dec 1, 2018
Messages
8
Location
San Jose, CA
I'm having trouble getting TTD to upload mp3 files to the specified directory on my web server. I'm sure it's something simple, but I can't seem to figure it out. Does anyone else do this successfully?

Here are the settings that I currently have in TTD's config.cfg file:
- FTP Server: www.mydomain.org/
- FTP Port: 21
- FTP Username: me@mydomain.org
- FTP Password: *********
- Hyperlink Prefix: http://www.mydomain.org/audio/

The goal, obviously, is to have the file uploaded into the /audio directory. The mp3 file uploads fine, but ends up in the root directory of my user account. By root directory, I mean the actual root directory of the user, not the public_html (or www) directory. What am I missing that is resulting in the file being in the root directory instead of the /audio directory?

Frank
 

DC31

Member
Feed Provider
Joined
Feb 19, 2011
Messages
1,545
Location
Massachusetts
The ones that I have seen start ftp.mydomain.org. I am really no expert on that so take whatever I say with a good dose of salt. However, I can report that mine has worked flawlessly for a couple years now uploading to a public ftp server. You may need to research with your domain provider the proper address of the ftp server.
 

n6oi

Member
Joined
Dec 1, 2018
Messages
8
Location
San Jose, CA
The ones that I have seen start ftp.mydomain.org. [...] You may need to research with your domain provider the proper address of the ftp server.
That's a good point. I use FireZilla to ftp files to/from this server all the time, and it's configured with www.mydomain.org rather than ftp.mydomain.org. But I suppose it's possible that the ftp integration in TTD would behave differently. I'll give that a shot. Thanks.
 

aaknitt

Member
Feed Provider
Joined
Aug 27, 2005
Messages
1,298
I'm having trouble getting TTD to upload mp3 files to the specified directory on my web server. I'm sure it's something simple, but I can't seem to figure it out. Does anyone else do this successfully?

Here are the settings that I currently have in TTD's config.cfg file:
- FTP Server: www.mydomain.org/
- FTP Port: 21
- FTP Username: me@mydomain.org
- FTP Password: *********
- Hyperlink Prefix: http://www.mydomain.org/audio/

The goal, obviously, is to have the file uploaded into the /audio directory. The mp3 file uploads fine, but ends up in the root directory of my user account. By root directory, I mean the actual root directory of the user, not the public_html (or www) directory. What am I missing that is resulting in the file being in the root directory instead of the /audio directory?

Frank

The built-in FTP upload function doesn't currently support uploading to anywhere except the root directory. This will be addressed in the next release. In the meantime, you can either set up an FTP account that goes directly to your /audio directory (as its root), or use the ftpuploader.py script and call it using the post_email_command parameter. Details on script usage can be found in the "v69 and prior" section of this page.

Andy
 

n6oi

Member
Joined
Dec 1, 2018
Messages
8
Location
San Jose, CA
The built-in FTP upload function doesn't currently support uploading to anywhere except the root directory...
Ah-ha! Thank you very much, Andy -- it's good to know that it isn't a config problem on my end.

If the documentation mentions that the ftp functionality is limited to just the root directory, obviously I missed that. I saw the example on the page that shows a sub-directory ("The upload_file_prefix should be set to the web storage location where the audio files can be accessed via http. For example: http://www.mywebsite/audiofiles/") and assumed I could specify one for the upload. I should know better than to assume...

In that case, I may look at setting up a user with the sub-directory as it's root. That should be simple enough. I'll take a look at ftpuploader.py too.

Thanks again.
 

n6oi

Member
Joined
Dec 1, 2018
Messages
8
Location
San Jose, CA
I've tried using ftpuploader, but it's not working. Here is what I entered in the post_email_command parameter:
python ftpuploader.py [mp3] ftp.mydomain.org user@mydomain.org userpassword --remotepath /audio/

Short of actually finding the mp3 file where it should be -- which it is not -- how do I know if ftpuploader is running successfully? Is there any logfile for it?

Thanks, Frank
 

DC31

Member
Feed Provider
Joined
Feb 19, 2011
Messages
1,545
Location
Massachusetts
It appears that you are running the script from the post_email_command parameter which is correct, but yo7 won’t get any feedback. Try running it manually from the command line to see what you get for error messages. Substitute a filename for [mp3], something like filename.txt. Just make sure there is a file by that name in your active directory.

python ftpuploader.py filename.txt ftp.mydomain.org user@mydomain.org userpassword --remotepath /audio/
 

n6oi

Member
Joined
Dec 1, 2018
Messages
8
Location
San Jose, CA
Thanks, DC31... I should have thought of running it from the command line. That gave me the feedback I needed to be able to see what the error was.

As it turned out, the problem was permission based -- the user I created for this didn't have permission to write to the /audio/ directory. A rookie mistake... (sigh)

Thanks again,
Frank
 

jsncrso

KN4ZVZ
Feed Provider
Joined
Sep 12, 2009
Messages
249
Location
Outer Banks, NC
Apologies if this has been asked earlier in the thread (I looked), but will this run on a Pi that's also running a Broadcastify feed? There will be two different scanners, one for the feed and one for TTD, and both will be running off of either two different soundcards of off a different channel on a single sound card.
 
Status
Not open for further replies.
Top