FD Tone Notify - New Tone Detection Software Released

sc2142

Member
Feed Provider
Joined
Dec 20, 2013
Messages
67
Location
Mountain Home, Idaho
You need to run the application from the command line. You cannot simply double click on the application. Another way is to create a shortcut with the arguments you need.

If you follow the guide here (How to create shortcuts with parameters in Windows 10 | Digital Citizen) and replace "-private-window" with "--tone-detector --silly" it will start without those arguments when you double click on the shortcut.
Does not work, I made a shortcut with the arguments and from the command line. The command line tells me that tone detector is an unknown option.
cmd_sBDpz8858r.png
 

kevind963

Member
Feed Provider
Joined
Jun 22, 2012
Messages
46
Does not work, I made a shortcut with the arguments and from the command line. The command line tells me that tone detector is an unknown option.
You have not installed and configured sox correctly. You will need to go back to the documentation and follow the guide for setting up sox on Windows.
 

kevind963

Member
Feed Provider
Joined
Jun 22, 2012
Messages
46
What is the result of "Checking for success" for the sox install?
 

sc2142

Member
Feed Provider
Joined
Dec 20, 2013
Messages
67
Location
Mountain Home, Idaho
What is the result of "Checking for success" for the sox install?
You should propably add more information to the readme, such as running the path cmd and the sox cmd and then in the same cmd window run the fd-tone-notify.exe otherwise it does not work. Im now having the issue of it not detecting my email settings, where do i enter them as that seems to be complicated also, ive tried every variation between the quotes, deleting the : and nothing works...
 
Last edited:

kevind963

Member
Feed Provider
Joined
Jun 22, 2012
Messages
46
You should propably add more information to the readme, such as running the path cmd and the sox cmd and then in the same cmd window run the fd-tone-notify.exe otherwise it does not work. Im now having the issue of it not detecting my email settings, where do i enter them as that seems to be complicated also, ive tried every variation between the quotes, deleting the : and nothing works...
If the check for success does not work in a new cmd window it means the path was not setup correctly on the previous step for sox to be recognized. The errors you are describing sound like you are trying to run fdtonenotify.exe from the sox directory which will not work. Sox needs to be setup in the path correctly.

Here is a stack overflow explaining the way to add sox to the PATH in a bit of a less wordy way. https://stackoverflow.com/questions/17667491/how-to-use-sox-in-windows
 

sc2142

Member
Feed Provider
Joined
Dec 20, 2013
Messages
67
Location
Mountain Home, Idaho
If the check for success does not work in a new cmd window it means the path was not setup correctly on the previous step for sox to be recognized. The errors you are describing sound like you are trying to run fdtonenotify.exe from the sox directory which will not work. Sox needs to be setup in the path correctly.

Here is a stack overflow explaining the way to add sox to the PATH in a bit of a less wordy way. https://stackoverflow.com/questions/17667491/how-to-use-sox-in-windows
Still doesn't work.
 

kevind963

Member
Feed Provider
Joined
Jun 22, 2012
Messages
46
Still doesn't work.
Something is wrong with your sox installation then. Sox is not software that I wrote or have any capability to troubleshoot.
Make sure you click "edit" in the path and then add the path to the sox directory.

This is the expected output when you run sox in a new cmd.
1662492303444.png
 

sc2142

Member
Feed Provider
Joined
Dec 20, 2013
Messages
67
Location
Mountain Home, Idaho
Something is wrong with your sox installation then. Sox is not software that I wrote or have any capability to troubleshoot.
Make sure you click "edit" in the path and then add the path to the sox directory.

This is the expected output when you run sox in a new cmd.
View attachment 127281
I somehow got it to work. I now get this. Trying --tone-detector still returns an error
cmd_cqpQjRrj2t.png
 

kevind963

Member
Feed Provider
Joined
Jun 22, 2012
Messages
46
None of those are errors that prevent operation. They are just telling you have issues with your configuration. To make sure audio is working you will want to run it with the --silly option and then hit some buttons on your scanner or wait for traffic. If you see a bunch of text go by then you know it is receiving audio.
Unless you know the tones of what you want to listen to you will want to run the all tone detector mode to determine the tones to add to the config file.
 

