speak method

  1. @override
Future<void> speak(
  1. String text,
  2. VoiceConfig config
)
override

Implementation

@override
Future<void> speak(String text, VoiceConfig config) async {
  await stop(); // Stop any current speech.

  if (Platform.isMacOS) {
    _speakProcess = await Process.start('say', [
      '-r',
      '${(175 * config.speed).round()}',
      text,
    ]);
    await _speakProcess!.exitCode;
    _speakProcess = null;
  } else if (Platform.isLinux) {
    _speakProcess = await Process.start('espeak', [
      '-s',
      '${(175 * config.speed).round()}',
      text,
    ]);
    await _speakProcess!.exitCode;
    _speakProcess = null;
  }
}