Creating a new Pi image called iCAD Pi for tone detection.

xicarusx

Member
Feed Provider
Joined
Oct 2, 2008
Messages
104
Location
Sayre, PA
I have started developing and creating a new Pi appliance image called iCAD Pi. This image is for tone detection and sending out notifications. Using RTL_Airband and FD Tone Notify.

This image will work on Raspberry Pi 4, if I have enough requests I can make it work on other variations of Raspberry Pi. I would like some feedback on the features, what you would like to see or not see.


Features:
RTL_Airband with NFM support:

  • Listens to dispatch frequency and outputs audio to a pulse audio sink and Icecast 2
Using FD Tone Notify:
  • Listens to pulse audio sink from RTL_Airband and detects tones and starts pre/post recording scripts
Web Interface, including icecast stream of dispatch freq from RTL_Airband
  • Day, Week, Month, Year Statistics for calls
    • Totals grouped by tone name
    • List of calls for the time period
  • At the top of the Web Interface NOAA Alerts for your area

(Any feature below can be configured. Including Enabled/Disabled)

MQTT Topic
  • Publish Start and Stop Message to MQTT

MP3 Manipulation
  • Append the detector name to the beginning of the MP3
  • Append an audio file to the beginning of the MP3
  • Convert MP3 to Stereo
  • High Pass Filter
  • Low Pass Filter
  • Gain Filter
SFTP Upload
  • Upload Audio file via SFTP to remote webserver for hosting.
MySQL Database
  • Store some details about the call in a MySQL Database
  • Allows for a web interface listing past calls and statistics

Audio Transcription
  • Requires Deepgram API key
  • Transcribes Audio to text and puts in the MySQL database to view on web interface.

Pushover Notifications
  • Allows sending pushover notifications per tone to a tone specific delivery group
  • Allows sending pushover notification for all tones detected to a "All Tones" delivery group
Broadcastify Calls:
  • Post call to Broadcastify Calls ingest
  • Requires approval of providing calls
  • Currently a work in progress.
Facebook Page Posting
  • Requires creation of a simple Facebook App
  • Allows posting call to a Facebook Page with audio link
Twitter Post Tweet
  • Requires developer credentials for Twitter
  • Posts a Tweet of the call with dispatch audio link
Zello
  • Streams Call to a Zello Group
  • Requires a separate Zello account that is a developer profile
Cleanup for local and remote files:
  • Cleans up local files based on amount of days you set.
  • Cleans up remote files based on amount of day you set.

If there are any features you would like to see let me know.
 

jschmall

Member
Premium Subscriber
Joined
Jul 15, 2017
Messages
79
Location
Anderson, CA
This looks fantastic. Do you have a GitHub I could check out? I have a spare Pi4 that I could run this on to test out
 

jschmall

Member
Premium Subscriber
Joined
Jul 15, 2017
Messages
79
Location
Anderson, CA
Not quite yet, but I am working on it. Once I have the image completed and some bugs worked out. I will share the image!
I look forward to it. In the mean time I’m going to set up TD Notify. I was using TTD but I’m going to give this a shot.
 

xicarusx

Member
Feed Provider
Joined
Oct 2, 2008
Messages
104
Location
Sayre, PA
I look forward to it. In the mean time I’m going to set up TD Notify. I was using TTD but I’m going to give this a shot.

I just started using FD Tone Notify, and I like it better. It just seems to run better. Plus, it works with the virtual cables I create for pulse audio :)
 

jschmall

Member
Premium Subscriber
Joined
Jul 15, 2017
Messages
79
Location
Anderson, CA
I just started using FD Tone Notify, and I like it better. It just seems to run better. Plus, it works with the virtual cables I create for pulse audio :)
I looked through the documentation and it looks like using a pulseaudio sync is feasible. Currently my rtl-airband sends to a local pulse server so I can transition to FD Tone fairly easily.
 

xicarusx

Member
Feed Provider
Joined
Oct 2, 2008
Messages
104
Location
Sayre, PA
Update:

I have all the components of the fd tone notify script working, and have also created a script to grab info from tones.cfg and import it in to the default fd-tone-notify default.json

Working on documentation (There is ALOT), a MQTT client for subscribing to mqtt topics and enabling/disabling gpio pins, and finalizing the image. Should have a release in a day or so. :)

Code:
2022-08-08 15:47:32,508 - fd_tone_notify_extension - INFO - Post Record Script Start
2022-08-08 15:47:32,509 - fd_tone_notify_extension - DEBUG - Broadcastify Calls Enabled
2022-08-08 15:47:32,510 - fd_tone_notify_extension.broadcastify_calls - INFO - Uploading to Broadcastify Calls
2022-08-08 15:47:32,510 - fd_tone_notify_extension - DEBUG - Twilio SMS Enabled
2022-08-08 15:47:32,511 - fd_tone_notify_extension.twilio - INFO - Sending SMS with Twilio
2022-08-08 15:47:32,511 - fd_tone_notify_extension - DEBUG - Pushover Enabled
2022-08-08 15:47:32,516 - fd_tone_notify_extension.pushover - INFO - Sending Pushover Notifications
2022-08-08 15:47:32,516 - fd_tone_notify_extension.pushover - DEBUG - Sending to Pushover Group All
2022-08-08 15:47:32,517 - fd_tone_notify_extension - DEBUG - Facebook Page Post Enabled
2022-08-08 15:47:32,528 - fd_tone_notify_extension.facebook - INFO - Posting to Facebook Page
2022-08-08 15:47:32,530 - fd_tone_notify_extension - DEBUG - Twitter Enabled
2022-08-08 15:47:32,534 - fd_tone_notify_extension.twitter - INFO - Posting to Twitter
2022-08-08 15:47:32,534 - fd_tone_notify_extension - DEBUG - Append Tone Name Audio Enabled
2022-08-08 15:47:32,537 - fd_tone_notify_extension.mp3 - INFO - Appending Text to Speech
2022-08-08 15:47:32,538 - fd_tone_notify_extension.facebook - DEBUG - Waiting for additional tones from same call.
2022-08-08 15:47:32,548 - fd_tone_notify_extension.twitter - DEBUG - Waiting for additional tones from same call.
2022-08-08 15:47:32,890 - fd_tone_notify_extension.pushover - DEBUG - Pushover Successful: Group All
2022-08-08 15:47:32,891 - fd_tone_notify_extension.pushover - DEBUG - Sending to Pushover Group
2022-08-08 15:47:33,401 - fd_tone_notify_extension.pushover - DEBUG - Pushover Successful: Group Wysox 21
2022-08-08 15:47:33,524 - fd_tone_notify_extension.twilio - INFO - queued
2022-08-08 15:47:33,705 - fd_tone_notify_extension.broadcastify_calls - DEBUG - Sending Request for Call Upload Url
2022-08-08 15:47:34,344 - fd_tone_notify_extension - DEBUG - Append Audio File Enabled
2022-08-08 15:47:34,345 - fd_tone_notify_extension.mp3 - INFO - Appending Audio File
2022-08-08 15:47:34,726 - fd_tone_notify_extension.broadcastify_calls - INFO - Uploading Call Audio
2022-08-08 15:47:35,250 - fd_tone_notify_extension.broadcastify_calls - INFO - Upload Call Audio Complete
2022-08-08 15:47:35,250 - fd_tone_notify_extension.broadcastify_calls - DEBUG - Cleaning Call Files
2022-08-08 15:47:36,521 - fd_tone_notify_extension - DEBUG - Stereo Convert Enabled
2022-08-08 15:47:36,522 - fd_tone_notify_extension.mp3 - INFO - Converting to Stereo
2022-08-08 15:47:38,511 - fd_tone_notify_extension - DEBUG - Low Pass Filter Enabled
2022-08-08 15:47:38,512 - fd_tone_notify_extension.mp3 - INFO - Applying Low Pass Filter
2022-08-08 15:47:47,094 - fd_tone_notify_extension - DEBUG - High Pass Filter Enabled
2022-08-08 15:47:47,094 - fd_tone_notify_extension.mp3 - INFO - Applying High Pass Filter
2022-08-08 15:48:01,191 - fd_tone_notify_extension - DEBUG - Gain Filter Enabled
2022-08-08 15:48:01,191 - fd_tone_notify_extension.mp3 - INFO - Applying Gain Filter
2022-08-08 15:48:03,356 - fd_tone_notify_extension - DEBUG - Zello Enabled
2022-08-08 15:48:03,357 - fd_tone_notify_extension.zello - DEBUG - Creating Zello Token
2022-08-08 15:48:03,358 - fd_tone_notify_extension - DEBUG - SFTP Enabled
2022-08-08 15:48:03,358 - fd_tone_notify_extension.sftp - INFO - Uploading /home/icad/icad/audio_recordings/2022/08/08/Wysox_21_2022_08_08_15_46_55.mp3 to 192.168.1.107
2022-08-08 15:48:03,812 - fd_tone_notify_extension.zello - DEBUG - Converting Audio to Opus
2022-08-08 15:48:03,904 - fd_tone_notify_extension - DEBUG - MySQL Enabled
2022-08-08 15:48:04,111 - fd_tone_notify_extension.mysql.Database - INFO - Adding Detection to Database
2022-08-08 15:48:04,132 - fd_tone_notify_extension - DEBUG - Speech to Text Enabled
2022-08-08 15:48:04,134 - fd_tone_notify_extension.transcription - INFO - Transcribing Audio to Text
2022-08-08 15:48:05,324 - fd_tone_notify_extension.zello.ZelloSend - INFO - Starting Zello Stream
2022-08-08 15:48:09,072 - fd_tone_notify_extension.transcription - DEBUG - Adding Transcription to Database Entry
2022-08-08 15:48:09,178 - fd_tone_notify_extension.mysql.Database - INFO - Updating Transcription in Database
2022-08-08 15:48:09,192 - fd_tone_notify_extension - DEBUG - Local File Cleanup Disabled
2022-08-08 15:48:09,193 - fd_tone_notify_extension - DEBUG - Remote File Cleanup Disabled
2022-08-08 15:48:43,245 - fd_tone_notify_extension.twitter - DEBUG - Tweet Successful
2022-08-08 15:48:44,001 - fd_tone_notify_extension.facebook - DEBUG - Page Post Successful: 100637976094520
2022-08-08 15:48:45,281 - fd_tone_notify_extension.zello.ZelloSend - INFO - Completed Zello Stream
2022-08-08 15:48:45,579 - fd_tone_notify_extension.zello.ZelloSend - DEBUG - Closing Zello Stream Loop
2022-08-08 15:48:45,581 - fd_tone_notify_extension - INFO - Post Record Script Complete
 

