Interface: TransformersJsTtsAdapterOptions
Defined in: src/batteries/tts/transformers_js/types.ts:106
Constructor options for the transformers.js TTS adapter.
Remarks
model is required — no default, since TTS models are multi-hundred-megabyte downloads and this battery never triggers one silently (the loud-config rule shared with every on-device battery). Extends the shared BaseTtsAdapterOptions (voice/rate) — see that base for the normalization semantics.
Extends
Properties
| Property | Type | Description | Inherited from | Defined in |
|---|---|---|---|---|
createPipeline? | CreateTransformersJsTtsPipeline | Override the pipeline factory. Default: pipeline('text-to-speech', …) via dynamic import. | - | src/batteries/tts/transformers_js/types.ts:116 |
device? | | "auto" | "gpu" | "cpu" | "wasm" | "webgpu" | "cuda" | "dml" | "coreml" | "webnn" | "webnn-npu" | "webnn-gpu" | "webnn-cpu" | Inference device forwarded to pipeline(). Default: transformers.js environment default. | - | src/batteries/tts/transformers_js/types.ts:118 |
dtype? | | "auto" | "fp32" | "fp16" | "q8" | "int8" | "uint8" | "q4" | "bnb4" | "q4f16" | "q2" | "q2f16" | "q1" | "q1f16" | Quantization/precision dtype forwarded to pipeline(). | - | src/batteries/tts/transformers_js/types.ts:120 |
isAvailable? | () => boolean | Override the availability probe. Default: true whenever the peer is importable (env-neutral). | - | src/batteries/tts/transformers_js/types.ts:137 |
model | string | The TTS model id, e.g. Xenova/mms-tts-eng (MMS-VITS) or Xenova/speecht5_tts (SpeechT5, which additionally requires speakerEmbeddings). Required. | - | src/batteries/tts/transformers_js/types.ts:112 |
modelSource? | TransformersJsTtsModelSource | Custom model-source resolver (OPFS / separate source / bundled bytes). When set, model files load through it behind the global-env mutex; otherwise straight from HF (unchanged). See TransformersJsTtsModelSource. | - | src/batteries/tts/transformers_js/types.ts:133 |
numInferenceSteps? | number | Default denoising step count for models that support it, applied when a call omits its own. | - | src/batteries/tts/transformers_js/types.ts:127 |
onCompiling? | BatteryLifecycleCallback | Engine/graph/shader compilation after download, before the first token. A COARSE marker: the on-device runtimes (LiteRT Engine.create, transformers.js from_pretrained) expose the boundary — download done, opaque WebGPU/WASM graph build about to run — but NOT a progress stream, so progress is usually absent. Often the slowest part of a cold start; without this it was invisible. | BatteryLifecycleHooks.onCompiling | src/batteries/llm/chat_common/lifecycle.ts:95 |
onComplete? | BatteryLifecycleCallback | After the turn's output is parsed + persisted, before ack (fires per turn). | BatteryLifecycleHooks.onComplete | src/batteries/llm/chat_common/lifecycle.ts:105 |
onError? | BatteryLifecycleCallback | A load or generation failure (paired with nack). | BatteryLifecycleHooks.onError | src/batteries/llm/chat_common/lifecycle.ts:107 |
onGenerating? | BatteryLifecycleCallback | The generate call is in progress (fires per turn). Fires once immediately before the provider call for most engines; engines that stream per-step generation progress (e.g. a diffusion denoise loop) fire it REPEATEDLY during generation, each carrying a progress in 0..1. | BatteryLifecycleHooks.onGenerating | src/batteries/llm/chat_common/lifecycle.ts:103 |
onInitProgress? | ProgressCallback | Called with model-load progress reports while weights download/compile. | - | src/batteries/tts/transformers_js/types.ts:135 |
onLifecycle? | BatteryLifecycleCallback | Fires on EVERY phase transition (the firehose). | BatteryLifecycleHooks.onLifecycle | src/batteries/llm/chat_common/lifecycle.ts:86 |
onLoading? | BatteryLifecycleCallback | Weights/runtime loading — may fire repeatedly with progress as the provider reports it. | BatteryLifecycleHooks.onLoading | src/batteries/llm/chat_common/lifecycle.ts:88 |
onReady? | BatteryLifecycleCallback | Engine/pipeline resolved and cached, before the first generation. | BatteryLifecycleHooks.onReady | src/batteries/llm/chat_common/lifecycle.ts:97 |
pipeline? | TextToAudioPipeline | A pre-built pipeline. When provided, the battery uses it directly and skips lazy creation. | - | src/batteries/tts/transformers_js/types.ts:114 |
rate? | number | Default speaking-rate multiplier (1 = engine-normal), applied when a synthesize call omits its own rate. Per-engine mapping (see the module remarks). Unset → engine-normal rate. | BaseTtsAdapterOptions.rate | src/batteries/tts/_shared/index.ts:61 |
speakerEmbeddings? | TransformersJsTtsSpeakerEmbeddings | Default speaker-embedding reference, applied when a synthesize call omits its own. Required by SpeechT5-family models; ignored by models that do not use speaker embeddings (e.g. MMS-VITS). | - | src/batteries/tts/transformers_js/types.ts:125 |
voice? | string | Default voice, applied when a synthesize call omits its own voice. Per-engine semantics (see the module remarks). Unset → the engine/model default voice. | BaseTtsAdapterOptions.voice | src/batteries/tts/_shared/index.ts:56 |