Skip to content

Instantly share code, notes, and snippets.

@codemillmatt
Last active April 24, 2020 22:05
Show Gist options
  • Save codemillmatt/38f815bf585586a9fd507d76d32b4896 to your computer and use it in GitHub Desktop.
Save codemillmatt/38f815bf585586a9fd507d76d32b4896 to your computer and use it in GitHub Desktop.
How to start up the speech recognizer
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