Add --tone-test mode: 440 Hz Opus tone + incoming audio capture

Adds a --tone-test flag that bypasses all OpenAL/soundcard
initialization and instead:

- Generates a 440 Hz sine wave at 48kHz mono, encodes it via Opus,
  and sends it to the Mumble server.

- Saves all incoming decoded audio to a raw PCM file (s16le,
  stereo, 48kHz) specified by --tone-out (default: incoming.pcm).

Useful for end-to-end testing of the Opus encode/decode pipeline
and Mumble transport without requiring physical audio hardware.

Usage:
  barnard --server HOST --tone-test --tone-out /tmp/in.pcm

  ffplay -f s16le -ar 48000 -ac 2 incoming.pcm
This commit is contained in:
Brandon McGinty (deepseek)
2026-08-09 00:19:41 -04:00
committed by Brandon McGinty
parent b2a1d2f846
commit 29be821155
4 changed files with 206 additions and 6 deletions
+4
View File
@@ -117,6 +117,8 @@ func main() {
profile := flag.Bool("profile", false, "add http server to serve profiles")
noiseSuppressionEnabled := flag.Bool("noise-suppression", false, "enable noise suppression for microphone input")
autoTransmit := flag.Bool("auto-transmit", false, "start transmitting immediately on connect")
toneTest := flag.Bool("tone-test", false, "send a 440 Hz test tone instead of microphone (bypasses soundcard)")
toneTestOutput := flag.String("tone-out", "incoming.pcm", "file to save incoming audio to in tone-test mode")
logLevel := flag.String("log", "warn", "log level: debug, info, warn, error")
logFile := flag.String("logfile", "", "write logs to this file (in addition to stderr)")
@@ -210,6 +212,8 @@ func main() {
UserConfig: userConfig,
Address: *server,
AutoTransmit: *autoTransmit,
ToneTest: *toneTest,
ToneTestOutput: *toneTestOutput,
MutedChannels: make(map[uint32]bool),
NoiseSuppressor: noise.NewSuppressor(),
}