forked from Azure-Samples/cognitive-services-speech-sdk
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Program.cs
140 lines (134 loc) · 6.88 KB
/
Program.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
//
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE.md file in the project root for full license information.
//
using System;
using System.Threading.Tasks;
using Microsoft.CognitiveServices.Speech;
namespace MicrosoftSpeechSDKSamples
{
class Program
{
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.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.D0:
Console.WriteLine("Exiting...");
break;
default:
Console.WriteLine("Invalid input.");
break;
}
Console.WriteLine("\nExecution done. " + prompt);
} while (x.Key != ConsoleKey.D0);
}
}
}