FD Tone Notify - New Tone Detection Software Released

KN4GRO

Member
Joined
Sep 15, 2010
Messages
41
Hello all, just for reference, when wanting to point to a specific sink within the pulse server, it is a matter of simply using:

Code:
pulse:sinkname
Thanks for the hint kevind963!

I have put together a system that has 4 SDR's controlled by OP25. Each SDR is tuned to a specific talk group on a trunked system in my area (we'll call these north, central, west and south.) and FD Tone Notify is "listening" for tones in each area independently. More on this later...


Allow me to provide an example as it pertains to FD Tone Notify and Linux... Maybe this will help some other noob, just like me, in the future...

When you run OP25, if you choose to output the audio to the sound card, it creates a "playback" named: 'ALSA plug-in [python3.8]' (sometimes also called OP25: ALSA Playback depending on how you run OP25)

When you run an instance of FD Tone Notify, it does something similar but instead it creates a "record" (think "virtual" microphone) named: 'ALSA plug-in [aplay]'

So how do you make a "record" listen to the audio coming from a "playback?"

The simple answer is: If you're using pulseaudio, you first need to create a "null-sink" (think "virtual" cable that isn't plugged in anywhere...yet)

To create a null sink AND give it a name (name is important) you head out to a terminal window and type the following:

Code:
pactl load-module module-null-sink sink_name=north sink_properties=device.description="north"

Why north? Well, you can make it whatever you want... I chose north because in my area, the four channels I'm monitoring are referred to as North District, Central District, and so on...

