Vocalizer class

ru.yandex.speechkit

public  class  Vocalizer 

Class for single sessions of speech synthesis.

Vocalizer is responsible for sending text to the server and vocalizing synthesized speech. For event notification, Vocalizer uses the VocalizerListener interface.

Methods

voidcancel()

Cancels the speech synthesis process.

VocalizercreateVocalizer(String language, String text, boolean autoPlay)

Creates a single-use object that converts text to speech.

StringgetVersion()

Returns the library version.

voidonPlayingBeginInternal()
voidonPlayingDoneInternal()
voidonSynthesisBeginInternal()
voidonSynthesisDoneInternal(Synthesis synthesis)
voidonVocalizerErrorInternal(final Error error)
voidplay()

Launches the speech synthesis process.

voidrelease()

Frees up resources dedicated to vocalizing text.

voidsetListener(VocalizerListener listener)

Specifies the object that will be passed messages about speech synthesis events.

voidstart()

Launches the speech synthesis process.

Method descriptions

cancel

public void cancel ()

Cancels the speech synthesis process.

If autoPlay is set to true, it interrupts vocalization of synthesized speech.

createVocalizer

public static Vocalizer createVocalizer (String language, String text, boolean autoPlay)

Creates a single-use object that converts text to speech.

Parameters:
language

The recognition language in BCP 47 format: http://en.wikipedia.org/wiki/IETF_language_tag. In BCP 47 format, the language is indicated using the language code in ISO 639 format, followed by a dash (-), followed by the country code in ISO 3166-1 format. At this time, only ru-RU is supported.

text

The text to convert to speech.

autoPlay

Flag indicating whether synthesized text will be vocalized immediately by SpeechKit library resources. Possible values: true — "vocalize immediately", false — "do not vocalize". If the value of autoPlay is false, audio can be received as a parameter of the VocalizerListener.onSynthesisDone call for the VocalizerListener class, or played later using internal SpeechKit resources (by calling Vocalizer.play()).

Returns:

Instance of the Vocalizer class for vocalizing text with the specified parameters.

getVersion

public static String getVersion ()

Returns the library version.

onPlayingBeginInternal

public void onPlayingBeginInternal ()

onPlayingDoneInternal

public void onPlayingDoneInternal ()

onSynthesisBeginInternal

public void onSynthesisBeginInternal ()

onSynthesisDoneInternal

public void onSynthesisDoneInternal (Synthesis synthesis)

onVocalizerErrorInternal

public void onVocalizerErrorInternal (final Error error)

play

public void play ()

Launches the speech synthesis process.

This method must be called if autoPlay is set to true.

release

public void release ()

Frees up resources dedicated to vocalizing text.

setListener

public void setListener (VocalizerListener listener)

Specifies the object that will be passed messages about speech synthesis events.

Parameters:
listener

Object that will receive callbacks.

start

public void start ()

Launches the speech synthesis process.