Complete-turn rendering contract

Manifest

See examples/complete_turns.json. Required top-level fields:

Field Meaning
schema_version Exactly aegisvox.complete_turns.v1.
converted_audio PCM WAV path, relative to the manifest or absolute. Identity conversion is already complete.
turns Ordered, non-overlapping turns with unique turn_id, speaker_id, start_sec, and end_sec.

For an affected turn, add both source_transcript and target_transcript. They must contain the entire turn's words. Omit target_transcript for turns that do not need lexical rendering. Times are in the converted audio. Provide correctly assigned exclusive turns; this interface does not separate concurrent speakers or infer turns.

Names in the example are fictional schema fixtures, not patient records. Raw manifests, transcripts, and reference clips can contain sensitive data. Store them privately.

Renderer interface

from pathlib import Path
from aegisvox.complete_turns import render_conversation

# renderer.name: str
# renderer.render(request: dict, reference: Path, output: Path) -> dict
report = render_conversation(Path('turns.json'), Path('runs/run-001'), renderer)

reference contains all samples of that converted turn. request includes its full source/target transcripts, speaker/turn IDs, and PCM format. The renderer must write output with matching rate, channels, and sample width. Its return value is non-secret metadata such as model revision, settings, and seed. It must not contain credentials.

A CommandTurnRenderer accepts an argv list with {request} and {output} placeholders. The request JSON file is the text boundary. The command is not passed through a shell; transcript words are never interpolated into command arguments. Commands and model artifacts still need to be trusted. External network access is not sandboxed by this library.

Reconstruction guarantees and boundaries

The implementation holds the conversation in memory. Use a worker with sufficient RAM; this release is not a streaming audio engine. Boundary smoothing is available in the lower-level stitching research components, but would break exact PCM insertion if applied inside the edited region. Record that operation as a different experiment.

Output

final.wav, reconstruction.json, and one directory per edited turn containing reference.wav and edited.wav. Command adapters also store request.json locally. status: assembled certifies assembly only. Run lexical, ASV, and clinical evaluation on the final waveform before making any scientific claim about it.