jschmall

Member
Premium Subscriber
Joined
Jul 15, 2017
Messages
79
Location
Anderson, CA
Do you currently have a way to ingest data from a separate RTL_Airband instance? I have RTL_Airband running and configured how I like it and would love to implement this while using my RTL_Airband install.

Also, is this only for Raspberry Pi or can I run this on a vanilla linux system?
 

xicarusx

Member
Feed Provider
Joined
Oct 2, 2008
Messages
104
Location
Sayre, PA
Do you currently have a way to ingest data from a separate RTL_Airband instance? I have RTL_Airband running and configured how I like it and would love to implement this while using my RTL_Airband install.

Also, is this only for Raspberry Pi or can I run this on a vanilla linux system?

I will have an image for the Pi, but you can use this on any Linux system. :) My suggestion for taking data from RTL_Airband setting up a pulseaudio server to accept it on the machine you will be running the fd-tone-notify and the script on.
 

jschmall

Member
Premium Subscriber
Joined
Jul 15, 2017
Messages
79
Location
Anderson, CA
I will have an image for the Pi, but you can use this on any Linux system. :) My suggestion for taking data from RTL_Airband setting up a pulseaudio server to accept it on the machine you will be running the fd-tone-notify and the script on.
Perfect! I already have pulse up and running for other radio purposes so I will integrate this as well.
 

