Skip to content

Text to Speech

Eliran Wong edited this page May 27, 2022 · 15 revisions

Text-to-Speech Feature

UBA users can access text-to-speech through right-click context menu, Master Control "Miscellaneous" tab and Note Editor "Text Utility" toolbar.

Text-to-speech Engines

Unique Bible App supports four different text-to-speech engines or modules. Two of them requires internet connection and two of them does not.

Online Text-to-speech engines:

  1. Google Cloud Text-to-speech service - personal credential required (see below); nice voices with support of many languages; voice setup is not required; support speed adjustment and mp3 file export. Read more at https://cloud.google.com/text-to-speech

  2. Python gTTS package - UBA installs this package for users on startup; no setup is required; support mp3 file export. However, this package does not support speed adjustment. Read more at https://pypi.org/project/gTTS/

Offline Text-to-speech engines:

  1. Espeak - online tts engine for Linux users; support speed adjustment and multiple languages; setup is required, e.g. https://github.com/eliranwong/ChromeOSLinux/blob/main/multimedia/espeak.md

  2. QTextToSpeech - support multiple languages on Windows and macOS; setup of non-default voices is required; support speed adjustment. However, its behaviour varies across different platforms. In addition, it does not support mp3 file export.

Setup of Google Cloud Text-to-speech

Google Cloud Text-to-speech offers more features than the rest of the engines UBA supports. However, it requires extra steps for setup:

  1. Create a credential key for Google Cloud text-to-speech service and download it. Read for details at https://cloud.google.com/text-to-speech/docs/before-you-begin

  2. Rename the credential key file to "credentials_GoogleCloudTextToSpeech.json"

  3. Place the credential key file "credentials_GoogleCloudTextToSpeech.json" in UniqueBibleApp folder.

If "credentials_GoogleCloudTextToSpeech.json" is in place, UBA uses Google Cloud Text-to-speech engine automatically.

Config flags

We added a config flag "useLangDetectOnTts" in version 21.77, It is set to False by default, because the feature is not always reliable. - Turning it on will use python module "langdetect" to detect language on selected text when user uses "Speak" feature from right-click context menu. - Turning it off will use Default Text-to-Speech language specified by user.

There are several other config flags related to text-to-speech features.

You may open "Set Config Flags" Window and hover related flags and read description from tooltips.

Specify Default Text-to-Speech Language:

Default Text-to-Speech Language applies to "Speak" feature from right-click context menu, if config flag "useLangDetectOnTts" is set to False.

Default text-to-speech language is configurable via Focus menu layout: UniqueBible > Language Settings > Text-to-Speech Language

espeak for Linux users

Qt text-to-speech engine is used for running text-to-speech feature in UBA. Linux users can have an extra option to use espeak.

You may read the following link about setup of espeak (some languages, e.g. Chinese & Russian, need an extra step for installation):

https://github.com/eliranwong/ChromeOSLinux/blob/main/multimedia/espeak.md

Changing Text-to-Speech Language on Miscellaneous Tab

From version 21.78, changing text-to-speech language on Master Control Miscellaneous tab changes default text-to-speech language.

Therefore, users can allow quickly change the default text-to-speech language by calling Miscellaneous tab with keyboard shortcut Ctrl+M.

Adjust speed

You can adjust speed via Master Control Miscellaneous tab.

Multi-line Editing

You can make use of multi-line editor in note editor and text-to-speech features together.

Clone this wiki locally