sc2142

Member
Feed Provider
Joined
Dec 20, 2013
Messages
67
Location
Mountain Home, Idaho
None of those are errors that prevent operation. They are just telling you have issues with your configuration. To make sure audio is working you will want to run it with the --silly option and then hit some buttons on your scanner or wait for traffic. If you see a bunch of text go by then you know it is receiving audio.
Unless you know the tones of what you want to listen to you will want to run the all tone detector mode to determine the tones to add to the config file.
Can you give me an example of where to put the username and password for the email, every where i put it, it does not work.
 

kevind963

Member
Feed Provider
Joined
Jun 22, 2012
Messages
46
Please see the configuration instructions below

Make sure you rename the secrets template file after you add the correct values. You will also need to update the email config at the bottom of the config file. Once that is done if you are still seeing the warnings that the FD_SMTP_USERNAME and password have not been set then that means the config is not setup correctly.

 

pbeezy

Member
Feed Provider
Joined
Aug 22, 2009
Messages
39
So I have about 45 Departments with tones already in TTD, would the easiest way to get those into FT Detect be to just monitor all tones? Does monitor tones create them in the correct json formatting? It seems a little bit ominous to add 40+ tones to the config manually.
 

kevind963

Member
Feed Provider
Joined
Jun 22, 2012
Messages
46
So I have about 45 Departments with tones already in TTD, would the easiest way to get those into FT Detect be to just monitor all tones? Does monitor tones create them in the correct json formatting? It seems a little bit ominous to add 40+ tones to the config manually.
Monitor mode helps you identify tones that you do not know you. You will need to create all of the departments manually for FD Tone Notify. However, I do feel like an important utility might be useful. If you could create a feature request on GitHub and include a link to your TTD config file (make sure to remove passwords before sensitive info before posting) then I can add an import utility to the backlog to help people transition over.
 

xicarusx

Member
Feed Provider
Joined
Oct 2, 2008
Messages
104
Location
Sayre, PA
P
Monitor mode helps you identify tones that you do not know you. You will need to create all of the departments manually for FD Tone Notify. However, I do feel like an important utility might be useful. If you could create a feature request on GitHub and include a link to your TTD config file (make sure to remove passwords before sensitive info before posting) then I can add an import utility to the backlog to help people transition over.

I have created one already in python. I can send you the script for editing.
 

xicarusx

Member
Feed Provider
Joined
Oct 2, 2008
Messages
104
Location
Sayre, PA
Copy and past the code below to a file named convert.py.

Usage -
python3 convert.py /home/pi/TTD/tones.cfg

Needs to be given a path to your tones.cfg, not tested on Windows, but it should work if you use \\ instead of \ for path.

This creates the default version of default.json, but with your tones in it from TTD.

If you get an error about missing colorama. pip3 install colorama

Python:
import json
import os
import sys

from colorama import Fore, Style
import configparser

default_json = {
    "audio": {
        "inputDevice": "hw:1,0",
        "sampleRate": 44100,
        "frequencyScaleFactor": 1,
        "recordingScaleFactor": 2,
        "silenceAmplitude": 0.05,
        "channels": 1
    },
    "detection":
        {
            "minRecordingLengthSec": 30,
            "maxRecordingLengthSec": 45,
            "defaultMatchThreshold": 6,
            "defaultTolerancePercent": 0.05,
            "defaultResetTimeoutMs": 5000,
            "defaultLockoutTimeoutMs": 7000,
            "isRecordingEnabled": True,
            "detectors": []
        },
    "coralogix": {
        "applicationName": "FD-Tone-Notify",
        "subsystemName": "Test"
    },
    "email": {
        "from": "test@example.com",
        "host": "smtp.sendgrid.net",
        "port": 465,
        "secure": True
    }
}

