refactor: move source files to src/ directory and rename project to Captioneer

Restructure Go source code into a dedicated `src/` directory, rename the project from "audio-listen" to "Captioneer", and update README accordingly. Add `.gitignore` entry for the built binary `captioneer`.
This commit is contained in:
2026-07-16 12:01:51 +03:00
parent d042637351
commit ce2161b7e6
12 changed files with 385 additions and 327 deletions
+22 -11
View File
@@ -1,4 +1,4 @@
# audio-listen
# Captioneer
Local, live English captions for the audio playing through your default PulseAudio/PipeWire output device. It captures that output's monitor source, runs the Parakeet TDT v2 model locally, and writes captions to the terminal.
@@ -24,7 +24,7 @@ Clone the project, then download the required models once:
```bash
git clone <your-repository-url>
cd audio-listen
cd captioneer
./scripts/download-models.sh
```
@@ -35,20 +35,20 @@ The download installs the Parakeet TDT v2 int8 model and Silero VAD into `models
Use VAD mode for normal live captions. It shows a temporary `…` caption while speech is active, then prints a timestamped final caption after 0.5 seconds of silence:
```bash
go run . --mode=vad
go run ./src --mode=vad
```
Use fixed mode to decode exact time slices, even through silence:
```bash
go run . --mode=fixed --chunk-duration=1s
go run ./src --mode=fixed --chunk-duration=1s
```
Build a reusable executable instead of using `go run`:
```bash
go build -o audio-listen .
./audio-listen --mode=vad
go build -o captioneer ./src
./captioneer --mode=vad
```
Press <kbd>Ctrl</kbd>+<kbd>C</kbd> to stop. Pending audio is flushed before exit.
@@ -70,17 +70,28 @@ Examples:
```bash
# Faster fixed chunks
go run . --mode=fixed --chunk-duration=500ms
go run ./src --mode=fixed --chunk-duration=500ms
# Fewer VAD preview redraws and four CPU threads
go run . --mode=vad --chunk-duration=2s --threads=4
go run ./src --mode=vad --chunk-duration=2s --threads=4
# Store or reuse models outside this repository
go run . --mode=vad --models-dir=/path/to/models
go run ./src --mode=vad --models-dir=/path/to/models
```
There are no environment variables to configure. All supported configuration is supplied with command-line options.
## Source layout
All Go code lives in `src/`. It remains one executable package, split into focused files:
- `main.go` coordinates startup and shutdown.
- `config.go` defines and validates command-line options.
- `capture.go` reads the default system-audio monitor.
- `audio.go` contains PCM conversion and audio calculations.
- `models.go` validates and initializes Parakeet and Silero.
- `captions.go` handles fixed chunks, VAD segments, and terminal output.
## Output and troubleshooting
Final captions go to standard output in this form:
@@ -92,7 +103,7 @@ Final captions go to standard output in this form:
Startup messages and overload warnings go to standard error, so you can save final captions separately:
```bash
go run . --mode=vad > captions.txt
go run ./src --mode=vad > captions.txt
```
- **Missing model files:** run `./scripts/download-models.sh` again.
@@ -104,5 +115,5 @@ go run . --mode=vad > captions.txt
```bash
go test ./...
go build ./...
go build -o captioneer ./src
```