ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

Help / WLanguage / WLanguage functions / Mobile specific functions / Speech Synthesis functions
  • Operating mode
  • Application in the background: Specific case from Android 10
WINDEV
WindowsLinuxUniversal Windows 10 AppJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadIOS WidgetApple WatchMac CatalystUniversal Windows 10 App
Others
Stored procedures
Initializes the parameters of speech synthesis for the current application. You can initialize:
  • Only the language used (syntax 1).
  • All the voice characteristics via a SpeechSynthesisVoice variable (syntax 2).
Remark: The use of SpeechSynthesisInitialize is optional. The default parameters will be used if SpeechSynthesisReadText or SpeechSynthesisReadFile is called while the parameters of speech synthesis have not been specified in SpeechSynthesisInitialize.
Example
IF NOT SpeechSynthesisInitialize(NationToLanguage(Nation())) THEN
Error("Failure initializing the speech synthesis.", ErrorInfo())
END
Syntax

Initializing the language only Hide the details

<Result> = SpeechSynthesisInitialize(<Language> [, <Speed>])
<Result>: Boolean
  • True if the initialization was performed,
  • False in case of failure. In this case, the ErrorOccurred variable is set to True. To get more details on the error, use ErrorInfo.
<Language>: Integer or Integer constant
  • Language that will be used to read the text. If the specified language is not supported by the engine for speech synthesis, the function will return False and the first available language will be used according to the following sequence :
    • Language of the application (default language or language defined by Nation).
    • Language of the device
    • English
    • Default language of engine for speech synthesis.
  • 0 to use the current application language.
The available constants are as follows:
languageAfrikaansAfrikaans
languageAlbanianAlbanian
languageArabicArabic
languageArmenianArmenian
languageBelarusianBelorussian
languageBengaliBengali
languageBulgarianBulgarian
languageCatalanCatalan
languageChineseChinese
languageCroatianCroatian
languageCzechCzech
languageDanishDanish
languageDutchDutch
languageEnglishEnglish
languageEstonianEstonian
languageFinnishFinnish
languageFrenchFrench
languageGeorgianGeorgian
languageGermanGerman
languageGreekGreek
languageHebrewHebrew
languageHindiHindi
languageHungarianHungarian
languageIcelandicIcelandic
languageIndonesianIndonesian
languageItalianItalian
languageJapaneseJapanese
languageKoreanKorean
languageLatvianLatvian
languageLithuanianLithuanian
languageMacedonianMacedonian
languageNorwegianNorwegian
languagePolishPolish
languagePortuguesePortuguese
languagePunjabiPunjabi
languageRomanianRomanian
languageRussianRussian
languageSerbianSerbian
languageSindhiSindhi
languageSlovakSlovakian
languageSlovenianSlovenian
languageSpanishSpanish
languageSwedishSwedish
languageThaiThai
languageTurkishTurkish
languageUkrainianUkrainian
languageUzbekUzbek
languageVietnameseVietnamese
<Speed>: Optional integer
Speed for reading the text, included between 0 (very slow) and 10 (very fast). If this parameter is not specified, its value will be set to 5 (average speed).
Universal Windows 10 App This parameter is ignored. The reading speed can be defined in the parameters of the mobile device used ("Parameters .. Time and language .. Voice").

Initializing all the voice characteristics Hide the details

<Result> = SpeechSynthesisInitialize(<Voice> [, <Speed>])
<Result>: Boolean
  • True if the initialization was performed,
  • False in case of failure. In this case, the ErrorOccurred variable is set to True. To get more details on the error, use ErrorInfo.
<Voice>: SpeechSynthesisVoice variable
Name of the SpeechSynthesisVoice variable to be used for reading the text.
<Speed>: Optional integer
Speed for reading the text, included between 0 (very slow) and 10 (very fast). If this parameter is not specified, its value will be set to 5 (average speed).
Universal Windows 10 App This parameter is ignored. The reading speed can be defined in the parameters of the mobile device used ("Parameters .. Time and language .. Voice").
Remarks

Operating mode

  • AndroidAndroid Widget If no engine for speech synthesis is installed on the device, its download will be automatically proposed.
    If the language to be used for speech synthesis is not the system language, this language must be specified in Android's "Text-to-speech Engine" settings. In "Language", replace "Use system language" with the desired language.
  • To synthesize a character string or a text file, use SpeechSynthesisReadText and SpeechSynthesisReadFile respectively.
  • Universal Windows 10 App Only the engine for speech synthesis corresponding to the default system language is installed. To install another engine for speech synthesis, use the parameter of the device ("Parameters .. Time and language .. Language").
  • AndroidAndroid Widget Speech synthesis functions are only available on devices with Android 1.6 or higher (API level 4).
    A fatal error occurs if the function is used with an earlier system version.
    To determine the version of Android the application is running on, use SysAndroidVersion.
  • iPhone/iPadIOS WidgetMac Catalyst Speech synthesis functions are only available on devices with iOS 7 and higher. The speech synthesis does not operate on the iOS 8 emulators.
Universal Windows 10 App Required application feature
When this function is used, an application feature is declared in the application generation wizard.
Required feature: Microphone: This feature allows the applications to perform audio recordings.
AndroidAndroid Widget

Application in the background: Specific case from Android 10

From Android 10, it is no longer possible to open a window when the application is in the background.
SpeechSynthesisInitialize can open a window. If this function is used while the application is in the background, a fatal error will occur.
Tips:
  • It is possible to determine if the application is in the background using InBackgroundMode.
  • If an application needs to interact with the user while it is in the background, the solution is to display a notification (via the Notification type). The application will be brought back to the foreground when the notification is clicked, if the ActivateApplication property is set to True. You can also open a window from the procedure passed to the ActionClick property.
Business / UI classification: UI Code
Component: wd290android.aar
Minimum version required
  • Version 17
This page is also available for…
Comments
Click [Add] to post a comment

Last update: 05/26/2022

Send a report | Local help