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.
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.
Name | Type | Remarks |
---|---|---|
audioDevice | QAudioDevice |
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.
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.
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.
The "android" engine is the only engine available on the Android platform. It uses the TextToSpeech package, which in turn supports multiple engine backends.
Name | Type | Remarks |
---|---|---|
androidEngine | QString | There is no API in Qt to get the list of installed engines. |
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.
Name | Type | Remarks |
---|---|---|
audioDevice | QAudioDevice |
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.
As part of the free Business evaluation, we offer a free welcome call for companies, to talk about your requirements, and how the Felgo SDK & Services can help you. Just sign up and schedule your call.
Sign up now to start your free Business evaluation: