TwoToneDetect New TwoToneDetect in the works - Python based

kc2kvy

Member
Premium Subscriber
Joined
Feb 2, 2007
Messages
96
Anyone having issues on 74h running anything with alert_command? Post_email_command works fine, even using the same command, but I can't get alert_command to do anything. I've tried reordering where they are placed in tones.cfg but that has not helped.

I've tested this in Wine on Linux and native Windows 10.
 

NotATechGuy

NotAMember
Premium Subscriber
Joined
Apr 7, 2013
Messages
218
Location
127.0.0.1
Anyone having issues on 74h running anything with alert_command? Post_email_command works fine, even using the same command, but I can't get alert_command to do anything. I've tried reordering where they are placed in tones.cfg but that has not helped.

I've tested this in Wine on Linux and native Windows 10.
I don't believe I've ever had alert_command work. This might be how it's programmed to trigger. I don't recall the specifics off the top of my head when alert_command is supposed to trigger. I always use post_email_command.
 

kc2kvy

Member
Premium Subscriber
Joined
Feb 2, 2007
Messages
96
I don't believe I've ever had alert_command work. This might be how it's programmed to trigger. I don't recall the specifics off the top of my head when alert_command is supposed to trigger. I always use post_email_command.
alert_command is supposed to trigger upon initial tone detection - you can use it to do things like play an alert tone over a PA system or something for a station pager. I'm (trying) to use it to send a Telegram message, and I know the command works as it should, it's just not triggering upon tone detection.
 

aaknitt

Member
Feed Provider
Joined
Aug 27, 2005
Messages
1,305
Anyone having issues on 74h running anything with alert_command? Post_email_command works fine, even using the same command, but I can't get alert_command to do anything. I've tried reordering where they are placed in tones.cfg but that has not helped.

I've tested this in Wine on Linux and native Windows 10.
I just ran a very quick test and it seemed to work as expected. Anything in your log.txt file that might offer any clues? The command runs ok by itself from the command line?
 

kc2kvy

Member
Premium Subscriber
Joined
Feb 2, 2007
Messages
96
I just ran a very quick test and it seemed to work as expected. Anything in your log.txt file that might offer any clues? The command runs ok by itself from the command line?
Ah! I see the problem, I think...
Code:
Traceback (most recent call last):
  File "TwoToneDetect.py", line 1001, in readtones
  File "<frozen _collections_abc>", line 834, in __eq__
configparser.InterpolationSyntaxError: '%' must be followed by '%' or '(', found: '%3A[HalfOfBotID]/sendMessage?chat_id=[ChatID]&text=RS%20Page%20received%2C%20stand%20by%20for%20audio%3A"'
which I've change to the much more sane
Code:
curl "https://api.telegram.org/[BotID]/sendMessage?chat_id=[ChatID]" --data-urlencode "text=RS Page received, stand by for audio:"

The bot ID had a colon in it, which at some point I changed to %3A, and it looks like that's what caused the problem. I believe this should fix it. Thank you, I should have thought to look at the logs!
 

AFD103

Member
Joined
Nov 17, 2020
Messages
39
I've had alert_command running for a while. I use it to drop an MQTT pub that my home automation server picks up and runs different scenes based upon the toneset and the time of day.
 

APSN556

Member
Premium Subscriber
Joined
Oct 22, 2008
Messages
163
Location
Phoenix, AZ
I'm having a (Hopefully) simple issue with TTD 74f. I have a windows 10 laptop with an external USB soundcard. The PC sees the soundcard just fine. I have my scanner audio going into the external USB soundcard. When in the sound properties, The audio is showing just fine going into the USB soundcard and levels are fine. When I fire up TTD, I am able to select the USB soundcard as the input device just fine. The meter shows "audio" when nothing is playing and its not registering any of the audio from the scanner- despite my PC sound properties showing Audio and levels just fine. Thanks for any help. I'm only using the program for personal use to be alerted when our local station is toned out. This process works flawlessly on my desktop computer at a different location. Just hoping to have it setup on my home laptop. Thanks!
 
Last edited:

APSN556

Member
Premium Subscriber
Joined
Oct 22, 2008
Messages
163
Location
Phoenix, AZ
I'm having a (Hopefully) simple issue with TTD 74f. I have a windows 10 laptop with an external USB soundcard. The PC sees the soundcard just fine. I have my scanner audio going into the external USB soundcard. When in the sound properties, The audio is showing just fine going into the USB soundcard and levels are fine. When I fire up TTD, I am able to select the USB soundcard as the input device just fine. The meter shows "audio" when nothing is playing and its not registering any of the audio from the scanner- despite my PC sound properties showing Audio and levels just fine. Thanks for any help. I'm only using the program for personal use to be alerted when our local station is toned out. This process works flawlessly on my desktop computer at a different location. Just hoping to have it setup on my home laptop. Thanks!
UPDATE: I was able to fix this issue simply by installing a free virtual audio cable. Works great now.
 

lofdog

Newbie
Joined
Aug 13, 2014
Messages
2
Location
Delavan, WI
I have been working on my own implementation for a few weeks now. I have the Raspberry Pi version. Everything works, but I am trying to use Azure’s Speech to Text function, which should work if I can get emails to send a .wav instead of an .mp3. Any idea on how I can have my tone-out emails send a .wav? I am running 74h. Right now I am testing by uninstalling FFMPEG and see if that works.
 

DC31

