Dispatch Tone Out Decoder Part 7: Testing a New Method to Detect Two Tone Dispatches
The Google speech to text detection is not work great at the moment, it misses several words and confuses others, maybe with a better audio recording it will do better. I want to test it again with the Behringer UCA222 adapter when it arrives. I am hoping the UCA222 will give a better quality audio recording, but we will see later.
While waiting for the new Behringer UCA222 USB audio adapters to arrive, I am trying a new detection method for the Two Tone detection. The original routine works pretty well but is not 100%, it will miss a tone out detection about 1 out of 15-20 times.
The original method worked by seeking out the peak frequency then checking how many times it occurred based on timing. With this method there always is a peak frequency in every FFT data set, so there are many checks to test if a valid tone and every now and then it misses for one reason or another. I have ideas how to improve this method too but I want to try a new idea.
The new method first takes several data chunks from the audio stream, performs an FFT on each chunk, then sums the FFT data sets together. If a single tone is happening it adds to the single bin in the summed data, noise will average to some level since it will randomly populate bins in each data set. Summing the FFT sets together pulls the single tone bin up and averages non repetitive frequencies down in the surrounding bins relative to the tone.
When a tone out is sent out, the transmission is usually sent out with no overlapping traffic. If we look at a plot the FFT data of actual recordings from the scanner we see for the first or second part of the tone something like this, a single bin with some fill spilling into the bins just below and above the main bin:

A voice transmission should look similar to this with many bins having varying amplitude:

Searching for a single tone is accomplished by testing a peak tone against surrounding bins to see if there are any other bins that have relatively high levels or not. If the surrounding bins are at low levels then a single tone is flagged as a possible tone out frequency. I started coding this up yesterday and already without a lot of debug it is working at detecting tone outs about as well as the original method that took a week to get to the point it is at today.
I left both running in parallel yesterday listening to the same audio source, this is from the original method:
2300: Boulder Rural Fire : Tone out on 01-04-23 at 00:36:58
1: 948.4Hz 2:1983.8Hz C1:15 C2: 15
3100: Boulder Emergency Squad (Group 2) : Tone out on 01-04-23 at 00:37:01
1: 1035.3Hz 2:1984.0Hz C1:17 C2: 15
****** Tone out on 01-04-23 at 00:37:02
1: 1984.2Hz 2:1031.2Hz False: 0
c1: 1031.2077625728903 c2: 15
American Medical Response : Tone out on 01-04-23 at 00:37:06
1: 1405.3Hz 2:1530.8Hz C1:14 C2: 15
2600: Lafayette Fire Department : Tone out on 01-04-23 at 01:35:23
1: 947.7Hz 2:1345.2Hz C1:16 C2: 15
****** Tone out on 01-04-23 at 01:52:59
1: 1096.6Hz 2:1343.1Hz False: 0
c1: 1343.1419031575342 c2: 15
2600: Lafayette Fire Department : Tone out on 01-04-23 at 03:51:24
1: 948.1Hz 2:1337.9Hz C1:11 C2: 15
2600: Lafayette Fire Department : Tone out on 01-04-23 at 05:02:34
1: 1083.1Hz 2:1328.5Hz C1:15 C2: 15
2600: Lafayette Fire Department : Tone out on 01-04-23 at 05:02:39
1: 1083.6Hz 2:1343.6Hz C1:16 C2: 15
2600: Lafayette Fire Department : Tone out on 01-04-23 at 05:18:23
1: 948.6Hz 2:1344.4Hz C1:14 C2: 15
2200: Mountain View Fire St.-6 : Tone out on 01-04-23 at 05:18:28
1: 1129.9Hz 2:868.4Hz C1:11 C2: 15
2700: Louisville Ambulance : Tone out on 01-04-23 at 06:39:08
1: 1674.6Hz 2:1120.9Hz C1:13 C2: 15
2200: Mountain View Fire : Tone out on 01-04-23 at 06:49:04
1: 1497.9Hz 2:1086.1Hz C1:14 C2: 15
And this is the new method, still needs a little debug but not bad for day one testing:
2300: Boulder Rural Fire : Tone out on 01-04-23 at 00:36:57
1: 949.6Hz @:11.3 , 2:1989.1Hz @:1.9
3100: Boulder Emergency Squad (Group 2) : Tone out on 01-04-23 at 00:37:00
1: 1035.8Hz @:11.9 , 2:1988.9Hz @:1.9
3100: Boulder Emergency Squad (Group 1) : Tone out on 01-04-23 at 00:37:03
1: 1026.8Hz @:7.2 , 2:1250.9Hz @:0.5
2600: Lafayette Fire Department : Tone out on 01-04-23 at 01:35:22
1: 942.9Hz @:10.5 , 2:1334.6Hz @:1.7
2600: Lafayette Fire Department : Tone out on 01-04-23 at 03:51:23
1: 946.1Hz @:15.4 , 2:1355.8Hz @:2.7
2600: Lafayette Fire Department : Tone out on 01-04-23 at 05:18:22
1: 951.2Hz @:2.1 , 2:1345.6Hz @:7.2
2200: Mountain View Fire St.-6 : Tone out on 01-04-23 at 05:18:27
1: 1130.7Hz @:12.4 , 2:861.1Hz @:6.2
2700: Louisville Ambulance : Tone out on 01-04-23 at 06:39:08
1: 1670.0Hz @:8.1 , 2:1131.9Hz @:2.2
2200: Mountain View Fire : Tone out on 01-04-23 at 06:49:04
1: 1518.0Hz @:4.1 , 2:1096.7Hz @:13.8
2300: Boulder Rural : Tone out on 01-04-23 at 06:49:44
1: 948.3Hz @:6.5 , 2:1529.3Hz @:2.2
The line below each department tone out is for debug purposes, on the new method it shows the relative amplitude of each tone, the original method shows counts of tone occurrence in given time periods
Update: After leaving this running for a day I noticed that it would still miss random tone outs, and while tone out usually go out without overlapping audio there still are a percentage that do have either TX chirps or are mixed with some voice. I will think about this some more….