Qt TextToSpeech Engines

Qt TextToSpeech supports several engine implementations for different platforms, and with different tradeoffs between capabilities, availability, and runtime cost.

An engine can be selected when a QTextToSpeech instance is constructed, or on an already instantiated object by setting the engine property. If no engine is specified, the preferred engine for the current platform will be used. Call availableEngines() to get the list of engines that can be used on the current system. This will include a "mock" engine that is used for testing, and that should not be deployed to target systems.

When setting the engine, applications can pass a QVariantMap with key/value pairs of engine specific parameters through to the engine. The following sections list the configuration parameters supported for each engine. Parameters that are not supported by the engine will be silently ignored.

WinRT

The "winrt" engine uses the APIs from the Windows.Media.SpeechSynthesis Namespace. It requires a recent Windows SDK, and is not available when using the MinGW compiler. The engine provides access to all voices available for installation on current Windows versions.

The implementation uses QAudioSink from Qt Multimedia to play the PCM data stream generated by the synthesizer to an audio device.

NameTypeRemarks
audioDeviceQAudioDevice

SAPI

The "sapi" engine uses the SAPI 5.3 framework that is included in the Windows SDK. It provides a limited selection of voices, with reduced quality compared to the "winrt" engine.

The SAPI engine does not support any engine specific parameters.

Darwin

The "darwin" engine uses the AVFoundation framework that is available on iOS devices and on macOS 10.15. The documentation of the framework states support for macOS 10.14 as well, but by default no voices are available on that platform.

The Darwin engine does not support any engine specific parameters.

macOS

The "macos" engine uses the NSSpeechDispatcher framework from AppKit. It is only available on macOS systems, but works out of the box on macOS 10.14. The number of available voices is limited compared to the iOS engine.

The macOS engine does not support any engine specific parameters.

Android

The "android" engine is the only engine available on the Android platform. It uses the TextToSpeech package, which in turn supports multiple engine backends.

NameTypeRemarks
androidEngineQStringThere is no API in Qt to get the list of installed engines.

Flite

The "flite" engine uses the flite synthesizer. The engine's small footprint makes it particularly useful for embedded environments. The plugin requires at least Flite 2.2, and uses QAudioSink from Qt Multimedia to render the generated PCM data stream.

The engine plugin searches for voice libraries in the directories listed in the LD_LIBRARY_PATH environment variable, and falls back to search common library locations such as /usr/lib, /usr/lib64, and /usr/lib/x86_64-linux-gnu.

If Flite is used as a static library, then the desired voice libraries also need to be statically linked into the engine plugin. There is currently not build system API implemented for selecting such voice libraries when configuring Qt.

NameTypeRemarks
audioDeviceQAudioDevice

speech-dispatcher

The "speechd" engine communicates with the speech-dispatcher daemon, and requires at least libspeechd 0.9.

The speech-dispatcher engine does not support any engine specific parameters.

© 2023 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.