How do I develop applications that do more with Microsoft WindowsMedia Speech Technology?

Last reviewed: 7/8/2021

HOW Article ID: H072113

The information in this article applies to:

  • Chant Developer Workbench 2021
  • GrammarKit 7
  • SpeechKit 10
  • Talk&Listen 2
  • VoiceMarkupKit 7

Summary

Chant Developer Workbench 2021, GrammarKit 7, SpeechKit 10, and VoiceMarkupKit 7 support WindowsMedia speech recognition and speech synthesis on Windows 10 for UWP applications, desktop (x86 and x64) C++, C++Builder, Delphi, Java, and .NET 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.

Chant Developer Workbench

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

Universal Windows Plaform (UWP) Apps

UWP applications access WindowsMedia speech technology via the Chant UWP class libraries.

  1. Within a UWP project, right click on the References node in the Solution Explorer.
  2. For GrammarKit apps, add references to the Chant shared and GrammarKit UWP assemblies:
    1. Program Files\Chant\GrammarKit 7\UWP\lib\Chant.Shared.WindowsMedia.dll and
    2. Program Files\Chant\GrammarKit 7\UWP\lib\Chant.GrammarKit.WindowsMedia.dll.
  3. For SpeechKit apps, add references to the Chant shared and SpeechKit UWP assemblies:
    1. Program Files\Chant\SpeechKit 10\UWP\lib\Chant.Shared.WindowsMedia.dll and
    2. Program Files\Chant\SpeechKit 10\UWP\lib\Chant.SpeechKit.WindowsMedia.dll.
  4. For VoiceMarkupKit apps, add references to the Chant shared and VoiceMarkupKit UWP assemblies:
    1. Program Files\Chant\VoiceMarkupKit 7\UWP\lib\Chant.Shared.WindowsMedia.dll and
    2. Program Files\Chant\VoiceMarkupKit 7\UWP\lib\Chant.VoiceMarkupKit.WindowsMedia.dll.

To access the Chant UWP classes within an application, add references to the Chant assemblies in the code.


using System;
...
using Chant.Shared.WindowsMedia;
using Chant.GrammarKit.WindowsMedia;
using Chant.SpeechKit.WindowsMedia;
using Chant.VoiceMarkupKitKit.WindowsMedia;

Imports Chant.Shared.WindowsMedia
Imports Chant.GrammarKit.WindowsMedia
Imports Chant.SpeechKit.WindowsMedia
Imports Chant.VoiceMarkupKit.WindowsMedia
Public NotInheritable Class MainPage
...

Desktop Windows (x86 and X64) Apps

Desktop (x86 and X64) C++, C++Builder, Delphi, Java, and .NET applications access WindowsMedia speech technology (via C++ WinRT) like any other Speech API and can easily switch among APIs as needed within the application.


using Chant.Shared.Windows;
using Chant.SpeechKit.Windows;

// Instantiate SpeechKit
NSpeechKit _SpeechKit = new NSpeechKit();
// Set license properties
_SpeechKit.SetLicense("LicenseRegistrationNumber", "LicenseSerialNumber");
// Create recognizer
NWindowsMediaRecognizer _Recognizer = _SpeechKit.CreateWindowsMediaRecognizer();
// Create synthesizer
NWindowsMediaSynthesizer _Synthesizer = _SpeechKit.CreateWindowsMediaSynthesizer();

// Instantiate SpeechKit
CSpeechKit* _SpeechKit = new CSpeechKit();
// Set license properties
_SpeechKit->SetLicense(L"LicenseRegistrationNumber", L"LicenseSerialNumber");
// Create recognizer
CWindowsMediaRecognizer* _Recognizer = _SpeechKit->CreateWindowsMediaRecognizer();
// Create synthesizer
CWindowsMediaSynthesizer* _Synthesizer = _SpeechKit->CreateWindowsMediaRecognizer();

