/// <summary> /// Obtain speech config from a file. If If the file name is not supplied the the default /// path of %APPDATA%\EDDI\speech.json is used /// </summary> /// <param name="filename"></param> public static SpeechServiceConfiguration FromFile(string filename = null) { if (filename == null) { String dataDir = Environment.GetEnvironmentVariable("AppData") + "\\EDDI"; Directory.CreateDirectory(dataDir); filename = dataDir + "\\speech.json"; } SpeechServiceConfiguration speech; try { String configData = File.ReadAllText(filename); speech = JsonConvert.DeserializeObject <SpeechServiceConfiguration>(configData); } catch { speech = new SpeechServiceConfiguration(); } speech.dataPath = filename; return(speech); }
public SpeechService(SpeechServiceConfiguration configuration = null) { this.configuration = configuration == null ? new SpeechServiceConfiguration() : configuration; locale = Thread.CurrentThread.CurrentCulture.Name; }