Carrying on from my previous posts, I was able to add speech functionality into my Windows Phone 8 application to connect with the .NET Gadgeteer kit. At first I had programmed it like Rob Miles’ Voice Music application where you can begin a speech request by holding the Windows button until the speech command popped up. After I went to see him yesterday he explained that it was possible to call into the Speech Recognition API within my application rather than having to press the button. Not only does this allow for free speech but is what I was hoping to accomplish with the speech functionality.
So I quickly changed the functionality of my application to have a button on the test application to send speech to the .NET Gadgeteer kit over Bluetooth. The code itself is rather simple and can be done in a few lines as shown below:
private async void SendVoiceBtnTap(object sender, GestureEventArgs e)
var result = await _recognizer.RecognizeWithUIAsync();
The line reading “var result = await _recognizer.RecognizeWithUIAsync();” will launch the speech control which will begin listening like in the picture at the top of this post. Once you have said a command, you can either press go or stop talking and the application will process what was heard. Here I said “Hello” to the phone. It even recognised it!
The message was then sent to the .NET Gadgeteer kit over Bluetooth and popped up on the screen.
Sorry for the “square” symbols. I fixed this while I was at work yesterday before going to see Rob and realised I didn’t bring the updated solution back home with me… But there it is on the screen! My message. I don’t like how the phone adds a full stop to the end of the message after you’ve said it but that can easily be removed before transmitting the message.
Next job is to get Text-To-Speech working with commands sent back from the .NET Gadgeteer kit!