Last active
April 24, 2020 22:05
-
-
Save codemillmatt/38f815bf585586a9fd507d76d32b4896 to your computer and use it in GitHub Desktop.
How to start up the speech recognizer
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using Microsoft.CognitiveServices.Speech; // this is the namespace of the speech to text stuff | |
SpeechRecognizer recognizer; // this is a class level variable | |
public async Task StartTranscription() | |
{ | |
if (recognizer == null) | |
{ | |
var config = SpeechConfig.FromSubscription("<PUT YOUR KEY HERE>", "westus"); | |
recognizer = new SpeechRecognizer(config); | |
recognizer.Recognized += Recognizer_Recognized; | |
} | |
if (isRecognizing) | |
return; | |
await recognizer.StartContinuousRecognitionAsync(); | |
isRecognizing = true; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment