Skip to content

drama voices: admin keys add and delete catalog voices under --manage-voices; inline voices under --request-voices - #3140

Merged
ashhart merged 4 commits into
mainfrom
lead/tts-voices
Nov 19, 2026
Merged

ashhart merged 4 commits into
mainfrom
lead/tts-voices

Conversation

@ashhart

@ashhart ashhart commented Nov 13, 2026

Copy link
Copy Markdown
Owner

Drama voices could only come from --voices DIR at startup. Two opt-in flags, both off by default:

  • --manage-voices: admin keys add voices with POST /v1/voices (an attested voice file, or a WAV with its transcript, encoded by the loaded codec) and delete them with DELETE /v1/voices/NAME, written to --voices DIR. Without an API key every client counts as admin and these routes write and delete files, so the docs say to set a key.
  • --request-voices: voice may be an attested inline object.

A request copies its voice from the catalog when it arrives (at most about 100 KB, under one lock), so deleting a voice never frees one a running request uses. A WAV upload checks attestation and transcript before any encoding; the encode runs on an idle lane while busy lanes wait, and a device error closes the speech engine, as it already does mid-generation. With both flags off, replies equal main's; those replies were recorded on main and are pinned in a test.

Tests: test-server-cpu 1344 pass; drama host 41; Metal native host 11 (+2 skip); prefill 2; a fake-host test for the upload hand-off (idle lane encodes, busy lanes wait, a bad file keeps the engine open, closing answers a waiting upload). engine_api.zig and server.zig stay at 600 lines.

Device check pending (an M5 Mac and a GB10, fixed seed): a WAV uploaded with POST /v1/voices gives codes equal to drama3-generate --codec … --ref-audio X.wav --encode; the same voice loaded at startup, added at runtime and sent inline gives the same WAV sha256, and the default voice matches main; a request running while its voice is deleted finishes equal to its solo reply; 2-4 concurrent streams plus an upload each equal their solo replies. Conflicts with the speed and formats PRs (unions); server.zig's line count is re-checked when the second lands.

…-voices; inline voices under --request-voices

The served catalog moves into a store (drama_voice_store.zig): a request copies its voice's
references when it arrives, so a change frees the old catalog at once and never reaches a request
already running. With --manage-voices, POST /v1/voices adds or replaces a voice from an attested
voice file's fields or from a base64 WAV with its transcript, and DELETE /v1/voices/NAME deletes one
(never the configured default voice); both need the admin scope and write or remove DIR/NAME.json
under --voices DIR through a temporary renamed into place. A WAV is checked for attestation and
transcript first, then encoded on the speech host's thread by an idle lane's codec (the engine's new
optional encode_voice hook; a file the codec refuses keeps the engine open, a device error closes it
as advance does). With --request-voices, a speech request's voice may be an attested inline voice
object, checked as a catalog file is. Both flags are off by default: every reply, refusal and the
default voice are as before. Raw ref_audio, ref_text and references stay refused.
speech_voice_http_test.zig drives the server through speech_stream_test.zig's
socket-pair harness, which root.zig already leaves out on Windows; importing it
unguarded failed zig-windows (std.c.socketpair is void there).
@ashhart
ashhart merged commit 5e17be3 into main Nov 19, 2026
2 of 11 checks passed
@ashhart
ashhart deleted the lead/tts-voices branch November 19, 2026 05:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant