Last reviewed: 7/27/2024 8:55:07 AM

Chant Audio Search

Chant Audio Search enables applications to find the time offsets for specific words, phrases, and subphrases in audio recordings.

Audio Search Methods

There are two types of audio searches supported: transcription and word spotting.

With transcription searches, an audio recording is transcribed first. Then one or more searches may be performed with simple string or Regular Expression pattern search terms. Matches are returned as offsets in seconds.

With word spotting searches, the audio is word spotted with a list of keywords (i.e., single words or phrases) first. Then one or more searches may be performed to match a keyword originally used in the word spotting. Matches are returned as offsets in seconds.


// Instantiate AudioSearch
NAudioSearch _AudioSearch = new NAudioSearch();
if (_AudioSearch != null)
{
    // Set credentials
    _AudioSearch.SetCredentials("Credentials");
    NSAPI5Recognizer _Recognizer = _AudioSearch.CreateSAPI5Recognizer();
    if (_Recognizer != null)
    {
        _Recognizer.Transcribe("myaudio.wav");
        int type = (int)ChantAudioSearchType.ASTPhrase; 
        int options = (int)ChantAudioSearchOption.ASOExactMatch; 
        // Get time offsets in seconds ss.mmm
        List<double> results = _Recognizer.Find("grocery", type, options);
        ...
        _Recognizer.WordSpot("myaudio.wav", "grocery, gas station, post office, bank");
        // Get time offsets in seconds ss.mmm
        results = _Recognizer.Find("grocery");
    }
}

// Instantiate AudioSearch object
CAudioSearch* _AudioSearch = new CAudioSearch();
if (_AudioSearch =! NULL)
{
    // Set credentials
    _AudioSearch->SetCredentials(L"Credentials");
    // Create recognizer
    CSAPI5Recognizer* _Recognizer = _AudioSearch->CreateSAPI5Recognizer();
    if (_Recognizer != NULL)
    {
        _Recognizer->Transcribe(L"myaudio.wav");
        int type = ASTPhrase; 
        int options = ASOExactMatch; 
        // Get time offsets in seconds ss.mmm
        vector<double> results = _Recognizer->Find(L"grocery", type, options);
        ...
        _Recognizer->WordSpot(L"myaudio.wav", L"grocery, gas station, post office, bank");
        // Get time offsets in seconds ss.mmm
        results = _Recognizer->Find(L"grocery");
    }
}

// Instantiate AudioSearch object
CAudioSearch* _AudioSearch = new CAudioSearch();
if (_AudioSearch =! NULL)
{
    // Set credentials
    _AudioSearch->SetCredentials("Credentials");
    // Create recognizer
    CSAPI5Recognizer* _Recognizer = _AudioSearch->CreateSAPI5Recognizer();
    if (_Recognizer != NULL)
    {
        _Recognizer->Transcribe("myaudio.wav");
        int type = ASTPhrase; 
        int options = ASOExactMatch; 
        // Get time offsets in seconds ss.mmm
        vector<double> results = _Recognizer->Find("grocery", type, options);
        ...
        _Recognizer->WordSpot("myaudio.wav", "grocery, gas station, post office, bank");
        // Get time offsets in seconds ss.mmm
        results = _Recognizer->Find("grocery");
    }
}

var
  _AudioSearch: TAudioSearch;
  _Recognizer: TSAPI5Recognizer;
  results: TList<Double>
  findType: Integer;
  findOptions: Integer;
begin
    // Instantiate AudioSearch object
    _AudioSearch := TAudioSearch.Create();
    if (_AudioSearch <> nil) then
    begin
        // Set credentials
        _AudioSearch.SetCredentials('Credentials');
        // Create recognizer
        _Recognizer := _AudioSearch.CreateSAPI5Recognizer();
        if (_Recognizer <> nil) then
        begin
            _Recognizer.Transcribe('myaudio.wav');
            findType = ASTPhrase; 
            findOptions = ASOExactMatch; 
            // Get time offsets in seconds ss.mmm
            results = _Recognizer.Find('grocery', findType, findOptions);
            ...
            _Recognizer.WordSpot('myaudio.wav', 'grocery, gas station, post office, bank');
            // Get time offsets in seconds ss.mmm
            results = _Recognizer.Find('grocery');
        end;
    end;
end;

