Add README.md with project overview, features, usage, and requirements

This commit is contained in:
2025-08-15 12:34:08 -04:00
parent 9b2343c867
commit d901673e83

44
README.md Normal file
View File

@ -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 <RTSP_URL> [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)
##