Repository navigation
API Reference parrot.voice.tts.supertonic_inference
Supertonic ONNX inference wiring (4-graph flow-matching TTS).
The :class:SupertonicTTSBackend in supertonic_backend.py is intentionally
agnostic about the concrete Supertonic ONNX graph I/O — it exposes an
inference_fn seam (FEAT-231 §8 R-deps). This module fills that seam for the
public Supertonic-3 weights (Supertone/supertonic-3 on Hugging Face),
which ship the model split across four ONNX graphs run in sequence:
text --tokenise--> text_ids ----------------------------------+
|
duration_predictor(text_ids, style_dp, text_mask) --> duration |
text_encoder(text_ids, style_ttl, text_mask) --> text_emb |
vector_estimator(noisy_latent, text_emb, ..., step) --> latent | x total_step
vocoder(latent) --> waveform <+
The math mirrors the upstream reference (py/helper.py in
supertone-inc/supertonic); it is reimplemented here against
numpy/onnxruntime only — no upstream package dependency.
Expected on-disk layout (as produced by make install-supertonic)::
<model_dir>/
├── onnx/
│ ├── duration_predictor.onnx
│ ├── text_encoder.onnx
│ ├── vector_estimator.onnx
│ ├── vocoder.onnx
│ ├── tts.json # config (sample_rate, chunk sizes, latent_dim)
│ └── unicode_indexer.json # codepoint -> token id table
└── voice_styles/
├── M1.json … M5.json # speaker style vectors (style_ttl + style_dp)
└── F1.json … F5.json
SUPERTONIC_MODEL_PATH (or model_dir=) should point at <model_dir>
(the directory that contains onnx/ and voice_styles/). Pointing it
directly at the onnx/ directory is also tolerated. When neither is given,
the backend falls back to <BASE_DIR>/models/supertonic-3 — exactly where
make install-supertonic puts the weights — so a standard checkout works
with no configuration at all.
Added by FEAT-231 follow-up (Supertonic 4-graph inference wiring).
A speaker style: the two conditioning tensors Supertonic consumes.
| Parameter | Type | Default | Description |
|---|---|---|---|
ttl |
np.ndarray |
||
dp |
np.ndarray |
Attributes:
| Attribute | Type | Description |
|---|---|---|
ttl |
style_ttl tensor (text-encoder / vector-estimator conditioning). |
|
dp |
style_dp tensor (duration-predictor conditioning). |
:class:SupertonicTTSBackend wired for the real Supertonic-3 weights.
Overrides session creation to load the four-graph
:class:SupertonicPipeline and bind it as the backend's inference_fn.
Everything else (async offload, WAV wrapping, empty-text guard, truthful
mime_format) is inherited unchanged.
Construction stays cheap — the heavy ONNX load happens lazily on the first
synthesize call, via :meth:_ensure_session.
| Parameter | Type | Default | Description |
|---|---|---|---|
model_dir |
Optional[str] |
None |
Directory with onnx/ and voice_styles/. Defaults to SUPERTONIC_MODEL_PATH. |
voice |
Optional[str] |
None |
Default voice id (M1..F5). None → default_voice. |
onnx_subdir |
str |
'onnx' |
ONNX subdirectory name. |
voice_styles_subdir |
str |
'voice_styles' |
Voice-styles subdirectory name. |
default_voice |
str |
'M1' |
Voice used when neither voice nor the call supplies one. |
total_step |
int |
8 |
Flow-matching denoising steps. |
speed |
float |
1.05 |
Speech-rate multiplier. |
use_gpu |
bool |
False |
Reserved (CPU only). |
**kwargs |
{} |
Forwarded to :class:SupertonicTTSBackend. |
Runs the Supertonic-3 four-graph pipeline and returns raw PCM.
The instance is callable with the signature
SupertonicTTSBackend expects for inference_fn::
pipeline(session, text, *, voice, language, sample_rate) -> bytes
The session and sample_rate arguments are ignored (the pipeline
owns its own four ONNX sessions and reports its native sample rate via
:attr:sample_rate); they exist only to satisfy the seam contract.
Loading is eager — the constructor opens all four ONNX sessions, the
config and the tokeniser table — so build it lazily (e.g. from the
backend's _ensure_session) to keep object construction cheap.
| Parameter | Type | Default | Description |
|---|---|---|---|
model_dir |
str |
Directory containing onnx/ and voice_styles/ (or the onnx directory itself). |
|
onnx_subdir |
str |
'onnx' |
Name of the ONNX subdirectory under model_dir. |
voice_styles_subdir |
str |
'voice_styles' |
Name of the voice-styles subdirectory. |
default_voice |
str |
'M1' |
Voice id used when the caller passes None. |
total_step |
int |
8 |
Number of flow-matching denoising steps (higher = smoother, slower). Upstream default is 8. |
speed |
float |
1.05 |
Speech-rate multiplier (>1 = faster). Upstream default is 1.05. |
use_gpu |
bool |
False |
Reserved; CPU execution only for now. |
Synthesize text to raw PCM (16-bit LE mono at :attr:sample_rate).
Long text is chunked, synthesized chunk-by-chunk, and concatenated with short silences. The final waveform is trimmed to the predicted total duration and quantised to int16.
synthesize_pcm(text: str, *, voice: Optional[str] = None, language: Optional[str] = None, silence_duration: float = 0.3) -> bytes
| Parameter | Type | Default | Description |
|---|---|---|---|
text |
str |
Text to speak (non-empty). | |
voice |
Optional[str] |
None |
Voice id (M1..M5 / F1..F5), a filename, or a path. None uses :attr:default_voice. |
language |
Optional[str] |
None |
BCP-47 tag; only the primary subtag is used and unknown languages fall back to English. |
silence_duration |
float |
0.3 |
Gap inserted between chunks, in seconds. |
Returns: bytes — Raw PCM bytes (16-bit little-endian, mono).
Re-exported from parrot.voice.tts.supertonic_backend.SupertonicTTSBackend.
Codepoint-based text tokeniser for Supertonic.
Normalises text, strips emojis, applies a small punctuation rewrite, wraps
it in <lang>…</lang> markers, then maps each character's Unicode
codepoint to a token id via unicode_indexer.json (a list indexed by
codepoint, or a {codepoint: id} dict).
| Parameter | Type | Default | Description |
|---|---|---|---|
unicode_indexer_path |
str |
Path to unicode_indexer.json. |
Split text into synthesis-sized chunks by paragraph then sentence.
Long agent answers are split so each chunk stays within the model's comfortable context; chunks are re-joined (with short silences) by the caller.
chunk_text(text: str, max_len: int = 300) -> list[str]
| Parameter | Type | Default | Description |
|---|---|---|---|
text |
str |
Input text. | |
max_len |
int |
300 |
Maximum characters per chunk. |
Returns: list[str] — Ordered list of non-empty chunk strings (at least one).
Mask the latent sequence to the per-item audio length.
get_latent_mask(wav_lengths: np.ndarray, base_chunk_size: int, chunk_compress_factor: int) -> np.ndarray
| Parameter | Type | Default | Description |
|---|---|---|---|
wav_lengths |
np.ndarray |
Per-item waveform sample counts, shape (B,). |
|
base_chunk_size |
int |
Vocoder base chunk size (samples per latent frame). | |
chunk_compress_factor |
int |
Latent compression factor from the config. |
Returns: np.ndarray — Latent mask of shape (B, 1, latent_len).
Build a binary length mask of shape (B, 1, max_len).
length_to_mask(lengths: np.ndarray, max_len: Optional[int] = None) -> np.ndarray
| Parameter | Type | Default | Description |
|---|---|---|---|
lengths |
np.ndarray |
Per-item valid lengths, shape (B,). |
|
max_len |
Optional[int] |
None |
Mask width; defaults to lengths.max(). |
Returns: np.ndarray — Float32 mask, 1.0 for valid positions and 0.0 for padding.
Load a single voice-style JSON into a batch-of-one :class:Style.
The JSON carries style_ttl/style_dp as {"dims": [...], "data": [...]} blocks; data is reshaped to dims[1:] and given a
leading batch axis.
load_voice_style(path: str) -> Style
| Parameter | Type | Default | Description |
|---|---|---|---|
path |
str |
Path to a voice_styles/<name>.json file. |
Returns: Style — class:Style with batch size 1.
- 1. MCP Server — exposing tools as a service
- 2. A2A — exposing agents and orchestrators as services
- 3. Toolkits for third party services and Cloud Security composition
- 4. Interaction surface — WebSockets, audio, integrations
- 5. Hardening — anti prompt injection, PBAC and tool gating
- 6. Cross cutting concerns and reference deployment
- 7. AgentCrew — Sequential, Parallel, Flow and Loop execution
- 8. AgentsFlow — DAG first orchestration with per node FSM
- 9. Ontologic RAG — graph first retrieval, intent routing & multi tenant knowledge
- 10. Observability — OpenLIT + OpenTelemetry
- Class Catalog by Module
- Module level Functions Catalog
- AI Parrot — Exposure, Interoperability & Hardening Architecture
- Agent Mesh
- AgentService — Standalone Runtime for Autonomous Agents
- AbstractClient: The Provider Client Family
- Anthropic client
- Bedrock Mantle Client
- TypeSafe System One Client (
JevClient) - Meta Model API Client (Muse Spark)
- OpenAI Compatible Client Base (
OpenAIBaseClient) - Per Loop LLM Client Cache
- Question Token Budgets (Bedrock Converse, Nova text, Bedrock Mantle)
- Agent Configure Lifecycle
- AgentTalk Integration Guide
- Agent Configuration via
agents.yaml - AgentFactory HTTP API
- Agent Studio — API Reference
- Agent CLI Daemon (agentd)
- FirefliesInsightsAgent
- Follow up Suggestion Chips (FEAT 752)
- Agents and Chatbots: The Bot Class Hierarchy
- Agent Studio — database storage (host guide)
- Ephemeral User Agents — Frontend Integration Handoff
parrot agent— Agent Terminal Workspace- Crew Handler
- Database Agent
- Running the CVE Experts
- Domain Experts (FEAT 778)
- FEAT 437
- Technical Voice Guide (AgentTalk Voice) for Frontend
- AgentDashboard — A2UI v1.0 Technical Reference for
navigator frontend next - Semantic UI Model → Adaptive Cards (FEAT 303)
- Exposing an AI Parrot Agent as an MCP Server
- AgentCrew User Guide
- AgentsFlow User Guide
- Crew Definition Storage
- A2UI Agent Functions Runtime — the v1.0 RPC leg (FEAT 469)
- Capabilities of an AI Parrot Analytical Agent (PandasAgent)
- Agent Security Guardrails (FEAT 761)
- SpawnSubAgentTool
- Testagent
- Agentic End to End Testing (FEAT 581)
- Uiagent
- WebAgent — Browser Interaction via Chrome DevTools
- WebNavigatorAgent — Catalogued Web Navigation on Your Chrome Profile
- ExecutionMemory Integration Guide
- Agent Brain
- Agent Memory
- Conversation History Ownership
- Conversation Memory Subsystem Overview
- Dream Cycle — episodic → wiki brain consolidation
- Durable Conversation Memory
- Memory Dynamics
- Per Turn Conversation Compaction
- Recoverable Task Memory (FEAT 538)
- Task Memory — Phase 0 Integration Map (FEAT 538 / TASK 2970)
- User Memory
- Bookstore Agentic Retrieval
- Bookstore in Codex
- Bookstore Conceptual Relations — the book graph (FEAT 533)
- Bookstore notebooks
- Contracts catalog performance (FEAT 539, AC14)
- Contracts pilot acceptance — Bob's twelve cases (FEAT 539, AC15)
- Contracts Card & Ontology (FEAT 539)
- Luau parser resource policy (FEAT 532 TASK 2896)
- Glossary of Terms (FEAT 917)
- GraphIndex core seams (FEAT 540)
- GraphIndex — Structured Knowledge Graph Indexing
- Local Knowledge Base
- Procedure Graph — Assembly Manuals (FEAT 601)
- Ontology backend programme
- Ontology vocabulary store
- PageIndex Agentic Retrieval and Citations
- PageIndex Generation Publication
- PageIndex Layout Structure Builder
- PageIndex Local MCP Toolkit
- PageIndex Segment Store
- PageIndex Tree Optimizer
- PageIndex — Tree Based RAG for Document Retrieval
- ArxivTool for AI Parrot
- Accounting metrics layer
- Tool Result Compression Pipeline (FEAT 380)
- DatasetManager Implementation Walkthrough
- FredAPITool Documentation
- EmployeesTool Employee Hierarchy Tool for AI Parrot
- HoobaToolkit
- Jira text templates (JiraToolkit)
- Expose Toolkits as Local MCP (
parrot mcp local) - MultiStoreSearch Toolkit — Multi Origin Retrieval for Agents
- Supervised Obscura Browser Integration
- OdooHelpdeskToolkit — Softhealer helpdesk on Odoo 19
- OdooToolkit Capabilities
- QuerysourceToolkit
- ReadOnlyRepoToolkit (FEAT 484)
- PythonREPLTool Sandbox: Worker Process Execution Model
- Research Tools for Agents
- gVisor Installation Guide for AI Parrot Secure Sandbox
- SDD Sandbox — OS Setup
- Governed semantic layer
- Tool optimizations for Claude Code and Codex (FEAT 543)
- AbstractTool Clone Method
- Toolbar API Documentation
- AudioNoteCaptureToolkit
- ExecutionPlanToolkit — Reference
- Host toolkits for Agent Studio
- Infographic Authoring for Data Agents (FEAT 326)
- InfographicToolkit — Reference
- Tool System Internals: Tools, Toolkits and ToolManager
- AI Parrot Tools Documentation
- What If Scenario Analysis
- Workday worker history
- DecisionFlowNode Usage Guide
- Multi Agent Orchestration: AgentCrew and AgentsFlow
- Docker Tool Executor & Execution Policy
- Generic Gate Host
- HeartbeatManager — Per Agent Autonomous Heartbeat Loop
- JobManager
- Node Types Reference
- OrchestratorAgent — Multi Party Conferencing (
confer) - Planogram compliance cycle (perceive → identify → compare)
- Planogram compliance — migrating configurations to the new cycle (FEAT 574, FEAT 612)
- Planogram perception spike — FEAT 574
- Scheduler backends in multi worker deployments
- Thales User Guide
- Per tenant skills (FEAT 707)
- Skill routing and trigger caching
- Skills system: discovery, toolkits and mixin
- Contextual Embedding Headers
- DocumentDB Usage Patterns
- DocumentDB Interface Guide
- DynamoDB Local (docker compose)
- Fully offline local agent with LanceDB (FEAT 542)
- LanceDB vector, full text and hybrid store (FEAT 542)
- Loader Metadata Standard
- Document Loaders for RAG
- Matryoshka Embedding Truncation
- Parent Child Retrieval (Small to Big)
- Storage Backends Guide
- User stores (Redis by default)
- Vector Stores and Embeddings Reference
- Vector Store Handler — API Reference
- A2A Secure Communication Demo
- Agent as a Local MCP Server (parrot toolkits install agent)
- add repository:
- GitHub MCP Installation and Usage
- MCP integration: client, server and agent tools
- Create and configure agent
- Roost — local inter agent sub protocol
- Roost carriers
- Roost performatives, protocols and obligations
- Simple Mcp Server
- SimpleMCPServer Configuration
- API Endpoints Reference
- Admin UI (FEAT 468)
- Infographic Render Endpoint — Reference
- EventBus v2 Configuration Reference (
[bus]/[bus.alerts]) - EventBus v2 Migration Notes (FEAT 310)
- EventBus v2 — Unified Event Fabric (FEAT 310)
- Session file store
- A2UI Dashboard + Widget Renderer — Frontend Build Guide
- Avatar Technical Guide (LiveAvatar Phase A) for Frontend
- Frontend Guide for SvelteKit: LiveAvatar FULL Mode and VoiceBot (FEAT 248)
- DEPRECATED: Native Voice Avatar (LiveAvatar Phase C) Technical Guide for Frontend
- Technical Guide to Structured Artifacts for Frontend
- VoiceBot · VoiceChatHandler · FEAT 245 — Frontend Guide for Realtime Conversation with Agents
- Server Layer: BotManager and HTTP Handlers
- Infographic Handler — Frontend API Contract
- Interactive Artifacts — Frontend API Contract
- Google Drive file manager
- SharePoint & OneDrive file managers
- WhatsApp Integration Implementation Summary
- WhatsApp Integration for AI Parrot
- P3 — parrot admin ui inventory (canvases / A2UI / infographic / builders)
- WhatsApp + AutonomousOrchestrator Integration
- Audio Form Voice Modes — Developer Guide
- Who owns an OAuth2 (3LO) credential
- CommCenter — Bulk Notification Sender (FEAT 417)
- FormDesigner → MS Teams: Adaptive Card renderer and bot submit path (FEAT 551)
- GitHub reviewer
- Google OAuth 2.0 — AI Parrot Integration
- Fireflies Agent Examples
- HITL Tool Call Confirmation (FEAT 235)
- Teams HITL Channel Setup Guide (FEAT 205)
- JiraSpecialist Prompt Layer Stack
- JiraSpecialist — Daily Standup Lanes
- Jira Transition Actions — Activating
TRIGGER_AGENTDispatch - Jupyter Output Mode Documentation
- Knowledge upload from chat (FEAT 647)
- LiveAvatar over your own LiveKit (Cloud or self hosted)
- Matrix Bridges for the AI Parrot Swarm (FEAT 463)
- Matrix Clients for the AI Parrot Swarm (FEAT 463)
- Migration Guide: FEAT 202 — ai parrot integrations
- Connections on Microsoft Teams
- MS Teams Toolkit for AI Parrot
- Nova Sonic Voice Protocol Reference
- Office 365 OAuth 2.0 (Delegated) — AI Parrot Integration
- PR Review Command — Setup Guide
- Queued chat commands
- Runbook — the
issuesnamespace (Jira ticket corpus) - Dev loop kick off from Slack (FEAT 555)
- Telegram Auth Open Mode (webview | browser)
- Telegram connections
- Telegram Bot Integration Guide
- FEAT 536 — VoiceBot Nova Dual Output + LiveAvatar: Real Live Operational Acceptance
- FEAT 537 — Nova VoiceBot avatar broadcast: operational acceptance
- FEAT 537 — Nova PCM → LiveAvatar LITE → LiveKit multi subscriber live gate
- speech_report TTS backends
- Nova VoiceBot avatar broadcast for multiple browsers (FEAT 537)
- 🦜 AI Parrot Voice Chat
- WhisperX Setup Guide for AI Parrot
- A2UI Linked Surfaces (FEAT 598)
- A2UI v1.0 Wire (FEAT 470)
- === D3.js ===
- Backend HTML Design System (FEAT 493)
- FEAT 488
- FormDesigner Audio Renderer
- Form Designer — Autonomous FormSchema Persistence (Standalone Forms)
- Form Designer — Conditional Sections: Pre/Post Dependencies
- FormBuilder — LLM answer plausibility enforcement
- FormDesigner — orphan upload cleanup (FEAT 731)
- FormDesigner — public response controls
- Form Designer — Relational Fields
- Serving FormDesigner forms from a Teams agent
- Form Designer — Unknown Field Capture Policy for Form Submissions
- FormDesigner — validation audit trail
- Infographic Recipes (FEAT 324)
- Inline A2UI Component Routing (FEAT 755)
- Metric Definition Registry (FEAT 756)
- Smart OutputFormatter Documentation
- N4 — navigator api backend inventory (dashboards / widgets / templates / modules / programs)
- P1 — ai parrot HTTP/WS endpoint inventory (report builder lens)
- P2 — ai parrot (Python) UI components, models, renderers, persistence — inventory for a REPORT BUILDER
- P4 — ai parrot prior art for a Report Builder (SDD inventory)
- ai parrot server — Admin / Bots / Studio / misc endpoint inventory
- P1 — ai parrot HTTP/WS endpoint inventory (report builder lens) ( core)
- parrot formdesigner — HTTP/WS endpoint inventory
- Report Builder — ai parrot inventory and analysis
- WeasyPrint 69.0 CSS Support — Empirical Findings
- Identity Capability User Guide
- Layers Reference
- Output Language (FEAT 638)
- PromptBuilder — User Modifiable Variables
- PromptBuilder User Guide
- Delegated OAuth2 connections
- Delegated OAuth2 connections on the web channel — deployment recipe and live harness
- Deterministic Groundedness Scoring
- ONNX Backend for the Prompt Injection Guardrail (FEAT 439)
- PBAC Guardrails — Policy Driven Tool Call Denial (FEAT 406)
- SecurityAdvisor — SOC2 Oriented Read Only Advisory Agent
- User Profile Management
- AI Parrot MCP Server AWS Deployment Guide
- Bot Cleanup Lifecycle
- Business Automation — Operator Runbook
parrot loginand connections- CompanyInfoToolkit
- Per component and per agent LLM defaults (FEAT 796, FEAT 882)
- Answer Accuracy Metrics for the Evaluation Harness (FEAT 652)
- Infographic CSP and Signed URLs — Operations Guide
- Global install: the parrot managed runtime (reference)
- Runbook — the Fireflies Meeting Registry
- Wiki standup briefs — runbook
parrot.finance— the finance satellite- Migration — FEAT 201: ai parrot embeddings
- Migration — FEAT 203: ai parrot server
- FEAT 223 — Structured Artifact Contract: Migration Guide
- FEAT 273 — Legacy output mode deprecations → A2UI
- Migration — FEAT 315: Unified NovaClient for all Amazon Nova models
- Migration — FEAT 421: Client declared tenant in the forms URL
- Migration — FEAT 446: SaaS Auth Hardening (S0 of Parrot Research Cloud)
- Migration — FEAT 473: A2UI v1.0 for STRUCTURED_CHART / STRUCTURED_TABLE / STRUCTURED_MAP
- Migration — FEAT 523: PEP 420 LLM Client Extraction
- Gemini 2.5 retirement (FEAT 798)
- Migration — FEAT 564: Reliable video reels with Gemini Omni and Veo 3.1
- Native Claude sandbox for SDD sessions (FEAT 768)
- Complementary (collaborative) research partner (FEAT 482)
- Dev flow per seat LLM configuration (
DevFlowModelPlan) - Dev loop
novabackend (AWS Bedrock) - sdd worker as orchestrator of parallel sdd coder seats (FEAT 549)
- SDD compaction capability record
- SDD execution optimization — operation and rollout
- Proposals to Reduce SDD Execution Time
- Dev flow / dev loop telemetry accounting
- Language Agnostic Validation Runners (FEAT 709)
- Spec Driven Development in Google Gemini / Antigravity CLI
- Guide to using the SDD slash commands
- AI Parrot Spec Driven Development (SDD) Platform
- SDD on Google Antigravity (agy)
/sdd donecloseout hooks- Decision Audit (FEAT 784)
- SDD experience memory
- SDD Expert Consult
- Ledger outbox (FEAT 758)
- FEAT 580 LSP Pilot — Live Evaluation Results
- SDD LSP research pilot (FEAT 580)
- Necessity Ladder (FEAT 908)
- Procedure Graph
- Test selection in the SDD flow — the Validation Contract (FEAT 699)
- wikitoolkit Cheatsheet
- wikitoolkit inbox
- wikitoolkit lint
- LLM Wiki — an agent maintained knowledge repository
- Schema Plane — Operator Guide (FEAT 600)
- SQLite concurrency for wiki and ledger
- wikitoolkit standup
- WikiToolkit as Claude Code infrastructure
- Authentication uses Navigator Auth
- AbstractClient base changes require a decision
- Clients are memory less
- Configuration uses NavConfig
- Graph backends — retire ArangoDB for PostgreSQL + SurrealDB
- Conversation history has one writer
- HTTP stack uses aiohttp
- LangChain is not part of the stack
- Async code remains non blocking
- Concrete tools live in ai parrot tools