Now that you have a null sink (virtual cable that isn't plugged into anything) you can head over to pavucontrol and you will see both an output device called "north" and an input device called "Monitor of north" Think of these as two ends of our virtual cable...

<<<north output--------- lonely virtual cable with nothing to do yet (also called a null-sink) ---------input Monitor of north>>>

Since there is nothing being fed through this virtual cable yet, we need to do that next.

In pavucontrol, in the Playback tab, find your OP25 Playback and over on the right hand side you'll see a button that allows you to choose which "output" you want to playback on. Go ahead a choose "north" here.. Now we've plugged in the output side of our virtual cable. The other end, "input," still isn't plugged into anything. So head on over to the "Recording" tab and find your [aplay] plug-in and over on the right hand side you'll see a button that allows you to choose which "input" you want your record device to listen to.. Go ahead and choose "Monitor of north" here. Now that you've virtually plugged in both ends of your cable, you end up with something like this:

OP25: Playback <<<north output--------- happy cable with audio flowing through it ---------input Monitor of north>>> FD Tone Notify Record

So now we've got what we need, everything should be fine, right? Well, not exactly... You see, everything we've done here will not survive a machine reboot or restarting of either FD Tone Notify or OP25.... Further, OP25 and in fact anything that you point at pulseaudio tends to "fallback" on either the last output used by pavucontrol or simply point to the default output as defined system wide or user specific conf files.. Multiply this problem by 4 channels and you can very quickly start to see the problem here... So what's the answer?

Well for starters we have to make our "virtual cables (null-sinks)" permanent, so that they survive a system reboot. To do this, you will need to make a simple change to your /etc/pulse/default.pa

The easiest way to do this is to use the following command from terminal:
Code:
sudo nano /etc/pulse/default.pa

You're going to want create the null sink much like we did above but, drop the pactl from the beginning of the line. Do this for each permanent virtual cable you want to load with your system. in my case I added four lines. Like this:
Code:
load-module module-null-sink sink_name=north sink_properties=device.description="north"
load-module module-null-sink sink_name=central sink_properties=device.description="central"
load-module module-null-sink sink_name=west sink_properties=device.description="west"
load-module module-null-sink sink_name=south sink_properties=device.description="south"

Now, when I boot my system, all four of my virtual cables are just sitting there, ready for me to use

From here on out, everything gets much easier! All you need to remember is the following: the output side of your cable is called "north" and input side of your cable is called "north.monitor" To connect to either side directly, all you have to do is modify the config file for OP25 and FD Tone Detect to force each instance to connect to a specified end of the specific cable every time it starts an instance...

For example, in the configuration JSON file for FD Tone Notify "/config/default.json" You can specify a device an "inputDevice" in the "audio" section...

In our case, this inputDevice would look like this:
Code:
"inputDevice": "pulse:north.monitor"

Do this in the associated config file of each instance you are running, i.e. central, west, south

Doing this will automatically plug the FD Tone Notify [aplay] device into the "Monitor of north" on the right side of your virtual cable!!! No need to point, click and choose anymore! This is very convenient as you can imagine... Every time the instance starts it will automatically plug itself in to the correct monitor! BEAUTIFUL!!

Now, on the left of our virtual cable (sink), your playback/output side, you want to use pulse:north without ".monitor" This allows us to plug OP25 into the correct output automatically, every time it starts!

If you're using multi_rx.py then you would put the "pulse.north" parameter in "device_name" under the "audio" section like this:
JSON:
"audio": {
"module": [
    {
        "instance_name": "audio1",
        "device_name": "pulse.north",
        "udp_port": "23456",
        "audio_gain": 0.5,
        "number_channels": 1  
    }
]
}

or if you are using rx.py then simply use "pulse.north" after the -O argument, like this:
Code:
./rx.py --nocrypt --args "rtl=0" --gains 'lna:36' -X -q -0 -v 1 -2 -V -O pulse.north -U -w -W 127.0.0.1 -u 23456 -T trunk.tsv -l http://0.0.0.0:8080 2> stderr.2

That's all folks! Do this for every instance and you'll be good to go.. Now, no matter what happens; a system reboot for whatever reason, a need to restart an instance, FD Tone Notify restarting a mic instance because it detected no data after 30 seconds, it should all reconnect itself to your proper audio structure without any interaction at all from you!

It took me quite a bit of digging and reading and sheer frustration to figure this out.. I want to thank everyone on RadioReference who helped me along the way! My only hope is that my writeup here is clear enough to help someone in the future!

If you all want to hear and see the live results of what I, with the help of the wonderful people at RadioReference Forums have accomplished, PM me and I will give you a link to the YouTube channel where all four streams are live. (I'm not sure what the rules are regarding self promotion on RadioReference but I'm pretty sure it's frowned upon so I won't post the link here unless someone says it's ok..)

In addition to four live streams on YouTube, I am using FD Tone Notify to listen for tones and then run an external command. That command is written in python and reaches out to the YouTube API, grabs the appropriate stream, calculates a time stamp, parses together a link and then compiles an alert that gets sent out to both Twitter and a Telegram Channel. When the alert link is clicked, it takes you right to the point in the stream where the alert happened and since the YouTube stream is preserved in perpetuity after a stream ends, the link is clickable whenever you want it!

Thank you again to everyone who helped in any way!
Sorry but there should be a revision here...

it is pulse:north not pulse.north as I stated earlier. Use a colon not a dot... To address the monitor side (downstream) it would be pulse:north.monitor

So the above JSON config for multi_rx.py should look like this:

JSON:
"audio": {
"module": [
    {
        "instance_name": "audio1",
        "device_name": "pulse:north",
        "udp_port": "23456",
        "audio_gain": 0.5,
        "number_channels": 1  
    }
]
}
 

KN4GRO

Member
Joined
Sep 15, 2010
Messages
41
Still no luck getting the program to run. This is what I get starting the program with no parameters -

:\WINDOWS\system32>c:\Tone\fd-tone-notify.exe
WARNING: No configurations found in configuration directory:C:\WINDOWS\system32\config
WARNING: To disable this warning set SUPPRESS_NO_CONFIG_WARNING in the environment.
Oct-15-2021 08:40:01 crit : Push Bullet does not have an API Key. Notifications will not be sent
Oct-15-2021 08:40:01 warning : Cannot access secrets file at config/secrets.json. Only using secrets from env Vars
Oct-15-2021 08:40:01 warning : Secret FD_PUSHBULLET_API_KEY has not been set or has an empty value
Oct-15-2021 08:40:01 warning : Secret FD_CORALOGIX_PRIVATE_KEY has not been set or has an empty value
Oct-15-2021 08:40:01 warning : Secret FD_SMTP_USERNAME has not been set or has an empty value
Oct-15-2021 08:40:01 warning : Secret FD_SMTP_PASSWORD has not been set or has an empty value
(node:21384) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'sampleRate' of undefined
at AudioService._setupMic (C:\snapshot\code\service\AudioService.js)
at new AudioService (C:\snapshot\code\service\AudioService.js)
at fdToneNotify (C:\snapshot\code\bin\fdToneNotify.js)
at main (C:\snapshot\code\index.js)
at processTicksAndRejections (internal/process/task_queues.js:97:5)
at process.runNextTicks [as _tickCallback] (internal/process/task_queues.js:66:3)
at Function.Module.runMain (pkg/prelude/bootstrap.js:1376:13)
at internal/main/run_main_module.js:17:47
(node:21384) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see Command-line options | Node.js v16.11.1 Documentation). (rejection id: 1)
(node:21384) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

And this is what I get starting the program with the "tone-detector" parameter.

C:\WINDOWS\system32>c:\Tone\fd-tone-notify.exe --tone-detector
error: unknown option '--tone-detector'

Has anyone got this to work on Windows 10?

Thanks, John
I'm sorry John but I have not used FD Tone Notify in Windows but I will try to address each of the warnings you are seeing, to the best of my ability.

WARNING: No configurations found in configuration directory:C:\WINDOWS\system32\config
It would seem that FD Tone Notify is looking for its default.json config file in C:\windows\system32\config and not finding it there.

Oct-15-2021 08:40:01 crit : Push Bullet does not have an API Key. Notifications will not be sent
Oct-15-2021 08:40:01 warning : Cannot access secrets file at config/secrets.json. Only using secrets from env Vars
Oct-15-2021 08:40:01 warning : Secret FD_PUSHBULLET_API_KEY has not been set or has an empty value
Oct-15-2021 08:40:01 warning : Secret FD_CORALOGIX_PRIVATE_KEY has not been set or has an empty value
Oct-15-2021 08:40:01 warning : Secret FD_SMTP_USERNAME has not been set or has an empty value
Oct-15-2021 08:40:01 warning : Secret FD_SMTP_PASSWORD has not been set or has an empty value

I wouldn't worry about these warnings for the moment as it is not imperative, to my knowledge, that you have pushbullet, coralogix or SMTP properly configured in order to get FD Tone Notify to, at very least, listen to your audio.

That said, I am a bit concerned that FD Tone is expecting to find
config/secrets.json
(forward slash) on a Windows box.

(node:21384) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'sampleRate' of undefined
at AudioService._setupMic (C:\snapshot\code\service\AudioService.js)
at new AudioService (C:\snapshot\code\service\AudioService.js)
at fdToneNotify (C:\snapshot\code\bin\fdToneNotify.js)
at main (C:\snapshot\code\index.js)
at processTicksAndRejections (internal/process/task_queues.js:97:5)
at process.runNextTicks [as _tickCallback] (internal/process/task_queues.js:66:3)
at Function.Module.runMain (pkg/prelude/bootstrap.js:1376:13)
at internal/main/run_main_module.js:17:47
(node:21384) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see Command-line options | Node.js v16.11.1 Documentation). (rejection id: 1)
(node:21384) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

