EddiSpeechService.SpeechServiceConfiguration.FromFile C# (CSharp) Method

FromFile() public static method

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
public static FromFile ( string filename = null ) : SpeechServiceConfiguration
filename string
return SpeechServiceConfiguration
        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;
        }

Usage Example

Esempio n. 1
0
 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);
 }
All Usage Examples Of EddiSpeechService.SpeechServiceConfiguration::FromFile
SpeechServiceConfiguration