Zeal voice -- first native audio deliverable, 2026-10-12
======================================================

Voice activation is the default in the NEW prototype, per Bryan's explicit
choice. Push-to-talk is implemented as an alternate local mode. The prototype
is not yet integrated with Ranked's network voice or settings. The installed
v3.5 DLL, menu, installer, public endpoints and normal MS-02 game were not changed.

What was built
--------------
client_native/voice: a native C++20 Opus/miniaudio implementation and harness.
48 kHz mono, 96 kbit/s constrained VBR, 10 ms packets, complexity 10, DTX/FEC off.
An adjustable sensitivity gate, 40 ms preroll, 300 ms release, float mixing and
soft clipping. Muting and PTT cannot release retained pre-mute/pre-press audio.
WASAPI callbacks use fixed-capacity SPSC rings; encoding/mixing/device changes
run outside those callbacks. No physical microphone was used for these tests.

client_native/Voice.cpp, Voice.hpp, LegacyVoiceProtocol.hpp: a candidate native
legacy-wrapper improvement. Whole datagrams are validated before forwarding or
decoding. Loading and active connections use the same byte-sized length format.
Payloads of 256 bytes cannot be represented by that format and are rejected.
Outgoing batches split between complete codec frames within an 1180-byte
serialized budget, leaving room for OOB framing under 1200 bytes. The repeated
128 KiB allocation is removed. Queues expire frames after 200 ms and clear on
disconnect/map initialization; muting removes that speaker's queued frames.
voice_stats reports counts, with no conversation payload logging/recording.
This candidate still uses the existing codec and legacy transport authentication.

Native Windows evidence
-----------------------
Built and executed with MSVC 14.44, Windows SDK 10.0.26100, Release/Win32 on the
Windows 11 VM. Harness selftest confirms 32-bit pointers and libopus 1.6.1.
Both CTest tests pass: capture/codec/mixer/ring behavior and legacy packet parser.
The parser also passed 200,000 random datagrams under AddressSanitizer and
UndefinedBehaviorSanitizer on Linux, plus truncation, length and speaker bounds.

Eight independent encoders plus eight decoders and mixing, 3,000 iterations:
  median processing: 0.3494 ms per 10 ms of audio
  p95 processing:    0.4267 ms
  p99 processing:    0.4770 ms
  largest observed:  0.6980 ms
  mean Opus packet:  121.04 bytes; largest in this tonal test: 195 bytes
This is CPU cost on the VM, not network latency, hardware latency, a VPS capacity
claim, or an eight-person real-microphone listening test.

The VM exposes zero WASAPI devices. Its native tests therefore prove compiler,
codec, gate, parser, mixing and queue behavior, not real Windows audio hardware.

Isolated Windows audio device tests through Wine
-----------------------------------------------
A separate private PipeWire/Pulse server exposed only two generated-audio sinks
and monitor sources. No ALSA/Bluetooth/device discovery module was loaded. It
never connected to the user's microphone or speakers. The Windows executable
used WASAPI; the Linux host supplied only the virtual devices.

Playback of the decoded reference through this route exactly matched its PCM16
input after alignment. Reported device rate 48,000 Hz; period 480 frames (10 ms).
Four empty callback frames included startup/tail silence. This is a virtual
route result, not proof of physical-device transparency.

The 20-second capture -> default voice activation -> Opus -> playback test:
  capture/output rates: 48,000 / 48,000 Hz
  capture/output periods: 480 / 480 frames
  captured frames: 2,001; encoded frames: 1,216; talkspurts: 6
  capture-ring drops: 0; output empty frames: 2
The simple harness counts startup empty frames as underruns. It is not an
adaptive network jitter buffer. Mouth-to-ear latency was not measured.

Quiet speech and codec comparisons
---------------------------------
All material is synthetic espeak-ng speech; no participant recording was made.
The identical source was converted to mono PCM16/48 kHz, then compared at normal
level, at 3% amplitude, and with deterministic background noise. Each file is
633,196 samples long. Source text and generator script are preserved with QA.

At 96 kbit/s, delay-aligned waveform SNR was 25.31 dB normal, 25.08 dB quiet, and
24.18 dB with noise. At 64 kbit/s the corresponding values were 21.42, 21.35 and
20.58 dB. These compare waveform error against these fixtures; they are NOT MOS,
intelligibility, or a claim of a particular perceived gain over the old codec.
The codec's measured lookahead is 312 samples = 6.5 ms, not total call latency.

