espeak
Text to phoneme conversion, powered by espeak-ng.
The native library compiles automatically via Dart Native Assets (requires a C compiler).
Usage
import 'package:espeak/espeak.dart';
final espeak = Espeak.init('./espeak-data');
final phonemes = espeak.phonemize('Hello world');
print(phonemes); // həlˈoʊ wˈɜːld
espeak.dispose();
Phoneme Data
espeak needs compiled phoneme data at runtime. Add espeak as a dependency and run the compiler:
dart run espeak:compile_data --all --exclude=fo --output ./espeak-data
Then pass the output path to Espeak.init().
Note:
espeak_cliis also available butdart pub global activatedoesn't support native assets yet. Usedart runfrom a project that depends onespeakinstead.