FiveToneDetect

A Windows program that detects five tone pages, records audio, and sends the recording to email or cell phones

FiveToneDetect

FiveToneDetect is free for personal and noncommercial use by public safety agencies and organizations.  If you’d like to use the program for commercial purposes, please contact me.

What is it?

FIveToneDetect is a Windows (or Linux) program that interfaces with a radio receiver or scanner.  It uses the computer’s sound card to listen to the received audio and detect five-tone sequential pages.  This type of paging is commonly used for fire department alerting and automatic number identification (ANI).  Upon detecting known five-tone pages, the program will record dispatch audio and email that audio to a specified email address. Multiple tone sets and email addresses are supported.

TwoToneDetect

Download the latest version (v65c) here

Program Features

  • Decodes virtually unlimited numbers of user-specified five-tone pages
  • Handles “stacked pages”
  • Upon detecting a valid tone set, records user-specified length of audio and emails it to a specified address as a  .mp3 or .amr file attachment (requires user download of ffmpeg.exe)
  • Near real-time playback of recorded audio, providing “pager-like” functionality with scanner and PC
  • Can be used to trigger external programs or scripts upon tone detection
  • ANI display of all detected tone sequences
  • Automatic handling or “repeat” tones

Disclaimer

This program should never be used as a primary alerting method for mission-critical communications.  It is meant as a secondary notification method only.  Delays in email or text messaging systems can be minutes or hours long.  Do not use this program to replace pagers, only to supplement them!

Download & Installation

After downloading the .zip file (see link at top of page), simply unzip into the folder of your choice on your computer.  There is no installer.   Simply unzip the file into a folder on the computer that will be running the program.  Inside the folder there are two executable files (.exe files).  They are “FiveToneDetect##.exe” and “FiveToneDetect##_debug.exe”.  The only difference between the two programs is that the _debug version of the program will open up a “debug” screen in addition to the main program screen.  This can be helpful to see what’s going on “behind the scenes” of the program if you encounter any problems.

On Linux, run the compiled Python file included in the ZIP package instead of the EXE:

python FiveToneDetect##.pyc
Note:  If running FiveToneDetect on a Raspberry Pi as shown here, use the FiveToneDetect##Pi.pyc file for headless operation using  PulseAudio as the audio input source.

Steps to get up and running:

  1.  Download ffmpeg.exe from the internet and put it in the directory with FiveToneDetect.  Download this version.  If that version doesn’t work you can try the latest Windows 32 bit static build from here. NOTE:  Be sure to unzip the downloaded file before putting it into the FiveToneDetect directory!
  2. Run the TonesEditor program to set up your tone sets and distribution lists. See the “Editing Tone Information” section below for more information.  You can also manually edit the tones.cfg file using a text editor if you prefer. [NOTE: TonesEditor program for FiveToneDetect is still under development.  Manual editing is necessary until this is available.  1/18/2014]
  3. Run the program and click on the “Edit Config Info” menu. Set up the config items according to your needs.  See “Starting and Configuring the Program” section below
  4. Select the audio input and output devices you want to use from the main screen
  5. Exit the program
  6. Restart FiveToneDetect

Support & Troubleshooting

If you have problems with the program you can check this forum thread for answers or support.

Editing Tone Information

In order to tell the program what tone sets we want it to look for and act upon, open the tones.cfg file in a text editor and edit it as required.  The sections below explain what the different fields mean.  If a parameter is optional, it can be omitted.

Mandatory Parameters:

  • Code – Numeric code of the five-tone sequence.  Should be five digits 0-9 or A-F.  For example, 72492
  • Description – Description of the tone set.  Avoid using special characters such as slashes, quotation marks, or punctuation
  • mp3_Emails – This is a list of email addresses that the program will send mp3 attachments to whenever a valid page is received for this tone set.  To send to multiple email addresses, simply separate them with commas.

Additional Optional Parameters:

  • amr_Emails – This is a list of email addresses that the program will send AMR format audio file attachments to whenever a valid page is received for this tone set.  AMR format audio files can be played by most cellular phones when received as a text or multimedia message (MMS).
  • text_Emails – This is a list of email addresses that the program will send a text-only email to whenever a valid page is received for this tone set.  The email will not contain any information, it will just let the recipient know that a page has been received.  This email will be sent immediately upon tone detection, prior to audio recording
  • record_delay – Number of seconds that the program will wait to begin recording after a valid tone set is found
  • ignore_after – Number of seconds that the program will ignore a tone set after it has been received.  This is useful if a dispatch center normally sends multiple pages for the same call.  It can be used to prevent multiple email or text messages from being sent for the same call.
  • alert_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 but before the audio has been recorded.  As an example, a batch file could be created that plays a pre-recorded audio file when the page is received.
  • 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.  As an example, a batch file could be created that uploads the newly created audio file to an FTP server.
  • exclude_from, exclude_to, and exclude_emails parameters – These three parameters are used together to prevent emails from being sent to certain addresses when a page is received during a certain time of the day.  This can be used to prevent emails from being sent during daily test pages, or to only send pages for certain duty shifts.  When these three parameters are used, the tone sets will still be detected, but if the time of day of the page falls between exclude_from and exclude_to, the email will not be sent to the addresses in the exlude_emails parameter.  Multiple email addresses can be specified by separating them with commas.  This field will prevent emails from being sent to addresses in both the mp3_emails and amr_emails parameters.
  • playback_during_record – If set to 1, the program will play the page audio through the computer speakers (or other audio device as specified on the main program screen) while it is being recorded.  If set to 0, it will not play the audio while recording.

