WinTTS.cs 1.1 KB

123456789101112131415161718192021222324252627282930313233
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Diagnostics;
  4. namespace Speech.tts {
  5. public class WinTTS : 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(path))
  11. arg.Add("--path=" + path);
  12. //arg.Add("--ssml");
  13. arg.Add("\"<speak>" + sentance + "\"</speak>");
  14. //p.StartInfo.FileName = "WinTTS.exe " + String.Join(' ', arg);
  15. p.StartInfo.FileName = "WinTTS.exe";
  16. p.StartInfo.Arguments = String.Join(' ', arg);
  17. System.Diagnostics.Debug.WriteLine("WinTTS.exe " + String.Join(' ', arg));
  18. p.StartInfo.WorkingDirectory = Environment.CurrentDirectory;
  19. p.StartInfo.CreateNoWindow = true;
  20. return p;
  21. }
  22. public string GetName() {
  23. return "Windows TTS";
  24. }
  25. }
  26. }