This is more likely where your "real" problem is..

Are you running from the source or did you use the compiled binary?
 

kevind963

Member
Feed Provider
Joined
Jun 22, 2012
Messages
46
@johnmac Any luck getting it to work so far?

On windows if you place fd-tone-notify.exe in an empty directory and start it you should get the following output.
1635599318548.png
1635599336226.png

From there you should be able to edit the default config. It would appear that your instance is starting with zero configuration (not from env vars and not from a config file) then when it gets to sampleRate it crashes because no value was configured.

Try putting the exe in a new empty directory and starting again.
 

johnmac

Member
Feed Provider
Joined
Oct 6, 2003
Messages
159
Location
Westminster, Ma
@johnmac Any luck getting it to work so far?

On windows if you place fd-tone-notify.exe in an empty directory and start it you should get the following output.
View attachment 111523
View attachment 111524

From there you should be able to edit the default config. It would appear that your instance is starting with zero configuration (not from env vars and not from a config file) then when it gets to sampleRate it crashes because no value was configured.

Try putting the exe in a new empty directory and starting again.
I have not had much time to work on this again, may take a look this weekend.
 

bmwjohnson

Newbie
Joined
Nov 3, 2021
Messages
2
Question, with Pushbullet currently at odds with Apple and having the Pushbullet app removed from the App Store, what are the options notification software?
 