// Instantiate SpeechKit
CSpeechKit* _SpeechKit = new CSpeechKit();
// Set license properties
_SpeechKit->SetLicense("LicenseRegistrationNumber", "LicenseSerialNumber");
// Create recognizer
CWindowsMediaRecognizer* _Recognizer = _SpeechKit->CreateWindowsMediaRecognizer();
// Create synthesizer
CWindowsMediaSynthesizer* _Synthesizer = _SpeechKit->CreateWindowsMediaRecognizer();

var 
    _SpeechKit: TSpeechKit;
    _Recognizer: TWindowsMediaRecognizer;
    _Synthesizer: TWindowsMediaSynthesizer;
begin
    // Instantiate SpeechKit
    _SpeechKit := TSpeechKit.Create();
    // Set license properties
    _SpeechKit.SetLicense('LicenseRegistrationNumber', 'LicenseSerialNumber');
    // Create recognizer
    _Recognizer := _SpeechKit.CreateWindowsMediaRecognizer();
    // Create synthesizer
    _Synthesizer := _SpeechKit.CreateWindowsMediaSynthesizer();

// Instantiate SpeechKit
JSpeechKit _SpeechKit = new JSpeechKit();
// Set license properties
_SpeechKit.setLicense("LicenseRegistrationNumber", "LicenseSerialNumber");
// Create recognizer
JWindowsMediaRecognizer _Recognizer = _SpeechKit.createWindowsMediaRecognizer();
// Create synthesizer
JWindowsMediaSynthesizer _Synthesizer = _SpeechKit.createWindowsMediaSynthesizer();

Imports Chant.Shared.Windows
Imports Chant.SpeechKit.Windows

Dim _SpeechKit As NSpeechKit
Dim WithEvents _Recognizer As NWindowsMediaRecognizer
' Instantiate SpeechKit
_SpeechKit = New NSpeechKit()
' Set license properties
_SpeechKit.SetLicense("LicenseRegistrationNumber", "LicenseSerialNumber")
' Create recognizer
_Recognizer = _SpeechKit.CreateWindowsMediaRecognizer()
' Create synthesizer
_Synthesizer = _SpeechKit.CreateWindowsMediaSynthesizer()

Desktop Windows .NET (x86 and X64) Apps

In addition, .NET desktop (x86 and X64) applications may alternatively access WindowsMedia speech technology via the .NET WinRT classes as follows.

  1. Within a .NET WinRT project, right click on the References node in the Solution Explorer.
  2. For GrammarKit apps, add references to the Chant shared and GrammarKit WinRT assemblies:
    1. Program Files\Chant\GrammarKit 7\NET\libvx.x\Chant.Shared.WinRT.WindowsMedia.dll and
    2. Program Files\Chant\GrammarKit 7\NET\libvx.x\Chant.GrammarKit.WinRT.WindowsMedia.dll.
  3. For SpeechKit apps, add references to the Chant shared and SpeechKit WinRT assemblies:
    1. Program Files\Chant\SpeechKit 10\NET\libvx.x\Chant.Shared.WinRT.WindowsMedia.dll and
    2. Program Files\Chant\SpeechKit 10\NET\libvx.x\Chant.SpeechKit.WinRT.WindowsMedia.dll.
  4. where x.x is 3.1, 4.6, or 5.0.

To access the Chant .NET WinRT classes within an application, add references to the Chant assemblies in the code.


using System;
...
using Chant.Shared.WinRT.WindowsMedia;
using Chant.GrammarKit.WinRT.WindowsMedia;
using Chant.SpeechKit.WinRT.WindowsMedia;

Imports Chant.Shared.WinRT.WindowsMedia
Imports Chant.GrammarKit.WinRT.WindowsMedia
Imports Chant.SpeechKit.WinRT.WindowsMedia
Public NotInheritable Class MainPage
...

Desktop (x86 and X64) .NET applications declare variables for the Chant class, instantiate instance, add the event handlers, and set the license properties the same way for both WinRT (.NET and C++) implementations.


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