Overview
Version 0.3.0 introduces:- Instance-based API (TTS + STT)
- Improved return types and type safety
- Model-specific options structure
- Renamed types and methods
Instance-based API (TTS + STT)
1
Understanding the Change
TTS and STT now use an instance-based factory pattern instead of module-level singletons. Each call to
createTTS() / createSTT() returns an independent engine instance.Key requirement: You must call .destroy() when done to free native resources.2
Migrate TTS Code
Before (0.2.x):After (0.3.0):
3
Migrate STT Code
Before (0.2.x):After (0.3.0):
Speech-to-Text (STT) Changes
Return Type Changes
transcribeFile now returns a detailed object instead of just a string:
Hotwords Support
initializeSTT now supports two additional optional options:
Deprecated Types
Native Method Renames
If you call the TurboModule directly, methods were renamed:Text-to-Speech (TTS) Changes
Model Options Structure
Model-specific options (noise scales, length scale) now use a nestedmodelOptions structure instead of flat properties.
Update Parameters
TheupdateParams method also uses the new structure:
New Model-Specific Types
The following types are now exported:Instance Methods and TurboModule
If you call the TurboModule directly, all instance-bound methods now takeinstanceId as the first parameter:
Deprecated Types
Complete Migration Example
- STT Migration
- TTS Migration
Before (0.2.x):After (0.3.0):
Common Patterns
Managing Multiple Instances
React Hook Pattern
Need Help?
If you encounter issues during migration:- Check the API Reference for detailed method signatures
- Review Troubleshooting for common issues
- See Examples for working code samples
- Open an issue on GitHub