default_detector = {
    "name": "",
    "tones": [],
    "matchThreshold": 6,
    "tolerancePercent": 0.02,
    "resetTimeoutMs": 4000,
    "isRecordingEnabled": True,
    "lockoutTimeoutMs": 6000,
    "minRecordingLengthSec": 45,
    "maxRecordingLengthSec": 60,
    "notifications": {
        "preRecording": {
            "pushbullet": [],
            "webhooks": [],
            "externalCommands": [],
            "emails": []
        },
        "postRecording": {
            "pushbullet": [],
            "webhooks": [],
            "externalCommands": [],
            "emails": []
        }
    }
}

ttd_config_path = sys.argv[1]

if not ttd_config_path:
    print(Fore.RED + "[X]" + Fore.YELLOW + " Please provide full link to tones.cfg." + Style.RESET_ALL)
    sys.exit(0)
if not os.path.exists(ttd_config_path):
    print(Fore.RED + "[X]" + Fore.YELLOW + " Can't find tones.cfg in that path." + Style.RESET_ALL)
    sys.exit(0)


def convert_ttd(ttd_config_path):
    parser = configparser.ConfigParser()
    parser.read(ttd_config_path)

    print(Fore.YELLOW + "[+] " + Fore.BLUE + "Converting...." + Style.RESET_ALL)

    detectors = []
    for tone in parser.sections():
        new_detector = {
            "name": parser[tone]["description"],
            "tones": [float(parser[tone]["atone"]), float(parser[tone]["btone"])],
            "matchThreshold": 6,
            "tolerancePercent": 0.02,
            "notifications": {
                "preRecording": {
                    "pushbullet": [],
                    "webhooks": [],
                    "externalCommands": [],
                    "emails": []
                },
                "postRecording": {
                    "pushbullet": [],
                    "webhooks": [],
                    "externalCommands": [],
                    "emails": []
                }
            }
        }
        detectors.append(new_detector)

    default_json["detection"]["detectors"] = detectors
    with open('default.json', 'w+') as outfile:
        json.dump(default_json, outfile, indent=4)
    outfile.close()
    print(Fore.GREEN + "[*] " + Fore.LIGHTGREEN_EX + " Conversion Complete default.json created in this directory.")


convert_ttd(ttd_config_path)
 

kevind963

Member
Feed Provider
Joined
Jun 22, 2012
Messages
46
Just wanted to provide everyone an update that v0.2.0 has just been released on GitHub. You can get the downloads here.

Release Notes:
  • [FEATURE] When ffmpeg is installed (optional) recorded .wav files will automatically be converted to mp3 when a tone is detected. The mp3 file will then be used when sent to all postRecording notifications to save space downstream.
  • [FEATURE] Config files can be created from a csv file.
  • [FEATURE] Adds nine (9) new configuration options in order to better fine tune detection parameters on specific detectors instead of globally. See 84f1044
  • [EXAMPLE] Adds S3 Upload example as an external command. Using and modifying this example will allow users to easily use the external command notification to upload recorded files to AWS S3 or any other S3 compatible cloud storage provider.
  • [ENHANCEMENT] Increases reliability of detecting tones when using an analog input that may have some static
  • [ENHANCEMENT] Increases reliability of detecting high pitched tones (greater than 2kHz)
  • [FIX] Fixes memory leak #12. Thanks @chooper
  • [FIX] Fixes issue with email dates #11. Thanks @chooper
  • [FIX] Fixes thread leak #14. Thanks @chooper
  • [FIX] Fixes post recording WebHook issue #15
 

pbeezy

Member
Feed Provider
Joined
Aug 22, 2009
Messages
39
Copy and past the code below to a file named convert.py.

Usage -
python3 convert.py /home/pi/TTD/tones.cfg

Needs to be given a path to your tones.cfg, not tested on Windows, but it should work if you use \\ instead of \ for path.

This creates the default version of default.json, but with your tones in it from TTD.

If you get an error about missing colorama. pip3 install colorama

Python:
import json
import os
import sys