A note on sending pages to cell phones:

To send the page audio to a cellular phone, you must send the email to the carrier’s Multimedia Messaging Service (MMS) email address, not the normal SMS (text messaging) email address.  For some carriers these two email addresses are the same, for others, they are different.  For example, to send a normal text message to a Verizon phone via email you would address it to ##########@vtext.com, but to send a MMS message (containing a picture or audio file), you would need to address it to ##########@vzwpix.com.  A list of SMS and MMS gateways for different wireless carriers can be found here.

Also, most phones will play AMR format audio files, while only some will play MP3 format audio files, so pick whichever works best for your phone/carrier.

Starting and Configuring the Program

  1. Start FiveToneDetect
  2. Select the Audio Input and Output devices from the drop down menus.  It’s best to use a line-in for the scanner input, but a microphone in can also work if set up properly in the Windows sound mixer.  Use Windows sound mixer to adjust the input audio level, if needed.  Note: On some newer Windows machines, an audio jack must be plugged in to the audio port before Windows will recognize the audio device.  Not having anything plugged in to your sound card may prevent FiveToneDetect from starting.
  3. Adjust the audio squelch level so that the audio level is under the threshold when no scanner audio is present, but above the threshold when scanner audio is present.  You may find that tuning the scanner to a local weather station can help quickly find an appropriate squelch level.  This can also help you adjust the sound levels in the Windows sound mixer.
  4. Next, click the “Edit Config Info” menu item at the top of the screen.  The following menu should appear:

FiveToneConfigConfigure the menu items as appropriate.  Here is a brief description of each of the fields:

  • Email UserID:  UserID of the email account that you will be using to send emails FROM
  • Email Password:  Password of the email account that you will be using to send emails FROM
  • Email Server:  Address of the email server that you will be using to send emails FROM
  • Email Port:  Port of the email server that you will be using to send emails FROM
  • Record Seconds:  Minimum number of seconds of audio that will be recorded after a valid page is received
  • Record Release Time: Number of seconds of silence necessary before recording will stop (dynamic record time).  Max is 60 seconds, default is 0 (which makes recording 100% based Record Seconds parameter)
  • Tone Tolerance:  Tolerance (in percentage) of the tone detection algorithm.  As an example, if a tone of 1000 Hz is specified and the tolerance is 2%, the program will detect tones from 980 Hz to 1020 Hz.  If this is set too narrow some tones may be missed.  If it is set too wide, false detections may occur.  A value of 1-2% is usually sufficient.
  • Tone Offset:  This is a “fudge factor” offset (in percentage) that is applied to all incoming audio signals.  This can be used to correct for sound card inaccuracy due to clock offset or drift.
  • ANI Display Time:   This is the number of seconds that the ANI code and alias information will be displayed on the main screen after an ANI code is received.
  • Tone Format:  Select the five-tone standard being used by the system being monitored.
  • Email Priority:  Sets the email priority for the message header [X-Priority].  1 = highest, 3 = normal, 5 = lowest
  • MP3 Encoding Bitrate:  Select the desired mp3 encoding bitrate from the drop down menu.  Lower bitrates result in smaller files, higher bitrates result in larger, higher quality files.
  • BCC Email Recipients:  When checked, emails will be sent as a blind carbon copy (BCC) so that email recipients don’t see the email addresses of other recipients.
  • Tone Strength Threshold:  This parameter changes how “strong” the tone must be relative to background noise before it is considered valid for detection.  Values between 10 and 20 seem to work well.  A value that is too low will result in falsing on voice traffic, while a value that is too high will prevent tone detection.

A note on using Gmail as your email provider

If you use Gmail as your email provider to send messages from TwoToneDetect and you use two-step authentication, you’ll want to set up an application-specific password that TwoToneDetect can use with your Gmail account to prevent two-step authentication issues.  For details on how to set this up, see this page.

You might also need to allow “less secure” apps to access your Gmail account.

ANI Alias Display

If desired, the program can display a text alias for each ANI code that is received, even if this code is not alerted on.  The file alias.csv in the program directory can be edited with the ANI alias information for your system.

Program Operation

FiveToneDetect continuously checks the sound card input for audio.  If the audio level exceeds a set threshold, the program measures the most dominant tone in the audio signal (even if it is not a true “tone”).  If it sees a valid five tone page, it will start an alert thread that will record audio after the page, convert the recorded audio into AMR and MP3 format, and then send the audio as an email attachment.  The program can also trigger external programs or scripts to run upon tone set detection.

User Map

Using FIveToneDetect? Show us where!  Add your location to the map below by going here and signing in with your Google account.  Edit the map to add your location.  Or, just send me an email and I’ll add your location to the map!

TwoToneDetect Users