Пример #1
0
        public static Stream Authenticate()
        {
            TextToSpeechService _textToSpeech = new TextToSpeechService();
            string username = "******";
            string password = "******";

            //string url = "https://stream.watsonplatform.net/text-to-speech/api";



            _textToSpeech.SetCredential(username, password);
            var voices = _textToSpeech.GetVoices();
            var strem  = _textToSpeech.Synthesize("Hello Sabio Nation! Go win some money!", Voice.EN_ALLISON, AudioType.WAV);

            return(strem);
        }
        private void GetVoices()
        {
            Console.WriteLine("Calling GetVoices()...");

            var results = _textToSpeech.GetVoices();

            if (results != null && results.Count > 0)
            {
                Console.WriteLine("Voices found...");
                foreach (Voice voice in results)
                {
                    Console.WriteLine(string.Format("name: {0} | language: {1} | gender: {2} | description {3}",
                                                    voice.Name,
                                                    voice.Language,
                                                    voice.Gender,
                                                    voice.Description));
                }
            }
            else
            {
                Console.WriteLine("There are no voices.");
            }
        }