How do I use WindowsMedia speech recognition and synthesis via WinRT?
Last reviewed: 2/20/2021
HOW Article ID: H022102
The information in this article applies to:
- Chant Developer Workbench 2020
- SpeechKit 9
- Talk&Listen
Summary
Chant Developer Workbench 2020, SpeechKit 9, and Talk&Listen support WindowsMedia speech recognition and speech synthesis on Windows 10 for desktop (x86 and x64) applications via WinRT (Windows Runtime). WindowsMedia provides a rich suite of voice models and voices to listen and speak in most any language.
More Information
Chant tools and libraries provide application access to Microsoft WindowsMedia speech technologies for UWP applications and desktop (x86 and x64) applications via WinRT.
WindowsMedia provides a rich suite of voice models and voices to listen and speak in most any language.
Microsoft WindowsMedia is preinstalled. You must add required languages to the platform for speech services to be available in those languages.
To test WindowsMedia speech recognition in desktop (x86 and X64) Chant Developer Workbench, use the following steps:
- Select View->Speech Recognizers menu item to display the recognizer browser.
- Select the Microsoft WindowsMedia Speech Recognition in the Speech API dropdown.
- Select a speech recognizer from the speech engine dropdown.
- Select the vocabulary options including Dictation Vocabularies, Command lists, and Grammar files.
- Press the Start button to activate the recognizer and begin speaking.
- Monitor speech recognition progress in the Events window.
- Press the Stop button to deactivate the recognizer.
![Test WindowsMedia speech recognition in the Developer Workbench Speech Recognizer Browser](/images/cdw2020windowsmediaSR.png)
To test WindowsMedia speech synthesis in desktop (x86 and X64) Chant Developer Workbench, use the following steps:
- Select View->Speech Synthesizers menu item to display the synthesizer browser.
- Select the Microsoft WindowsMedia Speech Synthesis in the Speech API dropdown.
- Select a voice from the speech engine dropdown.
- Enter the text to synthesize.
- Press the Start button to synthesize speech.
- Monitor speech synthesis progress in the Events window.
![Test WindowsMedia speech synthesis in the Developer Workbench Speech Synthesizer Browser](/images/cdw2020windowsmediatts.png)
To access the SpeechKit .NET WinRT classes within an application, add them to the project References:
- Within a .NET project, right click on the References node in the Solution Explorer.
-
Add references to the Chant shared and SpeechKit .NET WinRT assemblies:
- Program Files\Chant\SpeechKit 9\WinRT\lib\Chant.SpeechKit.WinRT.WindowsMedia.dll and
- Program Files\Chant\SpeechKit 9\WinRT\lib\Chant.Shared.WinRT.WindowsMedia.dll.
To access the SpeechKit .NET WinRT classes within an application, add references to the Chant shared and SpeechKit assemblies in the code.
using System;
...
using Chant.SpeechKit.WinRT.WindowsMedia;
using Chant.Shared.WinRT.WindowsMedia;
Imports Chant.SpeechKit.WinRT.WindowsMedia
Imports Chant.Shared.WinRT.WindowsMedia
Public NotInheritable Class MainPage
...
Declare variables for the SpeechKit class, instantiate instance, add the event handlers, and set the license properties.
private NSpeechKit _SpeechKit = null;
private NWindowsMediaRecognizer _Recognizer = null;
private NWindowsMediaSynthesizer _Synthesizer = null;
public MainPage()
{
this.InitializeComponent();
_SpeechKit = new NSpeechKit();
if (_SpeechKit != null)
{
// Set license properties
//_SpeechKit.SetLicense("LicenseRegistrationNumber", "LicenseSerialNumber");
// Else for evaluation, set only evaluation serial number
_SpeechKit.SetLicense(string.Empty, "EvaluationSerialNumber");
_Recognizer = _SpeechKit.CreateWindowsMediaRecognizer();
if (_Recognizer != null)
{
_Recognizer.RecognitionCommand += this.Recognizer_RecognitionCommand;
}
_Synthesizer = _SpeechKit.CreateWindowsMediaSynthesizer();
}
Public NotInheritable Class MainPage
Inherits Page
Dim _SpeechKit As NSpeechKit
Dim WithEvents _Recognizer As NWindowsMediaRecognizer
Dim WithEvents _Synthesizer As NWindowsMediaSynthesizer
Private Sub Page_Loaded(sender As Object, e As RoutedEventArgs)
' Instantiate SpeechKit
_SpeechKit = New NSpeechKit()
If (_SpeechKit IsNot Nothing) Then
' Set license properties
'_SpeechKit.SetLicense("LicenseRegistrationNumber", "LicenseSerialNumber")
' Else, for evaluation, set only evaluation serial number
_SpeechKit.SetLicense(String.Empty, "EvaluationSerialNumber")
_Recognizer = _SpeechKit.CreateWindowsMediaRecognizer()
_Synthesizer = _SpeechKit.CreateWindowsMediaSynthesizer()
End If
End Sub
End Class
To access the Talk&Listen .NET WinRT classes within an application, add references to the Chant shared and SpeechKit assemblies in the code.
using System;
...
using Chant.TalkListen.WinRT.WindowsMedia;
using Chant.Shared.WinRT.WindowsMedia;
Imports Chant.TalkListen.WinRT.WindowsMedia
Imports Chant.Shared.WinRT.WindowsMedia
Public NotInheritable Class MainPage
...
Declare variables for the Talk&Listen class, instantiate instance and set the license properties.
// Instantiate TalkListen
NTalkListen _TalkListen = new NTalkListen();
if (_TalkListen != null)
{
// Set license properties
//_TalkListen.SetLicense("LicenseRegistrationNumber", "LicenseSerialNumber");
// Else, for evaluation, set only evaluation serial number
_TalkListen.SetLicense(string.Empty, "EvaluationSerialNumber");
NWindowsMediaSynthesizer _Synthesizer = _TalkListen.CreateWindowsMediaSynthesizer();
if (_Synthesizer != null)
{
_Synthesizer.Talk("This is the easiest way to synthesize.");
}
NWindowsMediaRecognizer _Recognizer = _TalkListen.CreateWindowsMediaRecognizer();
if (_Recognizer != null)
{
string recognitionResults = _Recognizer.Listen();
}
}
Dim _TalkListen As NTalkListen
Dim _Recognizer As NWindowsMediaRecognizer
Dim _Synthesizer As NWindowsMediaSynthesizer
Dim resultsResults As String
' Instantiate TalkListen
_TalkListen = New NTalkListen()
If (_TalkListen IsNot Nothing) Then
' Set license properties
'_TalkListen.SetLicense("LicenseRegistrationNumber", "LicenseSerialNumber")
' Else, for evaluation, set only evaluation serial number
_TalkListen.SetLicense(String.Empty, "EvaluationSerialNumber")
_Synthesizer = _TalkListen.CreateWindowsMediaSynthesizer()
If (_Synthesizer IsNot Nothing) Then
_Synthesizer.Talk("This is the easiest way to synthesize.")
End If
_Recognizer = _TalkListen.CreateWindowsMediaRecognizer()
If (_Recognizer IsNot Nothing) Then
resultsResults = _Recognizer.Listen()
End If
End If