meomeo 0.1.1
meomeo: ^0.1.1 copied to clipboard
Text to speech for Dart, powered by espeak-ng and ONNX Runtime.
meomeo #
Text to speech for Dart. Text in, audio out.
Uses espeak-ng for phonemization and ONNX Runtime for neural inference. Compatible with KittenTTS models.
Setup #
1. Download a KittenTTS model #
From HuggingFace, download both files into your project:
Nano (15M params, fast):
curl -L -o model.onnx https://huggingface.co/KittenML/kitten-tts-nano-0.8/resolve/main/kitten_tts_nano_v0_8.onnx
curl -L -o voices.npz https://huggingface.co/KittenML/kitten-tts-nano-0.8/resolve/main/voices.npz
Mini (80M params, better quality):
curl -L -o model.onnx https://huggingface.co/KittenML/kitten-tts-mini-0.8/resolve/main/kitten_tts_mini_v0_8.onnx
curl -L -o voices.npz https://huggingface.co/KittenML/kitten-tts-mini-0.8/resolve/main/voices.npz
2. Compile espeak phoneme data #
The espeak package needs phoneme data at runtime. Add espeak as a dev dependency and run the compiler:
dart pub add espeak --dev
dart run espeak:compile_data --all --exclude=fo --output ./espeak-data
Note:
dart pub global activate espeak_clidoes not work yet because global activate doesn't build native assets. Usedart runfrom a project that depends onespeakinstead.
3. Add meomeo to your project #
dependencies:
meomeo: ^0.1.0
Usage #
import 'package:meomeo/meomeo.dart';
final meo = Meo.init(
'model.onnx',
voicesPath: 'voices.npz',
espeakDataPath: './espeak-data',
);
// Text to audio
final pcm = meo.speak('Hello world');
// Text to WAV file
meo.save('Hello world', 'output.wav');
// Switch voice
meo.speaker = 'Bruno';
// Cleanup
meo.dispose();
Voices #
Bella, Jasper, Luna, Bruno, Rosie, Hugo, Kiki, Leo
Requirements #
- Rust toolchain (
rustup) — dort compiles ONNX Runtime via Native Assets - C compiler (Xcode/gcc) — espeak compiles espeak-ng via Native Assets