// Create AudioSearch object
JAudioSearch _AudioSearch = new JAudioSearch();
// Set credentials
_AudioSearch.setCredentials("Credentials");
JSAPI5Recognizer _Recognizer = _AudioSearch.createSAPI5Recognizer();
if (_Recognizer != null)
{
        _Recognizer.transcribe("myaudio.wav");
        int type = ChantAudioSearchType.ASTPhrase; 
        int options = ChantAudioSearchOption.ASOExactMatch; 
        // Get time offsets in seconds ss.mmm
        ArrayList<Double> results = _Recognizer.find("grocery", type, options);
        ...
        _Recognizer.wordSpot("myaudio.wav", "grocery, gas station, post office, bank");
        // Get time offsets in seconds ss.mmm
        results = _Recognizer.find("grocery");
}

Dim _AudioSearch As NAudioSearch
Dim _Recognizer As NSAPI5Recognizer
Dim results As List(Of Double)
Dim type As Integer
Dim options As Integer
    ' Instantiate AudioSearch
    _AudioSearch = New NAudioSearch()
    If (_AudioSearch IsNot Nothing) Then
        ' Set credentials
        _AudioSearch.SetCredentials("Credentials")
        _Recognizer = _AudioSearch.CreateSAPI5Recognizer()
        If (_Recognizer IsNot Nothing) Then
            _Recognizer.Transcribe("myaudio.wav")
            type = ChantAudioSearchType.ASTPhrase
            options = ChantAudioSearchOption.ASOExactMatch
            // Get time offsets in seconds ss.mmm
            results = _Recognizer.Find("grocery", type, options)
            ...
            _Recognizer.WordSpot("myaudio.wav", "grocery, gas station, post office, bank")
            // Get time offsets in seconds ss.mmm
            results = _Recognizer.Find("grocery")
        End If
    End If

Syntax Options

The Transcribe method has one parameter:

  • filepath - The file path.

The Find method for transcriptions has three parameters:

  • terms - One or more comma-separated search phrases or a RegEx search expession.
  • type - ChantAudioSearchType constant.
  • options - ChantAudioSearchOption constant.

The WordSpot method has two parameters:

  • filepath - The file path.
  • keywords - One or more comma-separated search phrases.

The Find method forword spotting has one parameter:

  • keyword - A search phrase.

Syntax Helpers

The search type value may be specified with one of ChantAudioSearchType constants:

  • ASTPhrase
  • ASTRegEx

The search options may be specified with one or more ChantAudioSearchOption constants:

  • ASOPartialMatch
  • ASOExactMatch
  • ASOCaseSensitive

Recognizer objects may be one of the support SpeechKit classes as follows:

Speech API SpeechKit Speech API class SpeechKit Speech API library
Microsoft SAPI 5 (transcription and word spot)xSAPI5RecognizerCSpeechKit.SAPI5.dll or CSpeechKitX64.SAPI5.dll
Microsoft Speech Platform (word spot only)xMSPRecognizerCSpeechKit.MSP.dll or CSpeechKitX64.MSP.dll
Nuance Dragon NaturallySpeaking (transcription only)xDgnRecognizerCSpeechKit.Dgn.dll or CSpeechKitX64.Dgn.dll

where x is C for C++Builder and C++; T for Delphi; J for Java; and N for .NET.

Development and Deployment

Audio Search applications require the Audio Search library and the applicable SpeechKit Speech API library:

To access the Audio Search C++Builder classes within your application, first add a project reference to the C++Builder header include files:

  • Within your C++Builder project, select Project Options.
  • Select the C++Builder compiler options.
  • Add Include path reference to the Audio Search header files directory: C:\Program Files\Chant\AudioSearch 5\CBuilder\include.
  • For 64-bit apps, add Win64 as a conditional to the compiler options.

To access the Audio Search C++Builder classes within your application, add a reference to the Audio Search header files in your C++Builder application header file.

#include "Chant.AudioSearch.h"

Add a reference in your C++Builder application source file to the Audio Search code needed to dynamically load and unload the runtime DLL.

#include "Chant.AudioSearch.cpp"

When developing and deploying C++Builder VCL and FireMonkey applications, ensure you have a valid license, bundle the correct Chant class library, and configure your installation properly on the target system. Review the following checklist before developing and deploying your applications:

  • Develop and deploy C++Builder VCL and FireMonkey applications to any system with a valid license from Chant. See the section License for more information about licensing Chant software.
  • Copy CAudioSearch.dll (CAudioSearchX64.dll) to the target system and place in the same directory with your application.
  • Copy applicable 32-bit (64-bit) SpeechKit Speech API DLL(s) to the target system and place in the same directory with your application.

To access Audio Search C++ classes within a Visual C++ application, add project references to the following nuget packages:

  • 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.AudioSearch.Windows package and press the Install button.
  • Chant Audio Search Windows package

To access the Audio Search C++ classes within your application, add a reference to the Audio Search header files in your C++ application header file:

#include "Chant.AudioSearch.Windows.h"

Add a reference in your C++ application source file to the Audio Search code needed to dynamically load and unload the runtime DLL:

#include "Chant.AudioSearch.Windows.cpp"

When developing and deploying C++ applications, ensure you have a valid license, bundle the correct Chant class library, and configure your installation properly on the target system. Review the following checklist before developing and deploying your applications:

  • Develop and deploy C++Builder VCL and FireMonkey applications to any system with a valid license from Chant. See the section License for more information about licensing Chant software.
  • Copy CAudioSearch.dll (CAudioSearchX64.dll) to the target system and place in the same directory with your application.
  • Copy applicable 32-bit (64-bit) SpeechKit Speech API DLL(s) to the target system and place in the same directory with your application.

To access the Audio Search Object Pascal classes within your application, first add a project reference to the Audio Search Object Pascal source files:

  1. Within your Delphi project, select Project Options.
  2. Select the Delphi compiler options.
  3. Add Search path reference to the Audio Search unit source file directory: C:\Program Files\Chant\AudioSearch 5\Delphi\source.
  4. Add unit output path reference to the local directory with a period '.' character.

To access the Audio Search Object Pascal classes within your application, add a reference to the Chant.AudioSearch units in your uses clause.

unit Unit1;

interface

uses
  ..., Chant.AudioSearch;

When developing and deploying Delphi VCL and FireMonkey applications, ensure you have a valid license, bundle the correct Chant class library, and configure your installation properly on the target system. Review the following checklist before developing and deploying your applications:

  • Develop and deploy Delphi VCL and FireMonkey applications to any system with a valid license from Chant. See the section License for more information about licensing Chant software.
  • Copy CAudioSearch.dll (CAudioSearchX64.dll) to the target system and place in the same directory with your application.
  • Copy applicable 32-bit (64-bit) SpeechKit Speech API DLL(s) to the target system and place in the same directory with your application.

To access the Audio Search Java classes within your application, add the class libraries to your JDK environment:

  1. copy the JAudioSearch.DLL (JAudioSearchX64.DLL) file to your Java JDK bin directory;
  2. copy the applicable 32-bit (64-bit) speech API DLL file(s) to your Java JDK bin directory;
  3. copy the audiosearch.jar library to your Java JDK lib; and
  4. append a path reference for your Java JDK lib\audiosearch.jar path as a classpath property in your system settings.

To access the Audio Search Java classes within your application, add references to the Audio Search class libraries in your code:

import com.audiosearch.*;

When developing and deploying Java 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 your applications:

  • Develop and deploy Java applications to any system with a valid license from Chant. See the section License for more information about licensing Chant software.
  • Copy audiosearch.jar to the target system Java JRE lib directory and/or ensure the classpath includes the path where the audiosearch.jar library is placed on your target system.
  • Copy JAudioSearch.dll (JAudioSearchX64.dll) to the target system Java JRE bin directory.
  • Copy applicable 32-bit (64-bit) SpeechKit Speech API DLL(s) to the target system Java JRE bin directory.

To access Audio Search .NET classes, 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.
  • Select the Chant.AudioSearch.Windows package and press the Install button.
  • Chant Audio Search Windows package

To access the Audio Search .NET classes within applications, add references to the Audio Search assemblies in your code.

using System;
...
using Chant.AudioSearch.Windows;

or

Imports Chant.AudioSearch.Windows
Class MainWindow
...

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 your applications:

  • 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.AudioSearch.Windows.dll assembly to the target system or merge them with your application using an obfuscator like .NET Reactor by Eziriz.
  • Copy applicable 32-bit (64-bit) SpeechKit Speech API DLL(s) to the target system and place in the same directory with your application.
  • Copy NAudioSearch.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.AudioSearch.Windows" version="5.0.0.0" publicKeyToken="b7bf58a6a1b083a7" />
          </dependentAssembly>
      </dependency>
      

Sample Projects

Sample projects are installed at the following location:

C++Builder VCL and FireMonkey sample projects are installed at the following location:

  • Documents\Chant\AudioSearch 5\CBuilder.

Microsoft Visual C++ sample projects that use nuget packages may be found in the following directory of the vssamples.zip download:

  • Chant\AudioSearch 5\CDLL.

Delphi VCL and FireMonkey sample projects are installed at the following location:

  • Documents\Chant\AudioSearch 5\Delphi.

Java sample projects are installed at the following location:

  • Documents\Chant\AudioSearch 5\Java.

.NET sample projects that use nuget packages may be found in the following directory of the vssamples.zip download:

  • Chant\AudioSearch 5\NET\Windows\cs and
  • Chant\AudioSearch 5\NET\Windows\vb.