private SpeechService() { configuration = SpeechServiceConfiguration.FromFile(); Logging.Debug("Current UI culture is " + Thread.CurrentThread.CurrentUICulture.Name); // Set the culture for this thread to the installed culture, to allow better selection of TTS voices Thread.CurrentThread.CurrentUICulture = new CultureInfo(CultureInfo.InstalledUICulture.Name); Logging.Debug("Thread UI culture is " + Thread.CurrentThread.CurrentUICulture.Name); }
/// <summary> /// Obtain speech config from a file. If If the file name is not supplied the the default /// path of Constants.Data_DIR\speech.json is used /// </summary> /// <param name="filename"></param> public static SpeechServiceConfiguration FromFile(string filename = null) { if (filename == null) { filename = Constants.DATA_DIR + @"\speech.json"; } SpeechServiceConfiguration speech = new SpeechServiceConfiguration(); try { string configData = File.ReadAllText(filename); speech = JsonConvert.DeserializeObject<SpeechServiceConfiguration>(configData); } catch {} speech.dataPath = filename; return speech; }
/// <summary> /// Obtain speech config from a file. If If the file name is not supplied the the default /// path of Constants.Data_DIR\speech.json is used /// </summary> /// <param name="filename"></param> public static SpeechServiceConfiguration FromFile(string filename = null) { if (filename == null) { filename = Constants.DATA_DIR + @"\speech.json"; } SpeechServiceConfiguration speech = new SpeechServiceConfiguration(); try { string configData = File.ReadAllText(filename); speech = JsonConvert.DeserializeObject <SpeechServiceConfiguration>(configData); } catch {} speech.dataPath = filename; return(speech); }
private SpeechService() { Configuration = SpeechServiceConfiguration.FromFile(); }
/// <summary> /// fetch the Text-to-Speech Configuration and write it to File /// </summary> private void ttsUpdated() { SpeechServiceConfiguration speechConfiguration = new SpeechServiceConfiguration(); speechConfiguration.StandardVoice = ttsVoiceDropDown.SelectedValue == null || ttsVoiceDropDown.SelectedValue.ToString() == "Windows TTS default" ? null : ttsVoiceDropDown.SelectedValue.ToString(); speechConfiguration.Volume = (int)ttsVolumeSlider.Value; speechConfiguration.Rate = (int)ttsRateSlider.Value; speechConfiguration.EffectsLevel = (int)ttsEffectsLevelSlider.Value; speechConfiguration.DistortOnDamage = ttsDistortCheckbox.IsChecked.Value; speechConfiguration.DisableSsml = disableSsmlCheckbox.IsChecked.Value; speechConfiguration.ToFile(); SpeechService.Instance.ReloadConfiguration(); }
public void ReloadConfiguration() { configuration = SpeechServiceConfiguration.FromFile(); }