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!
- 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
It is best to setup a virtual environment so you don't muddy your core Python libraries up.
- Recommended Python Version: 3.11 (https://www.python.org/downloads/)
- ffmpeg
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.
-
Clone the repository:
git clone https://github.com/justingreerbbi/Scanner-Monitor.git
-
Navigate to the project directory:
cd Scanner-Monitor
-
Run Only Once... Requirements
pip install -r requirements.txt
-
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.
-
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
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 |
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.
- While transcribing, the application does not listen to the audio stream. Using a large model for transcribing, will lead to longer gaps in recording.
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.
This project is licensed under the MIT License. See the LICENSE file for details.
For any questions or suggestions, please open an issue.
- 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.
- gmaxwell, Public domain, via Wikimedia Commons