I regularly demonstrate how to use the Microsoft Azure Cognitive Services and tried to find a way how to send a microphone input stream directly to the Language Understanding Service (LUIS).
So.. here it is. Feel free to use it, any feedback (or pull request) is welcome!
The client is a WPF App (.NET Core), the main entry point can be found in the MainViewModel.cs
public async Task InitializeAsync()
{
this.speechRecognizer.SpeechStateChanged += SpeechRecognizer_SpeechStateChanged;
this.speechRecognizer.IntentRecognized += SpeechRecognizer_IntentRecognized;
await this.speechRecognizer.StartAsync();
}
Alternatively you can use an overload of the StartAsync
method to provide a pre-recorded file instead of the microphone input.
await this.speechRecognizer.StartAsync("C:\temp.wav");
Please specify your Subscription key, your LUIS App Id and the Azure region in the appsettings.json file:
{
"SpeechRecognizerSettings": {
"SubscriptionKey": "xxx",
"Region": "westeurope",
"LuisAppId": "yyy"
}
}