How Tos

Last reviewed: 2/20/2021

Article ID: H022102

HOW: Using WindowsMedia speech recognition and speech synthesis from Windows 10 desktop (x86 and x64) applications via WinRT

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

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

To access the SpeechKit .NET WinRT classes within an application, add them to the project References:

  1. Within a .NET project, right click on the References node in the Solution Explorer.
  2. Add references to the Chant shared and SpeechKit .NET WinRT assemblies:
    1. Program Files\Chant\SpeechKit 9\WinRT\lib\Chant.SpeechKit.WinRT.WindowsMedia.dll and
    2. 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;

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();
}

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;

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();
    }
}