Instance-Based API (TTS + STT)
TTS and STT now use an instance-based factory pattern instead of module-level singletons. Each call tocreateTTS() / createSTT() returns an independent engine instance.
Text-to-Speech (TTS)
Speech-to-Text (STT)
Speech-to-Text Changes
transcribeFile Return Type
transcribeFile now returns a full SttRecognitionResult object instead of just a string.
Hotwords Support
createSTT now supports two additional optional options:
hotwordsFile(string): Path to hotwords filehotwordsScore(number): Default boost score for hotwords
Native Method Renaming
The native TurboModule methods were renamed:initializeSherpaOnnx→initializeSttunloadSherpaOnnx→unloadStt
This only affects you if you’re calling the TurboModule directly. Use the high-level API instead.
Removed Deprecated Type
TranscriptionResult has been removed. Use SttRecognitionResult instead (same shape).
Text-to-Speech Changes
Model-Specific Options
Init and update no longer use flatnoiseScale, noiseScaleW, and lengthScale on the options object. Use modelOptions instead, with one block per model type.
Initialization
Updating Parameters
Model Option Types
New types exported from the TTS module:TtsModelOptionsTtsVitsModelOptionsTtsMatchaModelOptionsTtsKokoroModelOptionsTtsKittenModelOptionsTtsPocketModelOptions
Instance-Bound Methods
Example:Removed Deprecated Type
SynthesisOptions has been removed. Use TtsGenerationOptions instead (same shape).
Migration Checklist
Update transcribeFile usage
Change
const text = await transcribeFile(path) to const result = await stt.transcribeFile(path); const text = result.textUpdate TTS model options
Move flat
noiseScale, noiseScaleW, lengthScale to nested modelOptions.vits (or appropriate model type)Update method calls
Change module-level function calls to instance methods:
generateSpeech(text)→tts.generateSpeech(text)transcribeFile(path)→stt.transcribeFile(path)
Example: Complete Migration
See Also
STT API
Complete Speech-to-Text API reference
TTS API
Complete Text-to-Speech API reference
Model Setup
Learn how to set up and manage models
Hotwords
Contextual biasing for better accuracy