| 1234567891011121314151617181920212223242526272829303132 |
- 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<string> arg = new List<string>();
- 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";
- }
- }
- }
|