From d901673e8328d6d353bca06193d2e0456c0f8265 Mon Sep 17 00:00:00 2001 From: Alex Savin Date: Fri, 15 Aug 2025 12:34:08 -0400 Subject: [PATCH] Add README.md with project overview, features, usage, and requirements --- README.md | 44 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 README.md diff --git a/README.md b/README.md new file mode 100644 index 0000000..ff024d5 --- /dev/null +++ b/README.md @@ -0,0 +1,44 @@ +# Go Two-Tone Detector + +This project is a Go application for detecting two-tone sequences (such as paging tones) in real-time audio streams. It connects to an RTSP stream, decodes G711 mu-law audio, and analyzes the audio for specific tone patterns using the Goertzel algorithm. When a valid two-tone sequence is detected, the app can record and save the relevant audio segment as a WAV file. + +## Features + +- **RTSP Client:** Connects to audio streams using RTSP protocol. +- **G711 mu-law Decoding:** Converts mu-law encoded audio to PCM samples. +- **Two-Tone Detection:** Uses Goertzel algorithm to detect and confirm tone sequences. +- **Recording:** Automatically records and saves audio segments containing detected tones. +- **Configurable Parameters:** Window size, hop size, thresholds, and durations are adjustable via command-line flags. +- **Graceful Shutdown:** Handles interrupts and ensures recordings are saved before exit. + +## Usage + +```sh +go run main.go -rtsp [flags] +``` + +### Example Flags + +- `-rtsp` : RTSP stream URL (required) +- `-winMs` : Window size in milliseconds (default: 100) +- `-hopMs` : Hop size in milliseconds (default: 50) +- `-ratioThresh` : Power ratio threshold for tone detection +- `-rmsThresh` : RMS threshold for signal detection +- `-minAms` : Minimum duration for Tone A (ms) +- `-minBms` : Minimum duration for Tone B (ms) +- `-gapMaxMs` : Maximum allowed gap between tones (ms) +- `-silenceThresh` : RMS threshold for silence detection +- `-silenceDurMs` : Duration of silence before stopping recording (ms) + +## Output + +- Detected tone events are logged to the console. +- Audio segments containing detected tones are saved as WAV files in the current directory. + +## Requirements + +- Go 1.20+ +- [gortsplib](https://github.com/aler9/gortsplib) +- [go-audio/wav](https://github.com/go-audio/wav) + +## \ No newline at end of file