// // Speech synthesis samples // private static void SpeechSynthesis() { ConsoleKeyInfo x; do { Console.WriteLine(""); Console.WriteLine(" Speech SDK - Speech Synthesis Samples"); Console.WriteLine(""); Console.WriteLine(choose); Console.WriteLine(""); Console.WriteLine(" 1. Speech synthesis to speaker output."); Console.WriteLine(" 2. Speech synthesis with specified language."); Console.WriteLine(" 3. Speech synthesis with specified voice."); Console.WriteLine(" 4. Speech synthesis to wave file."); Console.WriteLine(" 5. Speech synthesis to mp3 file."); Console.WriteLine(" 6. Speech synthesis to pull audio output stream."); Console.WriteLine(" 7. Speech synthesis to push audio output stream."); Console.WriteLine(" 8. Speech synthesis to result."); Console.WriteLine(" 9. Speech synthesis to audio data stream."); Console.WriteLine(" a. Speech synthesis events."); Console.WriteLine(" b. Speech synthesis with word boundary event."); Console.WriteLine(" c. Speech synthesis with viseme event."); Console.WriteLine(" d. Speech synthesis with bookmark event."); Console.WriteLine(" e. Speech synthesis using authorization token."); Console.WriteLine(" f. Speech synthesis in server scenario."); Console.WriteLine(" g. Speech synthesis with source language auto detection."); Console.WriteLine(" h. Speech synthesis using custom voice."); Console.WriteLine(" i. Get available speech synthesis voices."); Console.WriteLine(" j. Speech synthesis to speaker output with fallback to secondary region."); Console.WriteLine(" k. Speech synthesis to speaker output with custom voice and fallback to standard voice."); Console.WriteLine(" l. Speech synthesis to speaker output with custom voice and fallback to secondary region."); Console.WriteLine(" m. Speech synthesis from a long text file into mp3 file"); Console.WriteLine(""); Console.Write(prompt); x = Console.ReadKey(); Console.WriteLine("\n"); bool sampleWasRun = true; switch (x.Key) { case ConsoleKey.D1: case ConsoleKey.NumPad1: SpeechSynthesisSamples.SynthesisToSpeakerAsync().Wait(); break; case ConsoleKey.D2: case ConsoleKey.NumPad2: SpeechSynthesisSamples.SynthesisWithLanguageAsync().Wait(); break; case ConsoleKey.D3: case ConsoleKey.NumPad3: SpeechSynthesisSamples.SynthesisWithVoiceAsync().Wait(); break; case ConsoleKey.D4: case ConsoleKey.NumPad4: SpeechSynthesisSamples.SynthesisToWaveFileAsync().Wait(); break; case ConsoleKey.D5: case ConsoleKey.NumPad5: SpeechSynthesisSamples.SynthesisToMp3FileAsync().Wait(); break; case ConsoleKey.D6: case ConsoleKey.NumPad6: SpeechSynthesisSamples.SynthesisToPullAudioOutputStreamAsync().Wait(); break; case ConsoleKey.D7: case ConsoleKey.NumPad7: SpeechSynthesisSamples.SynthesisToPushAudioOutputStreamAsync().Wait(); break; case ConsoleKey.D8: case ConsoleKey.NumPad8: SpeechSynthesisSamples.SynthesisToResultAsync().Wait(); break; case ConsoleKey.D9: case ConsoleKey.NumPad9: SpeechSynthesisSamples.SynthesisToAudioDataStreamAsync().Wait(); break; case ConsoleKey.A: SpeechSynthesisSamples.SynthesisEventsAsync().Wait(); break; case ConsoleKey.B: SpeechSynthesisSamples.SynthesisWordBoundaryEventAsync().Wait(); break; case ConsoleKey.C: SpeechSynthesisSamples.SynthesisVisemeEventAsync().Wait(); break; case ConsoleKey.D: SpeechSynthesisSamples.SynthesisBookmarkEventAsync().Wait(); break; case ConsoleKey.E: SpeechSynthesisWithTokenSample.SpeechSynthesisWithAuthorizationTokenAsync().Wait(); break; case ConsoleKey.F: SpeechSynthesisServerScenarioSample.SpeechSynthesizeWithPool(); break; case ConsoleKey.G: SpeechSynthesisSamples.SynthesisWithAutoDetectSourceLanguageAsync().Wait(); break; case ConsoleKey.H: SpeechSynthesisSamples.SynthesisUsingCustomVoiceAsync().Wait(); break; case ConsoleKey.I: SpeechSynthesisSamples.SynthesisGetAvailableVoicesAsync().Wait(); break; case ConsoleKey.J: SpeechSynthesisSamples.SynthesizeOnceToSpeakerAsyncSwitchSecondaryRegion().Wait(); break; case ConsoleKey.K: SpeechSynthesisSamples.SynthesizeOnceUseCustomVoiceToSpeakerAsyncSwitchPlatformVoice().Wait(); break; case ConsoleKey.L: SpeechSynthesisSamples.SynthesizeOnceUseCustomVoiceToSpeakerAsyncSwitchSecondaryRegion().Wait(); break; case ConsoleKey.M: SpeechSynthesisSamples.SynthesisFileToMp3FileAsync().Wait(); break; case ConsoleKey.D0: case ConsoleKey.NumPad0: Console.WriteLine(back); sampleWasRun = false; break; default: Console.WriteLine(invalid); sampleWasRun = false; break; } if (sampleWasRun) { Console.WriteLine(done); } } while (x.Key != ConsoleKey.D0); }