from colorama import Fore, Style
import configparser

default_json = {
    "audio": {
        "inputDevice": "hw:1,0",
        "sampleRate": 44100,
        "frequencyScaleFactor": 1,
        "recordingScaleFactor": 2,
        "silenceAmplitude": 0.05,
        "channels": 1
    },
    "detection":
        {
            "minRecordingLengthSec": 30,
            "maxRecordingLengthSec": 45,
            "defaultMatchThreshold": 6,
            "defaultTolerancePercent": 0.05,
            "defaultResetTimeoutMs": 5000,
            "defaultLockoutTimeoutMs": 7000,
            "isRecordingEnabled": True,
            "detectors": []
        },
    "coralogix": {
        "applicationName": "FD-Tone-Notify",
        "subsystemName": "Test"
    },
    "email": {
        "from": "test@example.com",
        "host": "smtp.sendgrid.net",
        "port": 465,
        "secure": True
    }
}

default_detector = {
    "name": "",
    "tones": [],
    "matchThreshold": 6,
    "tolerancePercent": 0.02,
    "resetTimeoutMs": 4000,
    "isRecordingEnabled": True,
    "lockoutTimeoutMs": 6000,
    "minRecordingLengthSec": 45,
    "maxRecordingLengthSec": 60,
    "notifications": {
        "preRecording": {
            "pushbullet": [],
            "webhooks": [],
            "externalCommands": [],
            "emails": []
        },
        "postRecording": {
            "pushbullet": [],
            "webhooks": [],
            "externalCommands": [],
            "emails": []
        }
    }
}

ttd_config_path = sys.argv[1]

if not ttd_config_path:
    print(Fore.RED + "[X]" + Fore.YELLOW + " Please provide full link to tones.cfg." + Style.RESET_ALL)
    sys.exit(0)
if not os.path.exists(ttd_config_path):
    print(Fore.RED + "[X]" + Fore.YELLOW + " Can't find tones.cfg in that path." + Style.RESET_ALL)
    sys.exit(0)


def convert_ttd(ttd_config_path):
    parser = configparser.ConfigParser()
    parser.read(ttd_config_path)

    print(Fore.YELLOW + "[+] " + Fore.BLUE + "Converting...." + Style.RESET_ALL)

    detectors = []
    for tone in parser.sections():
        new_detector = {
            "name": parser[tone]["description"],
            "tones": [float(parser[tone]["atone"]), float(parser[tone]["btone"])],
            "matchThreshold": 6,
            "tolerancePercent": 0.02,
            "notifications": {
                "preRecording": {
                    "pushbullet": [],
                    "webhooks": [],
                    "externalCommands": [],
                    "emails": []
                },
                "postRecording": {
                    "pushbullet": [],
                    "webhooks": [],
                    "externalCommands": [],
                    "emails": []
                }
            }
        }
        detectors.append(new_detector)

    default_json["detection"]["detectors"] = detectors
    with open('default.json', 'w+') as outfile:
        json.dump(default_json, outfile, indent=4)
    outfile.close()
    print(Fore.GREEN + "[*] " + Fore.LIGHTGREEN_EX + " Conversion Complete default.json created in this directory.")


convert_ttd(ttd_config_path)
So this is awesome I just saw this and converted without issue. Appreciate your efforts.


One question I had for Webhooks. It seems like I'll need to add a webhook for every tone set, is that correct? If so my feedback of having 60+ tones appies here as well. Is there a way you could add apply all?

My use case is I provide this tone alerts to a groupme chat. Right now I have a jenky FTP upload that I use inotify to watch, and then sent a curl request to groupme, with the file link.

I hadn't considered a local webhook option because I didn't know you could add attachments e.g the recording to them. Did I understand the documentation correctly that you can do that?
 

BrandonMace

Member
Premium Subscriber
Joined
Jun 23, 2009
Messages
20
Location
Minnesota
Great write up! Is there anyway to configure the software to use a broadcastify live stream URL instead of connecting a local scanner to receive alerts?
 
Top