kevind963

Member
Feed Provider
Joined
Jun 22, 2012
Messages
46
I wasn't aware that Pushbullet pulled their app because they were too lazy to implement Apple ID Login. For the present you can use the external command option to send a notification somewhere else. It looks like https://www.nowpush.app/index.html might be a good alternative.
 

bmwjohnson

Newbie
Joined
Nov 3, 2021
Messages
2
Kevin,
You're the man. This is a fantastic piece of software.

I've enjoyed getting it working and using it.

Many thanks for sharing your work.
Kurt
 

freqfreaks

Member
Joined
Dec 23, 2009
Messages
19
Hello,

I have been trying to get this working all day and I almost have it, but I am stuck with the recording and post processing.

I am running it under Windows 10 and I am detecting tones, it is sending the pre processing e-mails, but it seems to get stuck when trying to make the recording and it never sends the post processed e-mails (perhaps because it never makes the recording). The logs show "Starting Recording 1636854321479.wav", but it looks like it never really makes the recording and there are never any other log messages related to the recording or the sending of the post processing e-mails, it just goes back to "Initializing Recording Worker Thread".

I also looked around and I can't find that wav file anywhere on the hard drive either, which is why I think it isn't really doing what it says it is.

Thanks for any advise. I feel like I am so close, but I just can't past this last hurdle.
 

webstar22

RenfrewCountyScanner.com
Premium Subscriber
Joined
Dec 21, 2003
Messages
1,035
Location
Ontario, Canada
Hello,

I have been trying to get this working all day and I almost have it, but I am stuck with the recording and post processing.

I am running it under Windows 10 and I am detecting tones, it is sending the pre processing e-mails, but it seems to get stuck when trying to make the recording and it never sends the post processed e-mails (perhaps because it never makes the recording). The logs show "Starting Recording 1636854321479.wav", but it looks like it never really makes the recording and there are never any other log messages related to the recording or the sending of the post processing e-mails, it just goes back to "Initializing Recording Worker Thread".

I also looked around and I can't find that wav file anywhere on the hard drive either, which is why I think it isn't really doing what it says it is.

Thanks for any advise. I feel like I am so close, but I just can't past this last hurdle.

You may be missing ffmpeg.exe which means it cannot convert the file so it doesn't do the rest of the process.
 

freqfreaks

Member
Joined
Dec 23, 2009
Messages
19
Thanks webstar22. My understanding was that it uses SOX (at least under Windows) for the audio processing, but since I didn't have ffmpeg on there, I did try adding it, but it didn't help, HOWEVER you did get me thinking more about the audio processing failure, especially since even though it said it was recording xxxxx.wav, I could not find any wav files anywhere and that just had to be a factor.

After further thought and experimentation, I finally figured out the problem, and it was a user error on my part, but for the benefit of others I will tell on myself.

I had installed the FD Tone Notify directory under C:\Windows\Program Files (x86) to keep everything tidy and neat on the hard drive, however after thinking more about why I couldn't find the wav file, it finally hit me, maybe it is hanging up due to a permissions / restrictions error when it is trying to create the wav file, presumably under the Program Files (x86) directory, so I moved the FD Tone Notify directory over to the root of C:\ and then it started working normally.

So the lesson here is, if it says it is creating the recording but never does, and there are never any other errors / messages related to the recording, it could be a folder permissions issue. Make sure you have full read / write access to the directory where FD Tone Notify resides.

Thanks again webstar22. Even though the ffmpeg thing wasn't the issue, your response definitely got me refocused and looking in the right direction.
 

webstar22

RenfrewCountyScanner.com
Premium Subscriber
Joined
Dec 21, 2003
Messages
1,035
Location
Ontario, Canada
Thanks webstar22. My understanding was that it uses SOX (at least under Windows) for the audio processing, but since I didn't have ffmpeg on there, I did try adding it, but it didn't help, HOWEVER you did get me thinking more about the audio processing failure, especially since even though it said it was recording xxxxx.wav, I could not find any wav files anywhere and that just had to be a factor.

After further thought and experimentation, I finally figured out the problem, and it was a user error on my part, but for the benefit of others I will tell on myself.

