예제 #1
0
        static void Main(string[] args)
        {
            var prompt = "Your choice (0: Stop): ";

            Console.WriteLine("1. Speech recognition with microphone input.");
            Console.WriteLine("2. Speech recognition in the specified language and using detailed output format.");
            Console.WriteLine("3. Speech continuous recognition with file input.");
            Console.WriteLine("4. Speech recognition using customized model.");
            Console.WriteLine("5. Speech recognition with pull audio stream.");
            Console.WriteLine("6. Speech recognition with push audio stream.");
            Console.WriteLine("7. Speech recognition with keyword spotting.");
            Console.WriteLine("8. Translation with microphone input.");
            Console.WriteLine("9. Translation with file input.");
            Console.WriteLine("A. Translation with audio stream.");
            Console.WriteLine("B. Speech continuous recognition using authorization token.");
            Console.WriteLine("C. Intent recognition with microphone input.");
            Console.WriteLine("D. Intent continuous recognition with file input.");
            Console.WriteLine("E. Intent recognition in the specified language with microphone input.");
            Console.WriteLine("F. Speech synthesis to speaker output.");
            Console.WriteLine("G. Speech synthesis with specified language.");
            Console.WriteLine("H. Speech synthesis with specified voice.");
            Console.WriteLine("I. Speech synthesis to wave file.");
            Console.WriteLine("J. Speech synthesis to mp3 file.");
            Console.WriteLine("K. Speech synthesis to pull audio output stream.");
            Console.WriteLine("L. Speech synthesis to push audio output stream.");
            Console.WriteLine("M. Speech synthesis to result.");
            Console.WriteLine("N. Speech synthesis to audio data stream.");
            Console.WriteLine("O. Speech synthesis events.");
            Console.WriteLine("P. Speech Recognition using Phrase Lists");
            Console.WriteLine("Q. Speech synthesis word boundary event.");
            Console.WriteLine("R. Speech synthesis using authorization token.");
            Console.WriteLine("S. Speech synthesis in server scenario.");
            Console.WriteLine("T. Speech recognition with compressed input pull audio stream.");
            Console.WriteLine("U. Speech recognition with compressed input push audio stream.");
            Console.WriteLine("V. Translation with compressed input push audio stream.");
            Console.WriteLine("W. Keyword recognizer.");

            Console.Write(prompt);

            ConsoleKeyInfo x;

            do
            {
                x = Console.ReadKey();
                Console.WriteLine("");
                switch (x.Key)
                {
                case ConsoleKey.D1:
                    SpeechRecognitionSamples.RecognitionWithMicrophoneAsync().Wait();
                    break;

                case ConsoleKey.D2:
                    SpeechRecognitionSamples.RecognitionWithLanguageAndDetailedOutputAsync().Wait();
                    break;

                case ConsoleKey.D3:
                    SpeechRecognitionSamples.ContinuousRecognitionWithFileAsync().Wait();
                    break;

                case ConsoleKey.D4:
                    SpeechRecognitionSamples.RecognitionUsingCustomizedModelAsync().Wait();
                    break;

                case ConsoleKey.D5:
                    SpeechRecognitionSamples.RecognitionWithPullAudioStreamAsync().Wait();
                    break;

                case ConsoleKey.D6:
                    SpeechRecognitionSamples.RecognitionWithPushAudioStreamAsync().Wait();
                    break;

                case ConsoleKey.D7:
                    SpeechRecognitionSamples.ContinuousRecognitionWithKeywordSpottingAsync().Wait();
                    break;

                case ConsoleKey.D8:
                    TranslationSamples.TranslationWithMicrophoneAsync().Wait();
                    break;

                case ConsoleKey.D9:
                    TranslationSamples.TranslationWithFileAsync().Wait();
                    break;

                case ConsoleKey.A:
                    TranslationSamples.TranslationWithAudioStreamAsync().Wait();
                    break;

                case ConsoleKey.B:
                    SpeechRecognitionWithTokenSample.ContinuousRecognitionWithAuthorizationTokenAsync().Wait();
                    break;

                case ConsoleKey.C:
                    IntentRecognitionSamples.RecognitionWithMicrophoneAsync().Wait();
                    break;

                case ConsoleKey.D:
                    IntentRecognitionSamples.ContinuousRecognitionWithFileAsync().Wait();
                    break;

                case ConsoleKey.E:
                    IntentRecognitionSamples.RecognitionWithMicrophoneUsingLanguageAsync().Wait();
                    break;

                case ConsoleKey.F:
                    SpeechSynthesisSamples.SynthesisToSpeakerAsync().Wait();
                    break;

                case ConsoleKey.G:
                    SpeechSynthesisSamples.SynthesisWithLanguageAsync().Wait();
                    break;

                case ConsoleKey.H:
                    SpeechSynthesisSamples.SynthesisWithVoiceAsync().Wait();
                    break;

                case ConsoleKey.I:
                    SpeechSynthesisSamples.SynthesisToWaveFileAsync().Wait();
                    break;

                case ConsoleKey.J:
                    SpeechSynthesisSamples.SynthesisToMp3FileAsync().Wait();
                    break;

                case ConsoleKey.K:
                    SpeechSynthesisSamples.SynthesisToPullAudioOutputStreamAsync().Wait();
                    break;

                case ConsoleKey.L:
                    SpeechSynthesisSamples.SynthesisToPushAudioOutputStreamAsync().Wait();
                    break;

                case ConsoleKey.M:
                    SpeechSynthesisSamples.SynthesisToResultAsync().Wait();
                    break;

                case ConsoleKey.N:
                    SpeechSynthesisSamples.SynthesisToAudioDataStreamAsync().Wait();
                    break;

                case ConsoleKey.O:
                    SpeechSynthesisSamples.SynthesisEventsAsync().Wait();
                    break;

                case ConsoleKey.P:
                    SpeechRecognitionSamples.ContinuousRecognitionWithFileAndPhraseListsAsync().Wait();
                    break;

                case ConsoleKey.Q:
                    SpeechSynthesisSamples.SynthesisWordBoundaryEventAsync().Wait();
                    break;

                case ConsoleKey.R:
                    SpeechSynthesisWithTokenSample.SpeechSynthesisWithAuthorizationTokenAsync().Wait();
                    break;

                case ConsoleKey.S:
                    SpeechSynthesisServerScenarioSample.SpeechSynthesizeWithPool();
                    break;

                case ConsoleKey.T:
                    SpeechRecognitionSamples.SpeechRecognitionWithCompressedInputPullStreamAudio().Wait();
                    break;

                case ConsoleKey.U:
                    SpeechRecognitionSamples.SpeechRecognitionWithCompressedInputPushStreamAudio().Wait();
                    break;

                case ConsoleKey.V:
                    TranslationSamples.TranslationWithFileCompressedInputAsync().Wait();
                    break;

                case ConsoleKey.W:
                    SpeechRecognitionSamples.KeywordRecognizer().Wait();
                    break;

                case ConsoleKey.D0:
                    Console.WriteLine("Exiting...");
                    break;

                default:
                    Console.WriteLine("Invalid input.");
                    break;
                }
                Console.WriteLine("\nExecution done. " + prompt);
            } while (x.Key != ConsoleKey.D0);
        }
