public static string Synthesize2(string text)
        {
            TextToSpeechService _textToSpeech = new TextToSpeechService();

            _textToSpeech.SetCredential(_username, _password);

            var sample = _textToSpeech.Synthesize(text, Voice.ES_SOFIA, AudioType.WAV);

            string file = "sample_" + Guid.NewGuid() + ".wav";

            string path = Path.Combine(HomeController._wwwRoot.WebRootPath, "audio", file);

            foreach (string f in Directory.EnumerateFiles(Path.Combine(HomeController._wwwRoot.WebRootPath, "audio"), "sample_*.wav"))
            {
                File.Delete(f);
            }


            using (var fileStream = File.Create(path))
            {
                sample.CopyTo(fileStream);
            }

            return(path);
        }
        public static byte[] SynthesizeToByteArray(string text)
        {
            TextToSpeechService _textToSpeech = new TextToSpeechService();

            _textToSpeech.SetCredential(_username, _password);

            var sample = _textToSpeech.Synthesize(text, Voice.ES_SOFIA, AudioType.WAV);

            byte[] result = StreamExtension.ReadAllBytes(sample);

            return(result);
        }