Text-to-speech
The AppFramework provides a Speech QML plug-in for text-to-speech functionality that enables applications created with AppStudio to support accessibility features such as text-to-speech with voice modulation. This TextToSpeech component can be used to provide audio feedback to end users, including aid for visually-impaired users and providing information when the user isn't looking at their device. To use this functionality, you must first include the following import statement:
Convert text to speech
The core of the TextToSpeech component is the say
method, which converts submitted text into a spoken statement. The following code sample demonstrates it in use, reading the contents of a text area when a button is clicked:
Voice modification
The voice produced by the TextToSpeech component can be controlled by modifying the volume
, pitch
, and rate
properties of the component. Each of these properties is stored as a double-precision integer (one decimal point), with the default value being 50. The following code sample provides a slider for the volume
property: