Last reviewed: 7/27/2024 10:43:31 AM

.NET Windows Forms Applications

Develop .NET Windows Forms applications that manage voice marupkit using your favorite .NET Windows Forms development tools. This includes development environments such as Microsoft Visual C# .NET and Microsoft Visual Basic .NET.

The following sections describe the steps for integrating VoiceMarkupKit with .NET Windows Forms applications.

VoiceMarkupKit Assemblies

VoiceMarkupKit includes Windows Forms compatible .NET assemblies for .NET Framework and .NET to support your application's target framework. If you need a specific target framework, then contact Chant Product Support.

To generate markup within a Windows Forms application, add project references to the following nuget packages depending on desired speech APIs:

  • 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.
  • For W3C SSML:
    • Select the Chant.VoiceMarkupKit package and press the Install button.
  • Chant VoiceMarkupKit package
  • For Acapela Tag, Azure SSML, CereVoice, Microsoft SAPI5 XML, and W3C SSML:
    • Select the Chant.VoiceMarkupKit.Windows package and press the Install button.
  • Chant VoiceMarkupKit Windows package

To access the VoiceMarkupKit .NET classes within applications that generate Acapela Tag, Azure SSML, CereVoice, Microsoft SAPI5 XML, and W3C SSML, add references to the Chant shared and VoiceMarkupKit assemblies in your code.


using System;
...
using Chant.VoiceMarkupKit.Windows;
using Chant.Shared.Windows;

Imports Chant.VoiceMarkupKit.Windows
Imports Chant.Shared.Windows
Class MainWindow
...

To access the VoiceMarkupKit .NET classes within applications that generate W3C SSML, add references to the Chant shared and VoiceMarkupKit assemblies in your code.


using System;
...
using Chant.VoiceMarkupKit;
using Chant.Shared;

Imports Chant.VoiceMarkupKit
Imports Chant.Shared
Class MainWindow
...

Platform Target

Set the project Platform target to either x86 for 32-bit application or x64 for 64-bit application as follows:

For applications that require the applicable VoiceMarkupKit Speech API Library, set the project Platform target to either x86 for 32-bit application or x64 for 64-bit application as follows:

Within your C# project

  1. Select the Build tab under project properties.
  2. Select x86 or x64 in the Platform target dropdown list.

Within your VB .NET Project

  1. Select the Compile tab under project properties.
  2. Press the Advanced Compile Options... button.
  3. Select x86 or x64 in the Target CPU dropdown list.

Object Instantiation

Declare a global variable for the VoiceMarkupKit class, instantiate an instance, add the event handler, and set the credentials.


private NVoiceMarkupKit _VoiceMarkupKit = null;
private NAcaTTSVoiceMarkup _AcaTTSVoiceMarkup = null;
private NCereVoiceVoiceMarkup _CereVoiceVoiceMarkup = null;
private NSAPI5VoiceMarkup _SAPI5VoiceMarkup = null;
private NW3CSSMLVoiceMarkup _W3CSSMLVoiceMarkup = null;
public MainWindow()
{
    InitializeComponent();
    // Instantiate VoiceMarkupKit object
    _VoiceMarkupKit = new NVoiceMarkupKit();
    if (_VoiceMarkupKit != null)
    {
        // Set credentials
        _VoiceMarkupKit.SetCredentials("Credentials");
        // Create VoiceMarkups
        _AcaTTSVoiceMarkup = _VoiceMarkupKit.CreateAcaTTSVoiceMarkup();
        _CereVoiceVoiceMarkup = _VoiceMarkupKit.CreateCereVoiceVoiceMarkup();
        _SAPI5VoiceMarkup = _VoiceMarkupKit.CreateSAPI5VoiceMarkup();
        _W3CSSMLVoiceMarkup = _VoiceMarkupKit.CreateW3CVoiceMarkup();
    }
}

Dim _VoiceMarkupKit As NVoiceMarkupKit = Nothing
Dim _AcaTTSVoiceMarkup As NAcaTTSVoiceMarkup = Nothing
Dim _CereVoiceVoiceMarkup As NCereVoiceVoiceMarkup = Nothing
Dim _SAPI5VoiceMarkup As NSAPI5VoiceMarkup = Nothing
Dim _W3CSSMLVoiceMarkup As NW3CSSMLVoiceMarkup = Nothing
Private Sub Window_Loaded(ByVal sender As System.Object, ByVal e As System.Windows.RoutedEventArgs)
' Instantiate VoiceMarkupKit object
_VoiceMarkupKit = New NVoiceMarkupKit()
If (_VoiceMarkupKit IsNot Nothing) Then
' Set credentials
_VoiceMarkupKit.SetCredentials("Credentials")
' Create VoiceMarkups
_AcaTTSVoiceMarkup = _VoiceMarkupKit.CreateAcaTTSVoiceMarkup()
_CereVoiceVoiceMarkup = _VoiceMarkupKit.CreateCereVoiceVoiceMarkup()
_SAPI5VoiceMarkup = _VoiceMarkupKit.CreateSAPI5VoiceMarkup()
_W3CSSMLVoiceMarkup = _VoiceMarkupKit.CreateW3CVoiceMarkup()
End If
...
End Sub

Event Callbacks

There are no event callbacks in VoiceMarkupKit.

Development and Deployment Checklist

When developing and deploying .NET 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 that generate Acapela Tag, Azure SSML, CereVoice, Microsoft SAPI5 XML, and W3C SSML:

  • Develop and deploy .NET applications to any system with a valid license from Chant. See the section License for more information about licensing Chant software.
  • Copy Chant.VoiceMarkupKit.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 NVoiceMarkupKit.dll to the target system,
    • register as a COM library on the target system, or
    • place in the same directory with .NET application and include an App.manifest with a dependent assembly declaration:
      
      <dependency>
          <dependentAssembly>
                  <assemblyIdentity type="win32" name="Chant.VoiceMarkupKit.Windows" version="10.0.0.0" publicKeyToken="75ad107bb2bd35e7" />
          </dependentAssembly>
      </dependency>
      
  • Develop and deploy .NET applications to any system with a valid license from Chant. See the section License for more information about licensing Chant software.
  • Copy Chant.VoiceMarkupKit.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 NVoiceMarkupX64.dll to the target system,
    • register as a COM library on the target system, or
    • place in the same directory with .NET application and include an App.manifest with a dependent assembly declaration:
      
      <dependency>
          <dependentAssembly>
                  <assemblyIdentity type="win32" name="Chant.VoiceMarkupKit.Windows" version="10.0.0.0" publicKeyToken="75ad107bb2bd35e7" />
          </dependentAssembly>
      </dependency>
      

Review the following checklist before developing and deploying applications that generate W3C SSML:

  • Develop and deploy .NET applications to any system with a valid license from Chant. See the section License for more information about licensing Chant software.
  • Copy Chant.VoiceMarkupKit.dll and Chant.Shared.dll assemblies to the target system or merge them with your application using an obfuscator like .NET Reactor by Eziriz.