TextToSpeech QML Type

Controls text-to-speech functionality. More...

Import Statement: import ArcGIS.AppFramework.Speech 1.0

Properties

Signals

Methods

Detailed Description

This code sample demonstrates usage of the TextToSpeech component. On pressing the "Say it" button, the text written into the text field will be read by the app, with the system default age and gender and a set volume and speech rate.

Item {
        TextField {
                id: text
                anchors.centerIn: parent
                text: qsTr("Put Some Text Here")
        }

        Button {
                text:  qsTr ("Say it")
                onClicked: {
                        textToSpeech.say(text.text)
                        console.log(textToSpeech.voice.gender)
                }
        }

        TextToSpeech {
                id: textToSpeech
                volume: 0.7
                rate: 0.3
        }
}

Enumerations

State enumeration

Enum describing the possible playback states of the text-to-speech reading. Informs the State property, and the stateChanged enum.

NameValue
TextToSpeech.Ready0
TextToSpeech.Speaking1
TextToSpeech.Paused2
TextToSpeech.BackendError3

Property Documentation

[read-only] availableLocales : QStringList

Returns a list of available locales to use.


[read-only] availableVoices : List<Voice>

Returns a list of available voices to use.


locale : string

The locale code of the region, used to determine how words are pronounced.


pitch : double

The pitch of the reading. This property ranges from -1.0 to 1.0, with 0.0 being normal speech pitch.


rate : double

Sets the speech rate. This property ranges from -1.0 to 1.0, with 0.0 being normal speech flow.


[read-only] state : State

The current playback state of the text-to-speech reading. Uses the State enum.


voice : Voice

The voice used for the text-to-speech reading. This is controlled by the Voice component.


volume : double

The volume of the text-to-speech reading. This is represented as a value between 0 and 1, with the default being 1 (full volume).


Signal Documentation

pitchChanged(double)

Signal emitted when the pitch of the reading has changed.

Note: The corresponding handler is onPitchChanged.


rateChanged(double)

Signal emitted when the speech rate has changed.

Note: The corresponding handler is onRateChanged.


stateChanged(State state)

Signal emitted when the playback state of the text-to-speech reading has changed. Uses the State enum.

Note: The corresponding handler is onStateChanged.


volumeChanged(double)

Signal emitted when the volume of the text-to-speech has changed.

Note: The corresponding handler is onVolumeChanged.


Method Documentation

pause()

Pauses the current text-to-speech reading.


resume()

Resumes the text-to-speech reading if it has been paused.


say(string text)

Reads the provided text string.

The text parameter

The string of text to be read.


stop()

Stops the text-to-speech reading.


Your browser is no longer supported. Please upgrade your browser for the best experience. See our browser deprecation post for more details.