The initial -52 dBFS activation threshold retained 99.4502% of the quiet clip's
energy. The selected -58 dBFS threshold retained 99.9456%, with the same 40 ms
preroll and 300 ms release. Normal speech retained 100% at the reported precision.
This gate measures level, not speech identity: room/keyboard noise can open it.
Noise rejection and human whisper/word-boundary listening remain to be tuned.

Legacy game findings
--------------------
The supplied Downloads/Voice.cpp matches pinned upstream source after newline
normalization. Runtime sv_voiceQuality accepts 0..9 and defaults to 3. The normal
server configs already request 9; their comments no longer assert an unverified
codec-quality mapping. Existing config values were not raised further.

The actual legacy IW4x capture stream opened as mono PCM16 at 8,192 Hz under
Wine, both when the runtime quality dvar read 3 and 9. This establishes the
observed capture rate in this setup. It does not identify the encoded codec,
prove native Windows device behavior, or prove that every quality change was
applied to an already-initialized codec.

Two real game clients loaded the candidate DLL, connected over local UDP and
relayed the generated fixture in an unrated local Rust session. The sender/
server reported 5,888 received frames and zero malformed batches, queue drops
or stale drops; queue high-water was 10/40. The second client reported 942
received frames and zero malformed batches. Counts include earlier baseline
activity; they are not a controlled per-second throughput measurement.

The received speech envelope correlated with the reference at 0.9523. The file
also includes game audio and variable timing, so it is not a clean level-matched
listening comparison. Earlier microphone-loopback captures did not sufficiently
match the reference and are explicitly excluded from quality conclusions.
No claimed old-versus-new listening win is based on these recordings.

Bandwidth implication for the proposed new voice profile
--------------------------------------------------------
The earlier measured 1.29 Mbps game/service baseline excluded voice. Its 5 Mbps
capacity allowance must not be read as covering a future 96 kbit/s voice system.
Illustration only: 120-byte Opus + 12-byte RTP + 16-byte authentication tag +
28-byte IPv4/UDP + 38 bytes estimated Ethernet overhead, 100 packets/second:
  one sender -> one recipient: 0.1712 Mbps estimated wire rate
  eight simultaneous team-only talkers, each to three teammates:
    ingress 1.3696 Mbps, egress 4.1088 Mbps, combined 5.4784 Mbps for voice
    plus the measured game/services baseline: approximately 6.77 Mbps combined
  optional eight-way all-talk: approximately 12.25 Mbps combined including game
Allow roughly 10 Mbps per full 4v4, or 20 Mbps if budgeting for eight-way chat.
These are conservative planning calculations, not measured v2 network traffic.
Actual transport, authentication overhead, VBR bursts and repair behavior must
be measured when that transport exists. Both remain small fractions of 1 Gbps.

What remains before this replaces in-game voice
----------------------------------------------
Authenticated media/session negotiation and routing, adaptive receive timing,
loss/reorder/clock-drift tests, party/team switching and lifecycle integration,
game settings and mute/volume UI, real Windows microphone/device-change tests,
human listening and hardware latency measurement, and installer/server rollout.
No Opus bytes are sent into the old decoder. No partially authenticated v2
network mode has been enabled. No full Discord-replacement claim is made yet.

Cleanup and delivery
--------------------
QA clients 2/3 stopped; their original DLL symlinks and configs restored.
The private audio daemon/linker stopped. Client 1 was untouched. A read-only
check of the normal MS-02 rating database found all nine existing players still
at 0 games and 1500 Elo. No normal server service was restarted or modified.
The installed DLL remains 8c6fb8a317a80d26ebb4c535c2ae38535afe439b62d9ac46dc7a9abdb70e31da.
The candidate and standalone harness hashes are in binaries.json.

Primary implementation references
---------------------------------
https://opus-codec.org/downloads/
https://github.com/mackron/miniaudio/releases/tag/0.11.25
https://miniaud.io/docs/manual/index.html
https://github.com/iw4x/iw4x-client/tree/d1b175da1a25d31043246de103a702b206269e5a
The downloaded Voice v2 plan's first-deliverable boundary guided this work;
Bryan's voice-activation preference overrides its proposed PTT default.
