private void Play() { var item = Items.Dequeue(); var text = GetArticle(item); engine = SpeechController.GetInstance(LibraryName); engine.Activate(); engine.Finished += Engine_Finished; IsPlaying = true; engine.Play(text); }
public static List <FileInfo> SpeechToText(ISpeechEngine engine, string path, int max = int.MaxValue, bool overwrite = false) { if (!Directory.Exists(path)) { throw new ArgumentException($"Path does not exist: {path}"); } var outputPath = Path.Combine(path, $"{OutputTextFolder}_{engine.Name}"); if (!Directory.Exists(outputPath)) { Directory.CreateDirectory(outputPath); } var files = new List <FileInfo>(); var existingFiles = new List <FileInfo>(); if (!overwrite) { existingFiles = Directory.GetFiles(outputPath).Select(x => new FileInfo(x)).ToList(); } var items = Directory.GetFiles(path).Select(x => new FileInfo(x)).ToList() .Where(y => !existingFiles.Any(x => x.Name.StartsWith(y.Name))); Parallel.ForEach(items, new ParallelOptions { MaxDegreeOfParallelism = 20 }, (item) => { var outputFile = Path.Combine(outputPath, $"{item.Name}_{engine.Name}.txt"); engine.GenerateText(item, outputFile); Console.WriteLine($"Converted speech to text: {outputFile}"); files.Add(new FileInfo(outputFile)); }); return(files); }
public SpeechSynthesizer(ISpeechEngine engine) { speechengine = engine; tq = new TaskQueue(); }
public void Initialize(ISpeechEngine engine) { _engine = engine; }
public SpeechSynthesizer(ISpeechEngine engine) { speechengine = engine; }