ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

This content has been translated automatically.  Click here  to view the French version.
Help / WLanguage / WLanguage functions / Mobile specific functions / Speech Synthesis functions
  • Operating mode
  • Application in the background: Specific case from Android 10
WINDEV
WindowsLinuxJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadIOS WidgetApple WatchMac Catalyst
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).
Note: Use of SpeechSynthesisInitialize is not mandatory.. 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("Echec de l'initialisation de la synthèse vocale.", 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).

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).
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.
  • 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 work on the iOS 8 emulators.
AndroidAndroid Widget

Application in the background: Specific case from Android 10

Starting with 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: wd300android.aar
Minimum version required
  • Version 17
This page is also available for…
Comments
Click [Add] to post a comment

Last update: 03/27/2025

Send a report | Local help