예제 #2
0
        static void Main(string[] args)
        {
            //Outputter
            Console.OutputEncoding = System.Text.Encoding.GetEncoding(950);
            //Console.OutputEncoding =Encoding.Unicode;
            //Console.OutputEncoding = Encoding.UTF8;

            Console.WriteLine("中文字");
            Console.WriteLine("-----------------[語音轉文字]------------------------");
            Console.WriteLine("1. Speech recognition with microphone input.");
            Console.WriteLine("2. Speech recognition in the specified language and using detailed output format.");
            Console.WriteLine("3. Speech continuous recognition with file input.");
            Console.WriteLine("4. Speech recognition using customized model.");
            Console.WriteLine("5. Speech recognition with audio stream.");
            Console.WriteLine("X. 持續的中文麥克風輸入");
            Console.WriteLine("-----------------[翻譯轉換]------------------------");
            Console.WriteLine("6. Translation with microphone input.");
            Console.WriteLine("7. Translation with file input.");
            Console.WriteLine("8. Translation with audio stream.");
            Console.WriteLine("9. Speech continuous recognition using authorization token.");
            Console.WriteLine("-----------------[語音分析]------------------------");
            Console.WriteLine("A. Intent recognition with microphone input.");
            Console.WriteLine("B. Intent continuous recognition with file input.");
            Console.WriteLine("C. Intent recognition in the specified language with microphone input.");

            Console.Write("Your choice (0: Stop.): ");

            ConsoleKeyInfo x;

            do
            {
                x = Console.ReadKey();
                Console.WriteLine("");
                switch (x.Key)
                {
                case ConsoleKey.D1:
                    SpeechRecognitionSamples.RecognitionWithMicrophoneAsync().Wait();
                    break;

                case ConsoleKey.D2:
                    SpeechRecognitionSamples.RecognitionWithLanguageAndDetailedOutputAsync().Wait();
                    break;

                case ConsoleKey.D3:
                    SpeechRecognitionSamples.ContinuousRecognitionWithFileAsync().Wait();
                    break;

                case ConsoleKey.D4:
                    SpeechRecognitionSamples.RecognitionUsingCustomizedModelAsync().Wait();
                    break;

                case ConsoleKey.D5:
                    SpeechRecognitionSamples.RecognitionWithAudioStreamAsync().Wait();
                    break;

                case ConsoleKey.X:
                    SpeechRecognitionSamples.ContinuousRecognitionWithMicrophoneAsync().Wait();
                    break;

                case ConsoleKey.D6:
                    TranslationSamples.TranslationWithMicrophoneAsync().Wait();
                    break;

                case ConsoleKey.D7:
                    TranslationSamples.TranslationWithFileAsync().Wait();
                    break;

                case ConsoleKey.D8:
                    TranslationSamples.TranslationWithAudioStreamAsync().Wait();
                    break;

                case ConsoleKey.D9:
                    SpeechRecognitionWithTokenSample.ContinuousRecognitionWithAuthorizationTokenAsync().Wait();
                    break;

                case ConsoleKey.A:
                    IntentRecognitionSamples.RecognitionWithMicrophoneAsync().Wait();
                    break;

                case ConsoleKey.B:
                    IntentRecognitionSamples.ContinuousRecognitionWithFileAsync().Wait();
                    break;

                case ConsoleKey.C:
                    IntentRecognitionSamples.RecognitionWithMicrophoneUsingLanguageAsync().Wait();
                    break;

                case ConsoleKey.D0:
                    Console.WriteLine("Exiting...");
                    break;

                default:
                    Console.WriteLine("Invalid input.");
                    break;
                }
                Console.WriteLine("\nRecognition done. Your Choice (0: Stop): ");
            } while (x.Key != ConsoleKey.D0);
        }
        private static void IntentRecognition()
        {
            ConsoleKeyInfo x;

            do
            {
                Console.WriteLine("");
                Console.WriteLine(" Speech SDK - Intent Recognition Samples");
                Console.WriteLine("");
                Console.WriteLine(choose);
                Console.WriteLine("");
                Console.WriteLine(" 1. Intent recognition with microphone input.");
                Console.WriteLine(" 2. Intent continuous recognition with file input.");
                Console.WriteLine(" 3. Intent recognition in the specified language with microphone input.");
                Console.WriteLine(" 4. Intent recognition from default microphone and pattern matching.");
                Console.WriteLine("");
                Console.Write(prompt);

                x = Console.ReadKey();
                Console.WriteLine("\n");
                bool sampleWasRun = true;

                switch (x.Key)
                {
                case ConsoleKey.D1:
                case ConsoleKey.NumPad1:
                    IntentRecognitionSamples.RecognitionWithMicrophoneAsync().Wait();
                    break;

                case ConsoleKey.D2:
                case ConsoleKey.NumPad2:
                    IntentRecognitionSamples.ContinuousRecognitionWithFileAsync().Wait();
                    break;

                case ConsoleKey.D3:
                case ConsoleKey.NumPad3:
                    IntentRecognitionSamples.RecognitionWithMicrophoneUsingLanguageAsync().Wait();
                    break;

                case ConsoleKey.D4:
                case ConsoleKey.NumPad4:
                    IntentRecognitionSamples.IntentPatternMatchingWithMicrophoneAsync().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);
        }
예제 #4
0
        static void Main(string[] args)
        {
            Console.WriteLine("1. Speech recognition with microphone input.");
            Console.WriteLine("2. Speech recognition in the specified language and using detailed output format.");
            Console.WriteLine("3. Speech continuous recognition with file input.");
            Console.WriteLine("4. Speech recognition using customized model.");
            Console.WriteLine("5. Speech recognition with pull audio stream.");
            Console.WriteLine("6. Speech recognition with push audio stream.");
            Console.WriteLine("7. Translation with microphone input.");
            Console.WriteLine("8. Translation with file input.");
            Console.WriteLine("9. Translation with audio stream.");
            Console.WriteLine("A. Speech continuous recognition using authorization token.");
            Console.WriteLine("B. Intent recognition with microphone input.");
            Console.WriteLine("C. Intent continuous recognition with file input.");
            Console.WriteLine("D. Intent recognition in the specified language with microphone input.");

            Console.Write("Your choice (0: Stop.): ");

            ConsoleKeyInfo x;

            do
            {
                x = Console.ReadKey();
                Console.WriteLine("");
                switch (x.Key)
                {
                case ConsoleKey.D1:
                    SpeechRecognitionSamples.RecognitionWithMicrophoneAsync().Wait();
                    break;

                case ConsoleKey.D2:
                    SpeechRecognitionSamples.RecognitionWithLanguageAndDetailedOutputAsync().Wait();
                    break;

                case ConsoleKey.D3:
                    SpeechRecognitionSamples.ContinuousRecognitionWithFileAsync().Wait();
                    break;

                case ConsoleKey.D4:
                    SpeechRecognitionSamples.RecognitionUsingCustomizedModelAsync().Wait();
                    break;

                case ConsoleKey.D5:
                    SpeechRecognitionSamples.RecognitionWithPullAudioStreamAsync().Wait();
                    break;

                case ConsoleKey.D6:
                    SpeechRecognitionSamples.RecognitionWithPushAudioStreamAsync().Wait();
                    break;

                case ConsoleKey.D7:
                    TranslationSamples.TranslationWithMicrophoneAsync().Wait();
                    break;

                case ConsoleKey.D8:
                    TranslationSamples.TranslationWithFileAsync().Wait();
                    break;

                case ConsoleKey.D9:
                    TranslationSamples.TranslationWithAudioStreamAsync().Wait();
                    break;

                case ConsoleKey.A:
                    SpeechRecognitionWithTokenSample.ContinuousRecognitionWithAuthorizationTokenAsync().Wait();
                    break;

                case ConsoleKey.B:
                    IntentRecognitionSamples.RecognitionWithMicrophoneAsync().Wait();
                    break;

                case ConsoleKey.C:
                    IntentRecognitionSamples.ContinuousRecognitionWithFileAsync().Wait();
                    break;

                case ConsoleKey.D:
                    IntentRecognitionSamples.RecognitionWithMicrophoneUsingLanguageAsync().Wait();
                    break;

                case ConsoleKey.D0:
                    Console.WriteLine("Exiting...");
                    break;

                default:
                    Console.WriteLine("Invalid input.");
                    break;
                }
                Console.WriteLine("\nRecognition done. Your Choice (0: Stop): ");
            } while (x.Key != ConsoleKey.D0);
        }