Managing speech synthesis directly with the synthesizer

Last reviewed: 7/8/2022

HOW Article ID: H072204

The information in this article applies to:

  • SpeechKit 11

Summary

Optimize speech synthesis apps by managing the synthesizer directly in applications.

More Information

A speech synthesizer converts text to speech and produces audio bytes for playback or persistence. In addition, events are generated to indicate processing states.

The Microsoft Speech API (SAPI5) runtime is part of Windows that provides application control of the playback and processing of the audio bytes and events of a synthesizer. It optionally provides audio streaming playback and time-sequenced event posting. Microsoft includes synthesizers in many Windows SKUs.

Synthesizers from other speech technology vendors typically render the audio bytes and events but rely on applications and/or SAPI5 to handle playback and event processing. Some support the Microsoft runtime and all provide their own proprietary speech API with SDK and runtimes.

SpeechKit provides common speech synthesis management for multiple application scenarios across the various speech technology APIs by managing speech synthesis directly with the synthesizer.

SpeechKit includes libraries for the following Speech APIs for speech synthesis:

Speech APIPlatforms
Apple AVFoundationARM, x64, x86
Cepstral Swiftx64, x86
CereProc CereVoicex64, x86
Google android.speech.ttsARM
Microsoft SAPI 5x64, x86
Microsoft Speech Platformx64, x86
Microsoft .NET System.Speechx64, x86
Microsoft .NET Microsoft.Speechx64, x86
Microsoft WindowsMedia (UWP)ARM, x64, x86
Microsoft WindowsMedia (WinRT)x86, x64

Libraries for the most popular synthesizer speech APIs are included in Chant Developer Workbench. For additional libraries that support different APIs, runtimes, versions, and vendors contact Chant Support.

SpeechKit supports speech synthesis with playback or persistence with a single request.


// Create Synthesizer
_Synthesizer = _SpeechKit.createAndroidSynthesizer();

// Synthesize speech for playback
_Synthesizer.speak("Hello world.");

To know the progress or state of speech synthesis, the application processes event callbacks.


public class MainActivity extends AppCompatActivity implements com.speechkit.JChantSpeechKitEvents 
{
        ...
        // Set the callback object
        _Synthesizer.setChantSpeechKitEvents(this);
        // Register for callbacks
        _Synthesizer.registerCallback(ChantSpeechKitCallback.CCTTSInitComplete);
        ...
    @Override
    public void initComplete(Object o, TTSEventArgs ttsEventArgs)
    {
        if (_Synthesizer.getChantEngines() != null)
        {
            for (JChantEngine engine : _Synthesizer.getChantEngines())
            {
                // Add name to list
                _Engines.add(engine.getName());
            }
        }
        ...
    }
}

To control basic properties of how the synthesis occurs, some synthesizers support property settings.


// No properties