Last reviewed: 12/15/2024 8:59:41 AM
Windows Desktop (WinUI) Applications
Develop Windows Desktop (WinUI) 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 VoiceXMLKit with Windows Desktop (WinUI) applications.
VoiceXMLKit Assemblies
VoiceXMLKit 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 VoiceXMLKit .NET classes within a WPF application, add project references with the following nuget package:
- Select the application project in the Solution Explorer
- Right-click the mouse and select the Manage Nuget Packages… menu item.
- Enter Chant in the search bar.
- Select the Chant.VoiceXMLKit.Windows package and press the Install button.
To access the VoiceXMLKIt .NET classes within your application, add references to the Chant shared and VoiceXMLKIt assemblies in your code.
using System;
...
using Chant.VoiceXMLKit.Windows;
using Chant.Shared.Windows;
Object Instantiation
Declare variables for the VoiceXMLKit classes, instantiate instance, add the event handlers, and set the credentials.
private NVoiceXMLKit _VoiceXMLKit = null;
private NSAPI5VoiceXML _VoiceXML = null;
private NSAPI5Recognizer _Recognizer = null;
private NSAPI5Synthesizer _Synthesizer = null;
public MainWindow()
{
InitializeComponent();
// Instantiate VoiceXMLKit object
_VoiceXMLKit = new NVoiceXMLKit();
if (_VoiceXMLKit != null)
{
// Set credentials
_VoiceXMLKit.SetCredentials("Credentials");
// Create VoiceXML
_VoiceXML = _VoiceXMLKit.CreateSAPI5VoiceXML();
// Create recognizer
_Recognizer = _VoiceXMLKit.CreateSAPI5Recognizer();
// Create synthesizer
_Synthesizer = _VoiceXMLKit.CreateSAPI5Synthesizer();
// Register for the events
if (_VoiceXML != null)
{
_VoiceXML.Done += VoiceXML_Done;
_VoiceXML.CompileError += VoiceXML_CompileError;
_VoiceXML.DlgAddChoice += VoiceXML_DlgAddChoice;
_VoiceXML.DlgClearChoices += VoiceXML_DlgClearChoices;
_VoiceXML.DlgClearText += VoiceXML_DlgClearText;
_VoiceXML.DlgCreateDialog += VoiceXML_DlgCreateDialog;
_VoiceXML.DlgHideChoices += VoiceXML_DlgHideChoices;
_VoiceXML.DlgHideDialog += VoiceXML_DlgHideDialog;
_VoiceXML.DlgHideText += VoiceXML_DlgHideText;
_VoiceXML.DlgSelectChoice += VoiceXML_DlgSelectChoice;
_VoiceXML.DlgSetPrompt += VoiceXML_DlgSetPrompt;
_VoiceXML.DlgSetText += VoiceXML_DlgSetText;
_VoiceXML.DlgShowChoices += VoiceXML_DlgShowChoices;
_VoiceXML.DlgShowDialog += VoiceXML_DlgShowDialog;
_VoiceXML.DlgShowText += VoiceXML_DlgShowText;
}
}
}
Event Callbacks
Event callbacks are the mechanism in which the class object sends information back to the application such as compilation is complete, dialog state, or there was an error.
private void VoiceXML_Done(object sender, VxmlDoneEventArgs e)
{
if ((e != null) && (e.Variables != null))
{
...
}
}
Package.appxmanifest Capablities
If the application requires speech recognition, it requires use of the microphone. If it uses cloud-based speech technologies, it requires Internet (client) capabilities. Select Internet and Microphone under Package.appxmanifest Capabilities in Visual Studio or add the following to the Package.appxmanifest file:
<Capabilities>
<rescap:Capability Name="runFullTrust" />
<Capability Name="internetClient"/>
<DeviceCapability Name="microphone"/>
</Capabilities>
Platform Target
Set the project Platform target to either x86 for 32-bit application or x64 for 64-bit application as follows:
Within your C# project
- Select the Build tab under project properties.
- Select x86 or x64 in the Platform target dropdown list.
These applications require the applicable VoiceMarkUpKit Speech API library in the same directory (AppX) as the application .exe.
| Speech API | VoiceXMLKit Speech API class | VoiceXMLKit Speech API library |
|---|---|---|
| Microsoft SAPI 5 | CSAPI5Recognizer or CSAPI5Synthesizer | CVoiceXMLKit.SAPI5.dll or CVoiceXMLKitX64.SAPI5.dll |
| Microsoft Speech Platform | CMSPRecognizer or CMSPSynthesizer | CVoiceXMLKit.MSP.dll or CVoiceXMLKitX64.MSP.dll |
Development and Deployment Checklist
When developing and deploying Windows Application (WinUI) applications, ensure you have a valid license, bundle the correct Chant class libraries, and configure your installation properly on the target system.
Review the following checklist before developing and deploying applications targeting Microsoft SAPI5 and Micosoft Speech Platform speech technologies:
- Develop and deploy Windows Desktop (WinUI) applications to any system with a valid license from Chant. See the section License for more information about licensing Chant software.
- Copy Chant.VoiceXMLKit.Windows.dll and Chant.Shared.Windows.dll assemblies to the target system or merge them with your application using an obfuscator like .NET Reactor by Eziriz.
- Copy applicable 32-bit VoiceXMLKit Speech API DLL(s) to the target system and place in the same directory with your application.
-
Copy NVoiceXMLKit.dll to the target system,
- register as a COM library on the target system, or
-
place in the same directory with Windows Desktop (WinUI) application and include an App.manifest with a dependent assembly declaration:
<dependency> <dependentAssembly> <assemblyIdentity type="win32" name="Chant.VoiceXMLKit.Windows" version="8.0.0.0" publicKeyToken="4d55ff7f44d3f866" /> </dependentAssembly> </dependency>
- Develop and deploy Windows Desktop (WinUI) applications to any system with a valid license from Chant. See the section License for more information about licensing Chant software.
- Copy Chant.VoiceXMLKit.Windows.dll and Chant.Shared.Windows.dll assemblies to the target system or merge them with your application using an obfuscator like .NET Reactor by Eziriz.
- Copy applicable 64-bit VoiceXMLKit Speech API DLL(s) to the target system and place in the same directory with your application.
-
Copy NVoiceXMLKitX64.dll to the target system,
- register as a COM library on the target system, or
-
place in the same directory with Windows Desktop (WinUI) application and include an App.manifest with a dependent assembly declaration:
<dependency> <dependentAssembly> <assemblyIdentity type="win32" name="Chant.VoiceXMLKit.Windows" version="8.0.0.0" publicKeyToken="4d55ff7f44d3f866" /> </dependentAssembly> </dependency>
Sample Projects
Windows desktop sample projects are installed at the following location:
- No samples available for this release.