using System; using System.Collections.Generic; using System.Text; using System.Diagnostics; namespace Speech.play { public class aplay : IPlaySystem { public Process Play(string path, string Device, int freq = 8000) { //aplay -c 1 -t wav -r 22050 -f mu_law foobar Process p = new Process(); List arg = new List(); if (!String.IsNullOrEmpty(Device)) arg.Add("--device " + Device); if (freq>0) arg.Add("--rate " + freq.ToString()); arg.Add("--t wav"); arg.Add("\"" + path + "\""); p.StartInfo.FileName = "aplay " + String.Join(' ', arg); p.StartInfo.WorkingDirectory = Environment.CurrentDirectory; p.StartInfo.CreateNoWindow = true; return p; } public string GetName() { return "APlay"; } } }