I had installed the FD Tone Notify directory under C:\Windows\Program Files (x86) to keep everything tidy and neat on the hard drive, however after thinking more about why I couldn't find the wav file, it finally hit me, maybe it is hanging up due to a permissions / restrictions error when it is trying to create the wav file, presumably under the Program Files (x86) directory, so I moved the FD Tone Notify directory over to the root of C:\ and then it started working normally.

So the lesson here is, if it says it is creating the recording but never does, and there are never any other errors / messages related to the recording, it could be a folder permissions issue. Make sure you have full read / write access to the directory where FD Tone Notify resides.

Thanks again webstar22. Even though the ffmpeg thing wasn't the issue, your response definitely got me refocused and looking in the right direction.
Likely not permissions, more likely the space in Program files. Don't forget this is a native Linux app.
Moving it to C: got rid of the spacing in the folder.
 

freqfreaks

Member
Joined
Dec 23, 2009
Messages
19
Likely not permissions, more likely the space in Program files. Don't forget this is a native Linux app.
Moving it to C: got rid of the spacing in the folder.

Good point, except the directory for the program itself is "FD Tone Notify" with the spaces and it seems to be ok with that, so I'm still thinking permissions. Regardless, I can tell you that when it can't write the wav recording file, for whatever reason it may be, the log gives you no indication as to why, it never says anything after saying it is making the recording, so if anyone else has the same problem, focus on why it can't write the file. Thanks again.
 

danielbts11

W2DJB
Joined
Apr 15, 2012
Messages
19
Location
Gloversville, NY
So I have this working, but seem to have one weird issue that I can not figure out - I'm not getting prerecording notifications on Pushbullet, but do get emails. On post everything is working fine. Do not understand this, but not a big deal to me since my daily driver is an iPhone which is no longer supported by Pushbullet.
 

freqfreaks

Member
Joined
Dec 23, 2009
Messages
19
Question, with Pushbullet currently at odds with Apple and having the Pushbullet app removed from the App Store, what are the options notification software?

I am using Pushover for iOS to get alerts on my iPhone. I am using the e-mail function to get it over to Pushover, but it is pretty easy to setup and it is free. You can also create different e-mail aliases in Pushover for each department and you can setup different sounds for each. For instance, I use a louder siren type noise for a fire call, and a less obnoxious doorbell sound for an ambulance call. I used it with Two Tone Detect for years, so it was easy to switch it over to FD Tone Notify. Even though it goes through e-mail, I have always found the push notifications to be pretty much instant, so I would not worry about any delay caused by it going through e-mail.
 

cpg178

Member
Premium Subscriber
Joined
Sep 7, 2014
Messages
413
While I do not use FD Tone Notify, I use Pushover with TTD via email and second freqfreaks, I get the Pushover notification before I get the SMS from TTD.
 

sc2142

Member
Feed Provider
Joined
Dec 20, 2013
Messages
68
Location
Mountain Home, Idaho
When running the program after typing YES it just closes as soon as it opens and this error in the log:

warning : Cannot access secrets file at config/secrets.json. Only using secrets from env Vars


How can i fix this?
 

kevind963

Member
Feed Provider
Joined
Jun 22, 2012
Messages
46
When running the program after typing YES it just closes as soon as it opens and this error in the log:

warning : Cannot access secrets file at config/secrets.json. Only using secrets from env Vars


How can i fix this?
That is just a warning and would not prevent the program from starting. What command are you using to start the application? Are you starting with the --tone-detector argument? If you could post the full log that would be helpful. I would also recommend adding the --silly option for the most detailed level of logging.
 

sc2142

Member
Feed Provider
Joined
Dec 20, 2013
Messages
68
Location
Mountain Home, Idaho
That is just a warning and would not prevent the program from starting. What command are you using to start the application? Are you starting with the --tone-detector argument? If you could post the full log that would be helpful. I would also recommend adding the --silly option for the most detailed level of logging.
Where exactly do i enter the arguments, i read the docs but it didnt really say where.
 

kevind963

Member
Feed Provider
Joined
Jun 22, 2012
Messages
46
Where exactly do i enter the arguments, i read the docs but it didnt really say where.
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.
 
Top