xicarusx

Member
Feed Provider
Joined
Oct 2, 2008
Messages
104
Location
Sayre, PA
Perfect! I already have pulse up and running for other radio purposes so I will integrate this as well.

There will be two releases. One will be a release of just the scripts on github and the second is the Pi Image. I have put the scripts up already, but its not complete. It does not include the database schema or the html for the site. Currently working on documentation for that.

 

AFD103

Member
Premium Subscriber
Joined
Nov 17, 2020
Messages
26
I don't have a spare RP4 laying around, but I have several RP3s. I'd love to see an image that'll work for the 3. I've been struggling with getting TTD up and running with a SDR.

Following for future notifications.
 

w2lie

New York DB Admin
Database Admin
Joined
Mar 2, 2004
Messages
1,626
Location
Long Island, NY
I don't have a spare RP4 laying around, but I have several RP3s. I'd love to see an image that'll work for the 3. I've been struggling with getting TTD up and running with a SDR.

Following for future notifications.
I'm here to say the same. I have a few RP3's and RP4's are in short supply right now. Something that could work on an RP3 would be neat.
 

xicarusx

Member
Feed Provider
Joined
Oct 2, 2008
Messages
104
Location
Sayre, PA
I'm here to say the same. I have a few RP3's and RP4's are in short supply right now. Something that could work on an RP3 would be neat.

I don't have a RP3, but the only thing keeping it from working with the image is RTL_Airband. I may be able to create an image with out it compiled, and have a script that will compile it for you. Would that work?
 

w2lie

New York DB Admin
Database Admin
Joined
Mar 2, 2004
Messages
1,626
Location
Long Island, NY
Hmm, I didn't realize that RTL_Airband would require a Pi4. I think I'll have to find a deal on a Pi4. Seems prices on them have exploded with the limited supply out there. You'd think they were cars. ;)
 

xicarusx

Member
Feed Provider
Joined
Oct 2, 2008
Messages
104
Location
Sayre, PA
Hmm, I didn't realize that RTL_Airband would require a Pi4. I think I'll have to find a deal on a Pi4. Seems prices on them have exploded with the limited supply out there. You'd think they were cars. ;)

It doesn't require a Pi 4. Its just compiled different between version. Pi 3 can be complied to use the video core for optimization.

I would compile it with this flag for RP3 instead of the armv8-generic option. Which uses no video core.
rpiv2 - Raspberry Pi version 2 or 3 (ARMv7 CPU, Broadcom VideoCore IV GPU)

So it can be done, I can make an image that will compile it for you on your hardware. The reason for compiling is to add NFM option which isn't enabled normally.
 

AFD103

Member
Premium Subscriber
Joined
Nov 17, 2020
Messages
26
Cleanup for local and remote files:
  • Cleans up local files based on amount of days you set.
  • Cleans up remote files based on amount of day you set.

If there are any features you would like to see let me know.

I may be alone in wanting this - how about the ability to set cleanup times on a per-department/per toneset basis? Or even a cleanup on/off per department or toneset?

My countywide EMS service runs 25 calls a day. Their dispatches take up more space, and I'd like them to be purged once a week. My neighboring fire agencies, however, only run about 100 calls a year. I'd like to keep them for a month at a time. My home department, I'd like to keep in perpetuity.

Alternatively: set a global cleanup time to 30 days, with a flag on individual entries to skip cleanup.


A 'pie in the sky' ask would be for integration with HomeAssistant.
I currently have TTD firing a script that executes individual "turn on" commands via python-kasa, sleeping for five minutes, then turning them off. It's great to have the bedroom, living room, and front door lights come on at 3am when our pagers are activated. Some type of HomeAssistant integration would allow for more automations and to stem outside one particular vendor's ecosystem.

Just a couple things to kick around.
 
Top