Last reviewed: 3/23/2024 10:28:36 AM

Windows Desktop Applications

Develop Windows Desktop applications that speak and listen using your favorite Windows App SDK development tools. This includes development environments such as Microsoft Visual Studio.

The following sections describe the steps for integrating SpeechKit with Windows Desktop applications.

SpeechKit Assemblies

SpeechKit includes Windows App SDK compatible .NET assemblies to support most applications' target framework. If you need a specific target framework, then contact Chant Product Support.

To access the SpeechKit classes within your Windows Desktop application, add them to your project References:

  • Within your project, right click on the Dependencies node in the Solution Explorer.

  • Add references to the Chant shared and SpeechKit assemblies:

    1. Program Files\Chant\SpeechKit 13\NET\libv6.0\Chant.SpeechKit.Windows.dll and
    2. Program Files\Chant\SpeechKit 13\NET\libv6.0\Chant.Shared.Windows.dll.

    or

    1. Program Files\Chant\SpeechKit 13\NET\libv7.0\Chant.SpeechKit.Windows.dll and
    2. Program Files\Chant\SpeechKit 13\NET\libv7.0\Chant.Shared.Windows.dll.

    or

    1. Program Files\Chant\SpeechKit 13\NET\libv8.0\Chant.SpeechKit.Windows.dll and
    2. Program Files\Chant\SpeechKit 13\NET\libv8.0\Chant.Shared.Windows.dll.

To access the SpeechKit .NET classes within your application, add references to the Chant shared and SpeechKit assemblies in your code.


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

These applications require the applicable SpeechKit Speech API library and speech recognition grammar files in the same directory (AppX) as the application .exe.

Speech API SpeechKit Speech API class SpeechKit Speech API library
Acapela TTSCAcaTTSSynthesizerCSpeechKit.AcaTTS.dll or CSpeechKitX64.AcaTTS.dll
Cepstral SwiftCSwiftSynthesizerCSpeechKit.Swift.dll or CSpeechKitX64.Swift.dll
CereProc CereVoiceCCereVoiceSynthesizerCSpeechKit.CereVoice.dll or CSpeechKitX64.CereVoice.dll
Microsoft SAPI 5CSAPI5Recognizer or CSAPI5SynthesizerCSpeechKit.SAPI5.dll or CSpeechKitX64.SAPI5.dll
Microsoft Speech PlatformCMSPRecognizer or CMSPSynthesizerCSpeechKit.MSP.dll or CSpeechKitX64.MSP.dll
Microsoft WindowsMedia (WinRT C++)CChantRecognizer or CChantSynthesizerCSpeechKit.WinRT.dll or CSpeechKitX64.WinRT.dll
Microsoft WindowsMedia (WinRT C++)CWindowsMediaRecognizer or CWindowsMediaSynthesizerCSpeechKit.WinRT.dll or CSpeechKitX64.WinRT.dll
Nuance Dragon NaturallySpeakingCDgnRecognizerCSpeechKit.Dgn.dll or CSpeechKitX64.Dgn.dll

Object Instantiation

Declare variables for the SpeechKit classes, instantiate instance, add the event handlers, and set the credentials.


private NSpeechKit _SpeechKit = null;
private NChantRecognizer _Recognizer = null;
private NChantSynthesizer _Synthesizer = null;
public MainWindow()
{
    InitializeComponent();
    // Instantiate SpeechKit
    _SpeechKit = new NSpeechKit();
    if (_SpeechKit != null)
    {
        // Set credentials
        _SpeechKit.SetCredentials("Credentials");
        _Recognizer = _SpeechKit.CreateChantRecognizer();
        if (_Recognizer != null)
        {
            _Recognizer.RecognitionCommand += this.Recognizer_RecognitionCommand;
        }
        _Synthesizer = _SpeechKit.CreateChantSynthesizer();
        if (_Synthesizer != null)
        {
            _Synthesizer.WordPosition += Synthesizer_WordPosition;
        }
    }
}

Event Callbacks

Event callbacks are the mechanism in which the class object sends information back to the application such as speech recognition occurred, audio playback finished, or there was an error.


private void Recognizer_RecognitionCommand(object sender, RecognitionCommandEventArgs e)
{
    if ((e != null) && (e.Phrase != null))
    {
        ...
    }
}

private void Synthesizer_WordPosition(object sender, WordPositionEventArgs e)
{
    if (e != null)
    {
        int startPosition = e.Position;
        int wordLength = e.Length;
        ...
    }
}

Package.appxmanifest Capablities

If the application requires speech recognition, it requires use of the microphone. Select Microphone under Package.appxmanifest Capabilities in Visual Studio or add the following to the Package.appxmanifest file:

<Capabilities>
    <DeviceCapability Name="microphone" />
</Capabilities>

Microphone Privacy Settings

If the application requires speech recognition, it requires use of the microphone. Set the Microphone usage to On for the app under Settings->Privacy->Microphone.

Speech Privacy Settings

If the application requires continuous speech recognition (dictation vocabulary), it needs to be enabled on the platform. Set the Speech Privacy usage to On for the system under Settings->Privacy->Speech.

Development and Deployment Checklist

When developing and deploying Windows Desktop applications, you need to ensure you have a valid license. See the section License for more information about licensing Chant software.

Sample Projects

Windows desktop sample projects are installed at the following location:

  • Documents\Chant\SpeechKit 13\WinUI\Windows\cs.