Repository navigation
feat(stv): support Human Presence audio batching and send timing - #29
Merged
Merged
Conversation
Clients can opt into small audio packets without losing PCM samples or short tails, while retaining the existing batching defaults. Traces now distinguish queued audio from completed writes, and cancellation retires old in-flight audio without discarding the next reply.
mr-wanderer-x
marked this pull request as ready for review
September 28, 2026 11:34
Avatar clients can use the server's recommended startup audio threshold without overriding explicit application settings or losing pending audio. Combine that negotiation with exact sample-aligned batching, accurate send timing, and the cancellation fix while retaining the 1000 ms fallback for servers without a valid hint.
mr-wanderer-x
marked this pull request as draft
September 28, 2026 12:52
Separate the Presence batching, send timing, and cancellation work from Portrait server hints. Verify the 320 ms profile sends larger TTS bursts intact and rearms for each turn.
mr-wanderer-x
marked this pull request as ready for review
September 28, 2026 12:55
mr-wanderer-x
added a commit
that referenced
this pull request
Sep 29, 2026
Avatar replies should not wait for a fixed 1,000 ms of audio when the server can start sooner. Both WebSocket and direct-WebRTC clients now apply the server's startup audio recommendation before replaying buffered TTS. - `server_feed_initial_chunk_ms=None` selects automatic tuning. Valid integer hints from 1–8,000 ms are accepted; missing or invalid hints retain the 1,000 ms fallback. Explicit application settings always win. - The documented Portrait profile uses 200 ms initial/subsequent thresholds and a 100 ms send gap. These are explicit settings, not global defaults. Larger TTS bursts remain whole unless fixed-size batching is explicitly enabled. - Startup hints and explicit settings use the same PCM16 sample rounding in fixed-size mode, including 44.1 kHz. Queued audio survives configuration and short tails flush without padding. Merged current main (`aa01226`, Presence PR #29) into this branch. Presence's explicit profile, optional exact-size batching, socket-send timing, and cancellation-race fix are preserved. The cancellation implementation is already on main and is not a new change in this PR. Version: `0.12.0` (main: `0.11.1`). Validation: all 286 hermetic unit tests pass, including Portrait and Presence profiles, invalid hints, pre-session audio replay, whole-burst preservation, fixed-size sample alignment, and cancellation during pacing/socket writes. Locked dependency installation, Ruff format/lint, example checks, comment policy, and wheel/sdist builds pass. Pyright reports two existing errors in `interaction_messages.py`, which is unchanged from main; the repository's type check is advisory. No live bot/model session or deployment was performed. GitHub verify, examples, and build checks passed on `cd8fc3d`. Their only annotations are notices about the upcoming Ubuntu runner-image migration; no product-code finding was reported.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Human Presence clients can use smaller audio batches while retaining complete TTS bursts, and traces distinguish queued audio from completed socket writes. This PR contains the Presence SDK work for the small-chunk deployment; the Portrait server-hint work is maintained separately in #30 on
fix/cancel-inflight-audio.server_feed_fixed_chunk_size=False. A 1-second TTS burst is sent whole once the threshold is met, subject to the existing transport cap.audio_queuedand completedaudio_sent, including duration, queue/pacing wait, and write time. A completed write is not a server acknowledgement.Both WebSocket playback and direct WebRTC use the shared feed. Global defaults remain 1,000 ms initial, 400 ms subsequent, and 200 ms gap; applications opt into the Presence profile. This branch does not consume server startup hints. Version:
0.11.1.Validation: 255 hermetic tests passed, including both transports at 320 ms, whole-burst preservation, turn rearming, packet/sample boundaries, short tails, and cancellation races. Ruff format/lint, example checks, comment policy, locked dependency install, and wheel/sdist build passed. Pyright reports the same two pre-existing
interaction_messages.pyerrors asmain; CI type checking remains advisory. Live model sessions were not run.The Ojin checkout was left unchanged during this split. Local verification and commits were performed directly because the helper-agent limit was reached; each commit's parent and tree were verified.
GitHub verify, examples, and build checks passed on the current head. The only check annotations are GitHub's upcoming Ubuntu runner-image migration notices; these are unrelated to the SDK changes.