Skip to content

A script that monitors an audio stream and converts the audio to text along with an aduio clip locally. Then it can be scanned for keywords with an alert sent when something is found.

Notifications You must be signed in to change notification settings

justingreerbbi/Scanner-Monitor

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

32 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Audio Scanner, Recorder, and Transcribe with Keyword Alerts

Description

This application is designed to monitor and record audio from various sources, including live streams or direct line-in inputs. It leverages the power of OpenAI's Whisper model for like real-time transcription of the captured audio into text. Additionally, this project provides a feature to set custom keywords which, when detected in the transcribed text, trigger specific alerts to notify users.

THIS SCRIPT IS SOLELY FOR DEVELOPMENT RIGHT NOW AND IS A WORK IN PROGRESS. TRY IT, FORK IT, PR UPDATES, ENJOY!

Features

  • Monitor scanner feed from Online source
  • Monitor scanner feed from line-in ( still in development )
  • Record audio for later playback
  • Transcribe audio to text using OpenAI Whisper
  • Keyword Notifications

Requirements

It is best to setup a virtual environment so you don't muddy your core Python libraries up.

Install ffmpeg using choco or brew.

brew install ffmpeg

Note: Python version 3.11 or newer is not supported by OpenAI Whisper, thus not support by this application if you choose to use transcribing.

Installation

  1. Clone the repository:

    git clone https://github.com/justingreerbbi/Scanner-Monitor.git
    
  2. Navigate to the project directory:

    cd Scanner-Monitor
    

Usage

  1. Run Only Once... Requirements

    pip install -r requirements.txt
    
  2. Start the application:

    python listen.py
    

    Note: On your first run with OpenAI Whisper, you will need internet connection. The application will download the model and automatically proceed to scanning, recording and transcribing.

  3. Follow the on-screen instructions. For demo purposes, use the stream url "https://broadcastify.cdnstream1.com/13705". The example uses a Broadcastify audio stream for public safety services but the logic applies to anything that has an audio stream

Supported Config Options

Option Description Default Value
KEYWORDS Keywords are separated by space test
CHUNK Size of audio chunks 1024*8
RECORD_SECONDS Duration after audio found 2
OUTPUT_DIRECTORY Directory to save recordings ./recordings
TRANSCRIBE_ENABLED Enable or disable transcription True
WHISPER_MODEL Whisper model to use base
ONLY_CONSOLE_LOG_TRIGGER Log alerts only to console True
PLAY_TONE_ON_ALERT Play a tone when a keyword is detected True
DEBUG Enable or disable debug mode False
PLAY_AUDIO Play the audio while recording True

Config File

The config file can be used to for easier management.

  • Keywords: Keywords are separated by a space. Single keywords are only supported currently.

I do plan on completing the config file fully. For now, only keywords are supported.

Limitations

  • While transcribing, the application does not listen to the audio stream. Using a large model for transcribing, will lead to longer gaps in recording.

Contributing

There is a long list of possibilities for this project. Since the project is just a proof of concept, there is limited support but all feedback and help is welcome. A PR can be submitted with all bug fixes, additional features, and optimizations.

License

This project is licensed under the MIT License. See the LICENSE file for details.

Contact

For any questions or suggestions, please open an issue.

Todos

  • Add support for line-in audio.
  • Add better options for ease of use.
  • Archive Structure of audio and text files respectively.
  • Cleanup function for older content.
  • Compression of archive files for storage.
  • Build wrapper for python script.

Attribution

  • gmaxwell, Public domain, via Wikimedia Commons

About

A script that monitors an audio stream and converts the audio to text along with an aduio clip locally. Then it can be scanned for keywords with an alert sent when something is found.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages