PicoTTS.cs 975 B

123456789101112131415161718192021222324252627282930
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Diagnostics;
  4. namespace Speech.tts {
  5. public class PicoTTS : ISpeechSystem {
  6. // pico2wave --lang=de-DE --wave=/tmp/test.wav "Guten Morgen"; aplay /tmp/test.wav; rm /tmp/test.wav
  7. public Process GenerateTTS(string path, string voiceName, string lang, string sentance) {
  8. Process p = new Process();
  9. List<string> arg = new List<string>();
  10. if (!String.IsNullOrEmpty(lang))
  11. arg.Add("--lang=" + lang);
  12. if (!String.IsNullOrEmpty(path))
  13. arg.Add("--wave=" + path);
  14. arg.Add("\"" + sentance + "\"");
  15. p.StartInfo.FileName = "pico2wave " + String.Join(' ', arg);
  16. p.StartInfo.WorkingDirectory = Environment.CurrentDirectory;
  17. p.StartInfo.CreateNoWindow = true;
  18. return p;
  19. }
  20. public string GetName() {
  21. return "Pico TTS";
  22. }
  23. }
  24. }