An Expo development-build example for @kittentts/react-native.
Expo Go is not supported because the SDK depends on native modules for ONNX inference and filesystem access.
This example uses Expo SDK 54. For the Expo SDK 55 version, see
examples/ExpoWordTimingsExample.
Use this example when you want a simple Expo app with model, voice, speed,
generate, and speak controls. Use ExpoWordTimingsExample when you specifically
want word highlighting.
Run these commands from the repository root. Use a development build; Expo Go will not work.
Prerequisites:
- Node.js >= 20
- Android Studio with an emulator open for Android
- Xcode with an iOS simulator available for iOS
Android:
cd examples/ExpoExample
npm install
npm run androidiOS:
cd examples/ExpoExample
npm install
npm run iosThe APK will be written under android/app/build/outputs/apk/debug/.
This is a development-build APK, so start Metro with npm start when testing it
after manual install.
cd examples/ExpoExample
npm install
npx expo prebuild --platform android && cd android && ./gradlew assembleDebugThe example installs @kittentts/react-native from npm, the same way a user app
does.
Android 16 KB page-size handling lives in the SDK package, so
regenerating android/ does not require app-side patches.
The first app run downloads the model and phonemizer files. Later runs reuse the local cache.
The important setup is:
import * as ExpoAudio from 'expo-audio';
import { KittenTTS, createExpoAudioPlayer } from '@kittentts/react-native';
const tts = await KittenTTS.create({
player: createExpoAudioPlayer(ExpoAudio),
});Then either generate metadata:
const result = await tts.generate('Hello from KittenTTS.');Or generate and play:
await tts.speak('Hello from KittenTTS.');For word highlighting, copy the pattern from
examples/ExpoWordTimingsExample.