Member
Feed Provider
Joined
Feb 19, 2011
Messages
1,588
Location
Massachusetts
I have been working on my own implementation for a few weeks now. I have the Raspberry Pi version. Everything works, but I am trying to use Azure’s Speech to Text function, which should work if I can get emails to send a .wav instead of an .mp3. Any idea on how I can have my tone-out emails send a .wav? I am running 74h. Right now I am testing by uninstalling FFMPEG and see if that works.
You could write some sort of script using the post_email_command to capture the .wav file:

  • post_email_command – This parameter can be used to point to a windows Batch file (.bat) or other executable file. The file that is specified here will be executed whenever the specified tone set has been detected and after the audio has been recorded.
Variable substitution will insert the current Tone Description in place of [d], the mp3 filename in place of [mp3], the AMR filename in place of [amr], and the WAV filename in place of [wav] (all paths relative to program directory).


Command Format is like: python script.py [d] [wav]
 

canthonysmith

Member
Joined
Nov 20, 2011
Messages
54
Location
Arkansas
I have been working on my own implementation for a few weeks now. I have the Raspberry Pi version. Everything works, but I am trying to use Azure’s Speech to Text function, which should work if I can get emails to send a .wav instead of an .mp3. Any idea on how I can have my tone-out emails send a .wav? I am running 74h. Right now I am testing by uninstalling FFMPEG and see if that works.
I have been wanting to setup speech to text for a while now. Would you be able to share some information on how you did this?
 

JH49

Member
Joined
Jun 22, 2016
Messages
13
I think I had to add
Code:
keep_wav = 1
to be able to use the .wav file in the post-alert script like DC31 is showing in the post above.
 

JH49

Member
Joined
Jun 22, 2016
Messages
13
I have been wanting to setup speech to text for a while now. Would you be able to share some information on how you did this?
I'm running a Python web app on my local server using the Whisper model. If I were to redo it, I would look at using Ollama or an equivalent.
 

NNJIPScan

Member
Feed Provider
Joined
Nov 6, 2012
Messages
32
We have been using TTD for several years with no issues until last week. We have several A-B tones setup and working as expected (detecting & emailing), except for one set that suddenly stopped working, the tones are no longer are detected by TTD.

Other alerting platforms like physical pagers and eDispatches are still working as expected as well.

I have been playing around with different settings over the last week, including tone length, tone gap length, and tone tolerance, but have not hit yet.

The expected tones are: 615.7 / 1529.8

Current Settings:


1737573446619.png

Here are logs from a call earlier today, where the tones were not detected by TTD:

1737573570439.png

I am testing now, swapping the A-B tones for what the logs are showing, will see if that makes a difference.

Any thoughts or feedback would be appreciated. Thanks!
 

bunangst

Member
Joined
Mar 12, 2013
Messages
71
Location
Harmony, NJ
I've had random tone sets stop working when the software had a long uptime. A software restart or system reboot has fixed the issue.
 

DC31

Member
Feed Provider
Joined
Feb 19, 2011
Messages
1,588
Location
Massachusetts
Each of your logs above show two audio samples that are out of spec between your red boxes. That is what is causing the tone set not to decode. Those appear to be in the audio coming in so the fix would be to get the audio cleaned up. Even one out of spec sample with cause a failure. About the only thing you might be able to try is to use a Gap_length setting but I don’t know how successful that might be.
 

DC31

Member
Feed Provider
Joined
Feb 19, 2011
Messages
1,588
Location
Massachusetts
Another call after setting tones to match what was in the logs:

View attachment 176852
the second set of digits in your log file entries is audio level (volume). For your tone sets this varies from 21000 to 822. That is a huge variation. Poor audio cable connection? Adjust scanner volume a little? Is your Btone really that short? Each sample represents 200ms so that shows an Atone of 1 sec and a Btone of 0.6 seconds. Standard tones are 1 sec Atone and 3 sec Btone. Is your computer not hearing all of the Btone?
 

DC31

Member
Feed Provider
Joined
Feb 19, 2011
Messages
1,588
Location
Massachusetts
Another call after setting tones to match what was in the logs:

View attachment 176852
Here is what solid tones should look like:
tone config is unchanged
252.76829268292684 15163 1737503295.8155823
903.5121951219512 28969 1737503295.9265392
903.5121951219512 24799 1737503296.220933
903.5121951219512 24557 1737503296.334022
903.5121951219512 25410 1737503296.4465172
903.5121951219512 24793 1737503296.7460778
903.5121951219512 24733 1737503296.8590868
806.7073170731708 24690 1737503297.1648154
806.7073170731708 23797 1737503297.2775893
806.7073170731708 24242 1737503297.38976
806.7073170731708 24775 1737503297.688974
GFD_Medical Tone Set Found
starting new alert
[['Tone2', 'GFD_Medical', 1737503297.6969125, 0]]
[[['Tone2', 'GFD_Medical', 1737503297.6969125, 0]]]
delay timer GFD_Medical 18:48:17 on 01/21/25
0.0
-0.08958172798156738
1737503297.7886777
1737503297.6969125
delay done GFD_Medical 18:48:17 on 01/21/25
waiting for audio GFD_Medical 18:48:17 on 01/21/25
806.7073170731708 23838 1737503297.8151598threshold value: 500
mono

806.7073170731708 23651 1737503297.9296818
threshold exceeded
recording audio GFD_Medical 18:48:18 on 01/21/25
iterations: 322
806.7073170731708 23744 1737503298.2244158
806.7073170731708 24121 1737503298.3322375
806.7073170731708 23920 1737503298.6306083
806.7073170731708 24450 1737503298.7417953
806.7073170731708 24737 1737503298.8534477
806.7073170731708 24460 1737503299.1561153
806.7073170731708 23403 1737503299.2664053
806.7073170731708 23425 1737503299.560179
806.7073170731708 25163 1737503299.672244
806.7073170731708 24600 1737503299.7837048
1387.5365853658536 594 1737503300.0849552
 
Top