The RadioReference.com Forums

The RadioReference.com Forums (https://forums.radioreference.com/)
-   Streaming / Broadcasting / Audio Recording (https://forums.radioreference.com/streaming-broadcasting-audio-recording/)
-   -   New TwoToneDetect in the works - Python based (https://forums.radioreference.com/streaming-broadcasting-audio-recording/216758-new-twotonedetect-works-python-based.html)

aaknitt 07-19-2011 10:11 PM

New TwoToneDetect in the works - Python based
 
Hi all,

I've started work on a ground-up rewrite of my TwoToneDetect software (website of existing program and forum thread) using the Python language instead of the LabView language that it was originally written in. I'm doing this to make the code more accessible to other developers out there, as Python development doesn't require any expensive tools or programs. I'm also hoping this new version will be more stable (not crash every few days), although that remains to be seen. Finally, the new version handles stacked pages, which is something I know a lot of people really wanted. Development of this new version is still in its infancy, but I'm looking for a few people to start testing it. If you have experience with Python programming, all the better. Right now the basic functionality is there but it's really bare-bones, with no real GUI to speak of. Here's a snapshot of my "to do" list:

Supported Features
  • QuickCall2 format decoding
  • Stacked page handling
  • Email as mp3
  • Configurable record time
  • Configurable email
  • Configurable tone tolerance

Features still to add
  • Send to multiple email addresses
  • Add time of detection to email subject
  • Long tone support
  • Selectable sound card for recording, playback
  • Playback while recording after tone detection
  • Configurable audio file directory
  • Configurable squelch threshold
  • Level meter
  • Record delay
  • Exclude email during certain time of day
  • Scanner HOLD/SCAN control via serial port
  • GUI
  • Tone offset
  • Tone set detection display or log
  • Status on GUI

Once the program is a little further developed I'll create a new page on my website for it with instructions, etc. In the meantime, an zip file that has the EXE version of the program can be downloaded from SourceForge here:

Once you download the zip file, extract it and read the README.txt file for instructions on how to get the program configured and operating. Once I get a little more familiar with SourceForge, I'll also post the source code there so others can add features or make improvements. This is my first experience with Python, so development may be a little rough, but hopefully we'll end up with an improved version of the program. I've got a lot on my plate right now, so development might also be slow, but I wanted to get something released so people can start playing around with it and get some feedback in the pipe.

Any feedback is appreciated.

Regards,

Andy

aliby19 07-19-2011 10:16 PM

Hi Andy,

Great to hear! I will be more than happy to test (and do have some limited python experience), so whatever I can do to help, just let me know!

Thanks!

aaknitt 07-20-2011 3:59 PM

For now, I'd say download it and see if you can get it working. If it runs ok, try letting it run for several days and let me know if any issues pop up.

Thanks,

Andy

aaknitt 07-25-2011 11:30 PM

New Version Uploaded
 
I just uploaded a new version to SourceForge (what I'm calling version 40). The zip file contains both the EXE and the Python source code. Here's the link to get it. Here's a list of what's in this version:

Supported Features
- QuickCall2 format decoding
- Email as mp3
- Configurable record time
- Configurable email
- Configurable tone tolerance
- Send to multiple email addresses
- Selectable sound card for recording
- Selectable sound card for playback
- Record delay
- Add time of detection to email subject
- Playback while recording after tone detection
- Long tone support
- Configurable squelch threshold

Features still to add
- Configurable audio file directory
- Level meter
- Exclude email during certain time of day
- Scanner HOLD/SCAN control via serial port
- GUI
- Tone offset
- Tone set detection display or log
- Status on GUI

I've had it running for a day without any issues so far. Anyone else have any feedback yet?

Thanks,

Andy

asmith136 07-26-2011 3:40 PM

I tried the new Two Tone 40 but I am unable to get the program to run. Every time I open it it just keeps closing. When I use the Two Tone 30 it works fine. Is there a problem with the new one or am I missing something in the set up. I used the same setting for both.

aaknitt 07-26-2011 4:38 PM

Try opening a command prompt window and running the program from there (as opposed to just double clicking on the EXE file). That way if it spits out an error you'll be able to see what it is. If it does give you an error message, let me know what it is.

Thanks,

Andy

aaknitt 07-26-2011 4:55 PM

Also, just so you're aware, a few new items have been added to the config file from v30 to v40, so if you're trying to use the same config file that you downloaded with v30 that may give you some problems. Just open the v40 config file to see what new lines are, and copy those over to your v30 config file to avoid re-entering all of the info.

Andy

Jay911 07-26-2011 6:26 PM

I get home from vacation tomorrow afternoon. I have 0.21/0.24/0.25 chugging away on my home PC right now. I'll try to download 40 and give it a shot when I get back.

Any thoughts on whether this will perform any better/worse than the above, on Windows 7 and/or Windows 98 or XP?

johnmac 07-26-2011 10:12 PM

I had no luck with the first version. A cmd window opened and various numbers just scrolled forever.

Will give the new version a try tomorrow..

aaknitt 07-26-2011 10:17 PM

Quote:

Originally Posted by johnmac (Post 1580650)
I had no luck with the first version. A cmd window opened and various numbers just scrolled forever.

Will give the new version a try tomorrow..

Sounds like it may have been grabbing sound from the wrong sound card. In the first version it only used the default sound card. In the new version you can select which card to use.

I'm having some issues with the program crashing and causing a restart, trying to figure out if it's the sound card I'm using (which I've had similar issues with in the past) or the program.

Andy

asmith136 07-27-2011 10:37 AM

Ok I tried to open the new program in the command prompt and get an error her it is.

Traceback<most recent call last>:
File "<string>" , line 61 , in <module>
File "E:\Python\build\pyi.win32\TwoTone4\out PYZI.pyz/configParser" , line 322 , in get
configPasher. nosectionError: no section: ' section 1 '

aaknitt 07-27-2011 11:07 AM

Quote:

Originally Posted by asmith136 (Post 1580896)
Ok I tried to open the new program in the command prompt and get an error her it is.

Traceback<most recent call last>:
File "<string>" , line 61 , in <module>
File "E:\Python\build\pyi.win32\TwoTone4\out PYZI.pyz/configParser" , line 322 , in get
configPasher. nosectionError: no section: ' section 1 '

Ok that means it's not finding the config file info. Make sure that the config.cfg file is in the same directory as the program. If it is, make sure the first line of the config file is: [Section 1]


Andy

aaknitt 07-27-2011 11:13 AM

Quote:

Originally Posted by aaknitt (Post 1580915)
Ok that means it's not finding the config file info. Make sure that the config.cfg file is in the same directory as the program. If it is, make sure the first line of the config file is: [Section 1]

Aha! I just looked at the contents of the .zip file that got uploaded and I realized I forgot to rename the two config files before zipping them. Rename sampleconfig.cfg to config.cfg and rename sampletones.cfg to tones.cfg

That should do the trick. Sorry about the oversight, I'll upload a new .zip file with corrected filenames.

Andy

asmith136 07-27-2011 11:24 AM

That worked. Thanks

Forts 07-27-2011 1:23 PM

I just gave the new version a try... When it starts up all I get is a box that I can select my audio input and output devices with. And an Exit button at the bottom. Don't seem to see anything else at all....

aaknitt 07-27-2011 1:29 PM

Quote:

Originally Posted by Forts (Post 1580994)
I just gave the new version a try... When it starts up all I get is a box that I can select my audio input and output devices with. And an Exit button at the bottom. Don't seem to see anything else at all....

Yep, that's about all you'll get right now until the GUI is better developed. It should still be functional though as long as you have the config.cfg and tones.cfg files set up properly. Read the README.TXT file for more info.

Andy

johnmac 07-27-2011 1:33 PM

I have mine downloaded and set-up. Changed my sound card OK and updated the config files. Now just waiting for some activity. Will report back as soon as I get some activity, also converted my email password with no problem.

Forts 07-27-2011 1:40 PM

Quote:

Originally Posted by aaknitt (Post 1580995)
Yep, that's about all you'll get right now until the GUI is better developed. It should still be functional though as long as you have the config.cfg and tones.cfg files set up properly. Read the README.TXT file for more info.

Andy

Ahhhh ok! I was expecting something along the lines of the older version. Thanks!

aaknitt 07-27-2011 2:05 PM

You can do a limited check on functionality by unsquelching the scanner. You should then see some "random" numbers being displayed above the buttons on the GUI. What's being displayed is the most dominant frequency in the signal, but this only shows up when the audio level exceeds a certain level (as set in the config file).

Andy

aaknitt 07-27-2011 2:08 PM

For those doing testing, let me know if you get any double detections of the same page. I've had this occur a couple times but I haven't sat down to troubleshoot it yet. I'm pretty sure it has to do with the stacked page handling, and it's not a huge problem, but it is a bug. I end up getting two emails for the same page sometimes, but not always.

Thanks,

Andy

johnmac 07-27-2011 2:38 PM

OK - My first page came through. It decoded, recorded and converted to mp3 and emailed properly. Also only received 1 email. But, after that the program froze. I just re-started it, will see what happens.

Jay911 07-27-2011 4:06 PM

I installed it on my Win7 machine and it works just fine. Now I need to try it some time on my firehall machine (which is either XP or 98, I forget which) and see if I can get it to behave there.

EDIT: Is there a place to change "This is an email sent with python"? That's gonna confuse my recipients. :)

aaknitt 07-27-2011 4:13 PM

Quote:

Originally Posted by Jay911 (Post 1581086)
I installed it on my Win7 machine and it works just fine. Now I need to try it some time on my firehall machine (which is either XP or 98, I forget which) and see if I can get it to behave there.

EDIT: Is there a place to change "This is an email sent with python"? That's gonna confuse my recipients. :)

Yeah I'll try to get that out of there in the next release, I keep forgetting to yank it :lol:

asmith136 07-27-2011 5:08 PM

I have this running and I found that the email audio sounds tiny or has an echo. this is on the same computer that I had the Two Tone V24 running with no audio problems. When do you think the Tone offset feature available? Do you think you can add a feature that would stop the recording after a set time that there is no audio and send the email and use the record time as a Max timer. This way if the message is short the email will go faster and if its long message it will continue to record.

aaknitt 07-27-2011 5:24 PM

Quote:

Originally Posted by asmith136
I have this running and I found that the email audio sounds tiny or has an echo. this is on the same computer that I had the Two Tone V24 running with no audio problems.

Are you sure you're using the same sound card/audio settings that you were using in the past? It might be a little hard to tell since V24 didn't actually show which inputs and outputs you were using, it just enumerated them. I suspect you may be getting feedback through the sound card audio path during recording, but that's just a guess.

Quote:

Originally Posted by asmith136
When do you think the Tone offset feature available?

It's lower on the priority list, but won't be too difficult to add. In the meantime you can manually adjust the tone frequencies in the config file or just widen the threshold. I had to widen mine to about 3% to catch some of the local tones here.

Quote:

Originally Posted by asmith136
Do you think you can add a feature that would stop the recording after a set time that there is no audio and send the email and use the record time as a Max timer. This way if the message is short the email will go faster and if its long message it will continue to record.

This would be hard to get right, since if a dispatcher pauses partway through a dispatch it could terminate the recording, which wouldn't be desirable.

Andy

wscott 07-27-2011 10:23 PM

First, I just wanted to say that this is a great program and please continue the great work. I recently set up v40 and was sending some tests through. The system functioned perfectly multiple times. The only issue that I see is that the audio records at a slightly faster speed than the actual message.

johnmac 07-28-2011 9:05 AM

1 Attachment(s)
Update on my testing. I have v.40 running on two separate computers, Computer #1 seems to be working OK with no freeze-ups. There was a problem this morning with an error.(See attached text file, error is at the bottom of page) I believe this may have been a multiple tone situation, but not sure. I am monitoring a large dispatch center, but only using a few of the tones.

Computer #2 crashed overnight and now TwoTone will not load. This is mostlikely a problem with my computer as I have had issues with it in the past. I will download the program again and see if it will start.

This is a fantastic program, keep up the great work.

aaknitt 07-28-2011 10:27 AM

Quote:

Originally Posted by johnmac (Post 1581484)
Update on my testing. I have v.40 running on two separate computers, Computer #1 seems to be working OK with no freeze-ups. There was a problem this morning with an error.(See attached text file, error is at the bottom of page) I believe this may have been a multiple tone situation, but not sure. I am monitoring a large dispatch center, but only using a few of the tones.

Computer #2 crashed overnight and now TwoTone will not load. This is mostlikely a problem with my computer as I have had issues with it in the past. I will download the program again and see if it will start.

This is a fantastic program, keep up the great work.

Interesting error. Two possibilities here. First, it looks like you may have an email address you're trying to send to that's missing a .net at the end?

Also, It looks like your email provider may only allow one connection at a time. This could cause problems in a stacked page situation if the first email isn't done sending by the time the second one gets fired off. If you have a gmail account, I'd suggest trying sending with that and see if it clears up the issue. If connection limitation is a problem for a lot of people, I may need to rethink how the emails are sent after recording. Right now multiple email connections are set up in different threads, but I could figure out a way to process sending the emails in series rather than simultaneously if needed.

Andy

asmith136 07-28-2011 9:59 PM

If I make changes to your TwoToneDetect40.py file how do I convert it to a .exe/application?

johnmac 07-28-2011 10:58 PM

Quote:

Originally Posted by johnmac (Post 1581484)
Update on my testing. I have v.40 running on two separate computers, Computer #1 seems to be working OK with no freeze-ups. There was a problem this morning with an error.(See attached text file, error is at the bottom of page) I believe this may have been a multiple tone situation, but not sure. I am monitoring a large dispatch center, but only using a few of the tones.

Computer #2 crashed overnight and now TwoTone will not load. This is mostlikely a problem with my computer as I have had issues with it in the past. I will download the program again and see if it will start.

This is a fantastic program, keep up the great work.

Computer #1 - I checked all the email addresses in the config and tones cfg files. They were all complete. I had to restart the program and all is working OK again.Will wait for another set of stacked tones that go out together and see what happens.

Computer # 2 is definitely a problem with the program not seeing the sound card all the time, it took a few tries to get it started. The error message appears for a nano-second in the cmd window and then shuts down, so I am not sure what the problem was. As I stated earlier it may be my computer and not your program. Any way to hold those error messages so we can read them?

Is there any way to auto delete the wav file after the mp3 file is created, so there are not duplicates and also save disk space?

I need to be in front of the computer when there are stacked tones to see what is going on, I just can not see how it would work properly as once the first A/B tone is received the program starts its process.

Will keep updating my experiences!!

John

aaknitt 07-28-2011 11:21 PM

Quote:

Originally Posted by asmith136 (Post 1581936)
If I make changes to your TwoToneDetect40.py file how do I convert it to a .exe/application?

First you need to have Python installed on your computer. Then there are a number of "add-on" packages you need installed, such as Tkinter, NumPy, and others. Then you use a tool such as Pyinstaller or Py2exe to create the exe file. I can put together a list of required packages when I get a chance.

Andy

aaknitt 07-28-2011 11:23 PM

Quote:

Originally Posted by johnmac
Any way to hold those error messages so we can read them?

Instead of double clicking on the EXE file to start the program, open a terminal window, go to the directory where the program resides, and run it from the terminal window. This should let you see the error.

Quote:

Originally Posted by johnmac
Is there any way to auto delete the wav file after the mp3 file is created, so there are not duplicates and also save disk space?

Yeah, that's on the to do list, and it will be trivial, just need to get around to it.


Thanks for the feedback!

Andy

aliby19 07-29-2011 12:26 AM

I'm getting the following error:

Code:

Traceback (most recent call last):
  File "<string>", line 61, in <module>
  File "E:\Python\build\pyi.win32\TwoToneDetect4\outPYZ1.pyz/ConfigParser", line
 322, in get
ConfigParser.NoSectionError: No section: 'Section1'

I do have a config.cfg with [Section1] as the first line (and am using the config.cfg file from the latest TwoToneDetect40.zip). Any thoughts?

Thanks!

aaknitt 07-30-2011 11:49 PM

Quote:

Originally Posted by aliby19 (Post 1582014)
I'm getting the following error:

Code:

Traceback (most recent call last):
  File "<string>", line 61, in <module>
  File "E:\Python\build\pyi.win32\TwoToneDetect4\outPYZ1.pyz/ConfigParser", line
 322, in get
ConfigParser.NoSectionError: No section: 'Section1'

I do have a config.cfg with [Section1] as the first line (and am using the config.cfg file from the latest TwoToneDetect40.zip). Any thoughts?

Thanks!

hmmm...not sure what that might be, can you email me your config file?

Planning to have v41 out tomorrow with some new tweaks and GUI additions.

Andy

aaknitt 07-31-2011 6:39 PM

v41 Released
 
I just posted version 41 to SourceForge here:
https://sourceforge.net/projects/two...ect/files/v41/

Version 41 Release Notes:
- Added "playback during record" option to GUI
- Changed subject of sent emails to "Page Received"
- Added tone offset feature to config file
- Added audio level meter
- Added audio threshold control to GUI
- Added status and history displays to GUI

Let me know what works and what doesn't!

Thanks,

Andy

Trexer 07-31-2011 8:29 PM

Getting an error

Quote:

Traceback (most recent call last):
File "<string>", line 90, in <module>
File "E:\Python\build\pyi.win32\TwoToneDetect41\outPYZ1 .pyz/ConfigParser", lin
e 351, in getint
File "E:\Python\build\pyi.win32\TwoToneDetect41\outPYZ1 .pyz/ConfigParser", lin
e 348, in _get
ValueError: invalid literal for int() with base 10: '.4'

aaknitt 07-31-2011 8:47 PM

Quote:

Originally Posted by Trexer (Post 1583754)
Getting an error

It looks like it's trying to read an integer value from the config file but the value isn't actually an integer. Take a look at the audio_threshold parameter in the config file and make sure that the value is an integer (round number) between 1 and 100. It looks like you have the value set to ".4". Try changing it to 1 and see if that fixes the issue.

Andy

Trexer 07-31-2011 9:09 PM

Indeed that was the problem. I was using the value from the old version of TwoToneDetect which was a decimal value.

Looks like it is working great now and detecting properly.

Great work and much thanks.

asmith136 08-01-2011 10:13 PM

Is there a way to make the program have an option to record in mono or stereo? I found that recording in stereo the mp3 files sound better. I had changed the old v24 from labview to record in stereo and found the emails and mms messages sound really good.

aaknitt 08-01-2011 10:24 PM

v42 Released
 
Just released v42, which is just a bugfix of a math problem in v41. If v41 isn't giving you any problems, probably no rush to upgrade, but if you've been getting a math error this may solve it. Next release will have some improvements to config file editing through the GUI.

I can look into stereo recording, that should be pretty simple.

Andy

asmith136 08-01-2011 11:07 PM

I have tried both v41 and v42 and keep getting this error.

TwoToneDetect41.py:247: RuntimeWarning: divide by zero encountered in log10
Traceback (most recent call last):
File "<string>", line 476, in <module>
File "<string>", line 432, in start
File "<string>", line 247, in Atone1
OverflowError: cannot convert float infinity to integer

C:\TwoTone41>

asmith136 08-01-2011 11:10 PM

i've tried both v41 and v42 a keep getting the following error

TwoToneDetect41.py:247: RuntimeWarning: divide by zero encountered in log10
Traceback (most recent call last):
File "<string>", line 476, in <module>
File "<string>", line 432, in start
File "<string>", line 247, in Atone1
OverflowError: cannot convert float infinity to integer

C:\TwoTone41>

aaknitt 08-02-2011 8:16 AM

Quote:

Originally Posted by asmith136 (Post 1584570)
i've tried both v41 and v42 a keep getting the following error

TwoToneDetect41.py:247: RuntimeWarning: divide by zero encountered in log10
Traceback (most recent call last):
File "<string>", line 476, in <module>
File "<string>", line 432, in start
File "<string>", line 247, in Atone1
OverflowError: cannot convert float infinity to integer

C:\TwoTone41>

Yep, that's the bug that I think I tried to quickly fix in v42. Even if v42 there's still a chance of still getting that error, but I'll fully address the problem in v43. It's an issue that will happen more on some sound cards than others.

aaknitt 08-02-2011 9:02 PM

v43 Released
 
I just posted v43

Version 43 Release Notes:
- Math bug fix (infinity issue)
- Added GUI for config file editing

Let me know if this fixes the bug with v41 and v42.

Thanks,

Andy

onoff 08-03-2011 1:26 AM

No Email
 
In version 43 I don't seem to get any email. I worked great with version 40 but with version 43 I don't get any emails. I have checked and rechecked my user name and password.

asmith136 08-03-2011 10:31 AM

I've setup V43 and did some testing with my department tones and found that the tone detect is very wide. My first tone of 1450.0Hz gets detected from 1422.0Hz to 1477.0Hz. I setup the tone tolerance to 0% and still have the same problem.

aaknitt 08-03-2011 11:24 AM

Quote:

Originally Posted by asmith136 (Post 1585499)
I've setup V43 and did some testing with my department tones and found that the tone detect is very wide. My first tone of 1450.0Hz gets detected from 1422.0Hz to 1477.0Hz. I setup the tone tolerance to 0% and still have the same problem.

You found a bug in the code that saves that parameter in the config file. I'll get it fixed in the next release. Until then, you can manually edit the config file to adjust the tolerance down.


Andy

asmith136 08-03-2011 12:05 PM

I think I found another bug. I am using the same setting as v40 that worked fine in v43 I get this error
A Tone Found!
Checking for B Tone
Checking for B Tone
Tone Set Found!
Fire Department 1
????????????@vzwpix.com
delay timer
waiting for audio
recording audio
done writing WAV
LAME 3.98.4 32bits (www)
CPU features: MMX (ASM used), SSE (ASM used), SSE2
Using polyphase lowpass filter, transition band: 5379 Hz - 5513 Hz
Encoding ./audio/Fire_Department_1_2011-08-0311_58_18_796000.wav
to ./audio/Fire_Department_1_2011-08-0311_58_18_796000.mp3
Encoding as 11.025 kHz single-ch MPEG-2.5 Layer III (11x) 16 kbps qval=3
Frame | CPU time/estim | REAL time/estim | play/CPU | ETA
180/180 (100%)| 0:00/ 0:00| 0:00/ 0:00| 204.44x| 0:00
-------------------------------------------------------------------------------
kbps mono % long switch short %
16.0 100.0 96.7 2.2 1.1
ReplayGain: -6.8dB
done converting to MP3
Unhandled exception in thread started by <function alert at 0x014EE7F0>
Traceback (most recent call last):
File "<string>", line 241, in alert
File "<string>", line 150, in mail
File "E:\Python\build\pyi.win32\TwoToneDetect43\outPYZ1 .pyz/smtplib", line 604
, in login
smtplib.SMTPAuthenticationError: (535, '5.7.0 ...authentication rejected (2)')

aaknitt 08-03-2011 12:14 PM

Quote:

Originally Posted by asmith136 (Post 1585541)
File "E:\Python\build\pyi.win32\TwoToneDetect43\outPYZ1 .pyz/smtplib", line 604
, in login
smtplib.SMTPAuthenticationError: (535, '5.7.0 ...authentication rejected (2)')

That means it couldn't log in to your SMTP server. Make sure your email settings (username, password, etc.) are correct. Note that when you enter your password in using the GUI it doesn't need to be encoded in base64, the program takes care of encoding it before writing it to the config file.

Andy

asmith136 08-03-2011 12:27 PM

I got it. My error with the username


All times are GMT -5. The time now is 12:32 AM.

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