Skip to content
1 min read · 265 words

@nhtio/adk/batteries/tts/_shared

Structural contracts shared across every TTS (text-to-speech) engine — the model-backed transformers.js engine and the OS-native CLI engine both build on these.

Remarks

This module owns the shared TTS option base (BaseTtsAdapterOptions) and the shared per-call shape (SynthesizeOptions), plus the audio-result contract (RawAudioLike). It lives in _shared — NOT inside any one engine — deliberately: the native engine is model-less while the transformers.js engine requires a model, so neither engine "owns" the common base. A future non-transformers engine can extend this base without importing a transformer-named subpath.

model is intentionally absent from BaseTtsAdapterOptions: the OS-native engine synthesizes through say/espeak-ng/PowerShell and has no model concept, so each model-backed engine adds its own required model field rather than the base forcing one. Do not "fix" this by hoisting model into the base — it is a deliberate divergence from the embeddings/generation domains (whose bases require model).

Interfaces

InterfaceDescription
BaseTtsAdapterOptionsOptions shared by every TTS engine, regardless of backend.
RawAudioLikeThe minimal structural slice of transformers.js's RawAudio the TTS engine consumes: a single toBlob() that encodes the synthesized samples to a WAV Blob.
SynthesizeOptionsPer-call options accepted by every engine's synthesize. Engine-specific per-call option interfaces extend this with their own knobs.

Type Aliases

Type AliasDescription
TtsSynthesisResultThe synthesized-audio result every TTS engine resolves to — an alias of the shared GeneratedMediaOutput descriptor, always kind: 'audio' in practice.

References

GeneratedMediaOutput

Re-exports GeneratedMediaOutput