Microsoft azure speech to text api9/3/2023 ![]() For information about continuous recognition for longer audio, including multi-lingual conversations, see How to recognize speech. This example uses the RecognizeOnceAsync operation to transcribe utterances of up to 30 seconds, or until silence is detected.Now that you've completed the quickstart, here are some additional considerations: RECOGNIZED: Text=I'm excited to try speech to text. ![]() What you speak should be output as text: Speak into your microphone. Speak into your microphone when prompted. If you don't set these variables, the sample will fail with an error message. Make sure that you set the SPEECH_KEY and SPEECH_REGION environment variables as described above. Run your new console application to start speech recognition from a microphone: dotnet run For details about how to identify one of multiple languages that might be spoken, see language identification. The default language is en-US if you don't specify a language. To change the speech recognition language, replace en-US with another supported language. OutputSpeechRecognitionResult(speechRecognitionResult) Var speechRecognitionResult = await speechRecognizer.RecognizeOnceAsync() Using var speechRecognizer = new SpeechRecognizer(speechConfig, audioConfig) Ĭonsole.WriteLine("Speak into your microphone.") Using var audioConfig = AudioConfig.FromDefaultMicrophoneInput() SpeechConfig.SpeechRecognitionLanguage = "en-US" Var speechConfig = SpeechConfig.FromSubscription(speechKey, speechRegion) Static void OutputSpeechRecognitionResult(SpeechRecognitionResult speechRecognitionResult)Ĭonsole.WriteLine($"RECOGNIZED: Text=") Ĭonsole.WriteLine($"CANCELED: Did you set the speech resource key and region values?") Static string speechRegion = Environment.GetEnvironmentVariable("SPEECH_REGION") Static string speechKey = Environment.GetEnvironmentVariable("SPEECH_KEY") This example requires environment variables named "SPEECH_KEY" and "SPEECH_REGION" Replace the contents of Program.cs with the following code. Install the Speech SDK in your new project with the. The Program.cs file should be created in the project directory. Open a command prompt where you want the new project, and create a console application with the. Recognize speech from a microphoneįollow these steps to create a new console application and install the Speech SDK. For example, westus.įor more configuration options, see the Xcode documentation. Set SPEECH_REGION to the region of your resource. To set the environment variable for your Speech resource region, follow the same steps. ![]()
0 Comments
Leave a Reply.AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |