Skip to content

API Reference parrot_formdesigner.audio.segments

github-actions[bot] edited this page Dec 2, 2026 · 4 revisions

parrot_formdesigner.audio.segments

View source

Pre-synthesised narration segments (FEAT-649, Module 6).

Class AudioSegmentCache

Synthesise and cache narration segments with one shared synthesiser per process.

Parameter Type Default Description
synthesizer 'VoiceSynthesizer | None'
lock asyncio.Lock
max_entries int 512

Method AudioSegmentCache.cache_key

(form_uid, version, locale, voice, template_rev, sha1(text), synthesis variant) — S7.

variant is the effective synthesis config (output mime + backend/model): the same text rendered by a different backend or container format must never share bytes.

cache_key(*, form_uid: str, version: str, locale: str, voice: str | None, text: str, variant: str = '') -> tuple[str, ...]

Parameter Type Default Description
form_uid str
version str
locale str
voice str | None
text str
variant str ''

Returns: tuple[str, ...]

Method AudioSegmentCache.variant

Identity of the effective synthesis config: mime|backend|model.

variant() -> str

Returns: str

Method AudioSegmentCache.mime

MIME of produced audio (synthesiser config), audio/wav when unknown.

mime() -> str

Returns: str

Method AudioSegmentCache.ensure

Synthesise missing keys sequentially under the shared lock; return key → bytes.

ensure(items: dict[str, str], *, locale: str, voice: str | None, form_uid: str, version: str) -> dict[str, bytes]

Parameter Type Default Description
items dict[str, str]
locale str
voice str | None
form_uid str
version str

Returns: dict[str, bytes]

Attribute NARRATION_TEMPLATE_REV

Attribute logger

Architecture

Clients

Bots & Agents

Memory

Knowledge

Tools & Toolkits

Flows

Experts

Skills

Stores & Loaders

MCP & A2A

Server & APIs

Integrations

Outputs & A2UI

Prompts

Security

Operations

Migration

SDD Tooling

LLM Wiki

Deployment

Decisions

API Reference

Clone this wiki locally