Commit Graph
114 Commits
Author SHA1 Message Date
Tyler SpiveyandClaude Opus 5 4393739ffa Add F12 hotkey to toggle microphone AGC
Automatic gain control was always on with no way to turn it off. Toggle
it with F12, the /agc command, or the agc FIFO command, and persist the
choice in the configuration file the same way noise suppression does.

AgcEnabled defaults to true so existing setups keep their current
behavior, and the saved value is applied to the stream on connect. The
enabled flag becomes an atomic.Bool because the capture goroutine reads
it while the UI goroutine writes it, and the lazily created right
channel AGC now inherits the left channel's state.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-08-14 13:16:44 -07:00
Tyler SpiveyandClaude Opus 5 132df6863a Resync jitter buffer when a sender restarts frame numbering
Mumble destroys and recreates AudioInput when the sender switches audio
devices. The destructor sends no terminator, and the replacement resets
iFrameCounter to zero, so a sender who never unkeys silently restarts its
frame numbering mid-burst. The jitter buffer kept expecting the old
sequence and discarded every packet as late until the next unkey.

Resync on a sustained run of late packets combined with a backwards jump
too large to be network reordering. Both conditions are needed: the run
length alone would let a clump of reordered packets drag the expected
sequence backwards, and small jumps need no intervention because the
restarted stream climbs past the stale expectation on its own.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-08-14 13:00:06 -07:00
Brandon McGinty (chatgpt) c0ef036934 Add configurable incoming audio jitter buffer 2026-08-13 17:54:30 -04:00
Brandon McGinty (chatgpt) 893908f9a1 Reset audio jitter state at talk burst end 2026-08-13 13:37:47 -04:00
Brandon McGinty (chatgpt) 05dc6e4e0e Set TLS server name from Mumble address 2026-08-13 12:53:35 -04:00
Brandon McGinty (chatgpt) 883f7250f5 Avoid debug logging induced UDP loss 2026-08-12 17:38:04 -04:00
Brandon McGinty (chatgpt) 4510c25350 Recover UDP crypto after packet loss 2026-08-12 16:30:38 -04:00
Brandon McGinty (deepseek) 90f8a1ca5f Fix recording truncation and rate mismatch causing static
The recording pipeline had two bugs that combined to produce
buzzing/static in recorded audio:

1. NormalizeStereoFrame truncated incoming audio frames to
   frameSize*AudioChannels samples. When the Opus decoder produced
   20ms frames (1920 stereo samples) but the recorder used a 10ms
   frameSize (960 samples), half the audio from every packet was
   silently dropped.

2. The recorder's run() loop dequeued one fixed-length frame per
   source per tick. After truncation, the remaining 10ms of each
   20ms packet was gone, so every other tick produced silence.
   This 50 Hz on/off pattern sounded like static.

Fixes:
- NormalizeStereoFrame no longer truncates; it only converts mono
  to stereo and preserves all audio data
- RecordAudioFrame now accepts an explicit stereo flag from callers
  instead of guessing from sample count (which failed for even-length
  mono data like 480-sample mic frames)
- run() accumulates variable-length frames per source and consumes
  them in fixed-size chunks, preserving any leftover for the next tick
2026-08-10 18:34:52 -04:00
Brandon McGinty (deepseek) cd003d7ac4 Fix jitter buffer: late-packet blockage and frame-step tracking
- popNext() now computes the actual frame step from PCM sample count
  instead of always advancing by 1. Mumble 1.5 frame numbers are 10ms
  timestamps, so 20ms stereo frames advance by 2, eliminating the
  'seq gap' skip that fired on every single packet.

- Drain loop now discards late/duplicate packets (sequence < expected)
  instead of letting them permanently block the buffer. Previously a
  single late packet at jitterBuf[0] would cause popNext to always
  return nil without the gap check catching it (only handled >), so
  all subsequent drains would break immediately.

- Reduced reclaim log verbosity: log every 50th or on state change,
  not every call with processed==0.
2026-08-10 18:11:26 -04:00
Brandon McGinty (deepseek) 3613a42fce Add debug logging for OpenAL playback and jitter buffer pipeline
- Log OpenAL vendor/version/renderer at startup
- Log buffer creation count and user volume on new audio stream
- Enhanced reclaim(): log source state, processed/queued/empty counts,
  and check for OpenAL errors; log every 50th cycle or on unusual state
- Log jitter buffer drain events (first 3 + periodic) with buffer counts
- Log sequence gap skips in jitter buffer
- WARN when processAudioPacket has no empty buffers (audio dropped)
- Check OpenAL errors after Buffer.SetData, QueueBuffer, and Play()
- Log source state transitions when calling Play() on non-playing source
2026-08-10 18:03:43 -04:00
Brandon McGinty (chatgpt) 99f1f4b9ab Keep OpenAL jitter playback continuous 2026-08-10 16:07:47 -04:00
Brandon McGinty (chatgpt) 5b0879ddaa Fix UDP audio frame timestamp handling 2026-08-10 15:18:04 -04:00
Brandon McGinty (chatgpt) e9ba7f580a Synchronize connection-owned stream access 2026-08-10 11:25:08 -04:00
Brandon McGinty (chatgpt) e68546eec5 Compare UDP authentication tags in constant time 2026-08-10 09:42:49 -04:00
Brandon McGinty (chatgpt) 7785f0a5b5 Synchronize audio encoder selection 2026-08-10 05:03:45 -04:00
Brandon McGinty (chatgpt) d399650198 Protect crypto initialization checks 2026-08-10 04:28:38 -04:00
Brandon McGinty (chatgpt) fa84373a81 Synchronize legacy UDP crypto setup 2026-08-10 04:06:12 -04:00
Brandon McGinty (chatgpt) 42861dfcd5 Close audio streams when listeners detach 2026-08-10 04:01:42 -04:00
Brandon McGinty (chatgpt) 2eed3c809f Synchronize audio stream teardown 2026-08-10 03:35:35 -04:00
Brandon McGinty (chatgpt) 21e0627509 Add context to remaining OpenAL device errors 2026-08-09 22:09:02 -04:00
Brandon McGinty (chatgpt) 0712e3150c Report OpenAL device names in startup errors 2026-08-09 21:59:32 -04:00
Brandon McGinty (chatgpt) 29dde07337 Test long local Mumble audio intervals 2026-08-09 20:54:38 -04:00
Brandon McGinty (chatgpt) ee8a3a6d63 Test 20ms local Mumble audio interval 2026-08-09 20:53:04 -04:00
Brandon McGinty (chatgpt) 5cd23f5df8 Test local Mumble TCP audio fallback 2026-08-09 20:51:44 -04:00
Brandon McGinty (chatgpt) c9c6d6bab1 Verify native UDP audio against local Mumble 2026-08-09 20:35:18 -04:00
Brandon McGinty (chatgpt) b324106d3a Detect sequence gaps in local audio integration 2026-08-09 20:31:29 -04:00
Brandon McGinty (chatgpt) 0dbe178e7f Check local Mumble audio fidelity 2026-08-09 20:29:02 -04:00
Brandon McGinty (chatgpt) 074bd67ad3 Verify local Mumble audio frequency round trip 2026-08-09 20:24:55 -04:00
Brandon McGinty (chatgpt) 794610929b Use protobuf envelopes for Mumble 1.5 TCP audio 2026-08-09 20:16:47 -04:00
Brandon McGinty (chatgpt) 9678816a4c Add native UDP protobuf reference vectors 2026-08-09 19:58:39 -04:00
Brandon McGinty (chatgpt) 2c636016b0 Report OpenAL lifecycle errors 2026-08-09 19:24:48 -04:00
Brandon McGinty (chatgpt) c8ddb7a567 Test native UDP IV wrap handling 2026-08-09 19:15:48 -04:00
Brandon McGinty (chatgpt) d4e136aa8f Test native UDP replay rejection 2026-08-09 18:46:40 -04:00
Brandon McGinty (chatgpt) 7180b7604d Synchronize UDP decoding with client state 2026-08-09 18:45:57 -04:00
Brandon McGinty (chatgpt) 4fe32ede70 Use typed OpenAL device and context handles 2026-08-09 18:11:03 -04:00
Brandon McGinty (chatgpt) 6b7e3cdc20 Guard empty OpenAL capture buffers 2026-08-09 18:10:25 -04:00
Brandon McGinty (chatgpt) 208c986d56 Guard empty OpenAL listener slices 2026-08-09 18:09:56 -04:00
Brandon McGinty (chatgpt) c96617c71d Guard empty OpenAL buffer data slices 2026-08-09 18:01:41 -04:00
Brandon McGinty (chatgpt) 0e537a144d Guard empty OpenAL source slices 2026-08-09 18:00:58 -04:00
Brandon McGinty (chatgpt) a03800fbbc Use local listener orientation buffers 2026-08-09 15:13:29 -04:00
Brandon McGinty (chatgpt) cc62f8e4a7 Join capture worker before stopping OpenAL 2026-08-09 15:09:39 -04:00
Brandon McGinty (chatgpt) 28a59832c4 Reject renderer work after audio shutdown 2026-08-09 15:08:36 -04:00
Brandon McGinty (chatgpt) 1679a37783 Clamp negative protocol ban durations 2026-08-09 14:55:39 -04:00
Brandon McGinty (chatgpt) 9f90bd5c66 Synchronize listener detach and delivery 2026-08-09 14:55:03 -04:00
Brandon McGinty (chatgpt) 25467405b8 Retain TCP audio until UDP is authenticated 2026-08-09 14:45:41 -04:00
Brandon McGinty (chatgpt) 1fa96d4f15 Reject malformed ACL and user-list records 2026-08-09 14:44:42 -04:00
Brandon McGinty (chatgpt) 3e9c9e7a81 Test OpenAL buffer deletion 2026-08-09 14:41:52 -04:00
Brandon McGinty (chatgpt) 977b690eed Make ffmpeg pause nonblocking 2026-08-09 14:41:35 -04:00
Brandon McGinty (chatgpt) 4497d41077 Persist microphone mute and volume settings 2026-08-09 14:37:06 -04:00
Brandon McGinty (chatgpt) aa38c99aab Scale Opus bitrate to audio frame duration 2026-08-09 14:36:00 -04:00