IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)

TextToSpeech QML Type

The TextToSpeech type provides access to text-to-speech engines.

Article lu   fois.

L'auteur

Liens sociaux

Viadeo Twitter Facebook Share on Google+   

TextToSpeech QML Type

  • Import Statement: import QtTextToSpeech

Detailed Description

Use say() to start synthesizing text, and stop(), pause(), and resume() to control the reading of the text.

The list of voices the engine supports for the current language is returned by availableVoices(). Change the language using the locale property, using one of the availableLocales() that is a good match for the language that the input text is in, and for the accent of the desired voice output. This will change the list of available voices on most platforms. Then use one of the available voices in the voice property.

Which locales and voices the engine supports depends usually on the Operating System configuration. E.g. on macOS, end users can install voices through the Accessibility panel in System Preferences.

Property Documentation

 

engine : string

The engine used to synthesize text to speech.

Changing the engine stops any ongoing speech.

On most platforms, changing the engine will update the list of available locales and available voices.

locale : locale

This property holds the current locale in use.

By default, the system locale is used.

See Also

See also voice

pitch : double

This property hold the voice pitch, ranging from -1.0 to 1.0.

The default of 0.0 is the normal speech pitch.

rate : double

This property holds the current voice rate, ranging from -1.0 to 1.0.

The default of 0.0 is the normal speech flow.

state : enumeration

This property holds the current state of the speech synthesizer.

See Also

See also QTextToSpeech::State, say(), stop(), pause()

voice : Voice

This property holds the voice that will be used for the speech.

The voice needs to be one of the voices available for the engine.

On some platforms, setting the voice changes other voice attributes such as locale, pitch, and so on. These changes trigger the emission of signals.

volume : double

This property holds the current volume, ranging from 0.0 to 1.0.

The default value is the platform's default volume.

Signal Documentation

 

void errorOccured(enumeration reason, string errorString)

This signal is emitted after an error occurred and the state has been set to TextToSpeech.Error. The reason parameter specifies the type of error, and the errorString provides a human-readable error description.

The corresponding handler is onErrorOccured.

See Also

See also state, errorReason(), errorString()

Method Documentation

 

list<string> availableEngines()

Holds the list of supported text-to-speech engine plug-ins.

list<Voice> availableLocales()

Holds the list of locales that are supported by the active engine.

list<Voice> availableVoices()

Holds the list of voices available for the current locale.

enumeration errorReason()

Returns the reason why the engine has reported an error.

See Also

string errorString()

Returns the current engine error message.

pause(BoundaryHint boundaryHint)

Pauses the current speech at boundaryHint.

Whether the boundaryHint is respected depends on the engine.

See Also

resume()

Resume speaking after pause() has been called.

See Also

See also pause()

say(string text)

Starts synthesizing the text.

This function starts sythesizing the speech asynchronously, and reads the text to the default audio output device.

All in-progress readings are stopped before beginning to read the recently synthesized text.

The current state is available using the state property, and is set to QTextToSpeech::Speaking once the reading starts. When the reading is done, state will be set to QTextToSpeech::Ready.

See Also

See also stop(), pause(), resume()

stop(BoundaryHint boundaryHint)

Stops the current reading at boundaryHint.

The reading cannot be resumed. Whether the boundaryHint is respected depends on the engine.

See Also

Vous avez aimé ce tutoriel ? Alors partagez-le en cliquant sur les boutons suivants : Viadeo Twitter Facebook Share on Google+