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.

Nested classes

Methods

voidcancel()

Interrupts the process of speech synthesis and vocalizing the synthesized speech.

VocalizercreateVocalizer(String language, String text, boolean autoPlay)

Creates a single-use object that performs text vocalization (using the voice JANE).

VocalizercreateVocalizer(String language, String text, boolean autoPlay, String voice)

Creates a single-use object that performs text vocalization using the selected voice.

StringgetVersion()

Returns the library version.

voidplay()

Launches the speech synthesis process.

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 ()

Interrupts the process of speech synthesis and vocalizing the synthesized speech.

createVocalizer

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

Creates a single-use object that performs text vocalization (using the voice JANE).

Parameters:
language

The recognition language in BCP 47 format. 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.

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 autoPlay value is set to false, audio can be received as a parameter of the VocalizerListener.onSynthesisDone call for the VocalizerListener class, or played back later using SpeechKit's internal resources (by calling Vocalizer.play()).

Returns:

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

createVocalizer

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

Creates a single-use object that performs text vocalization using the selected voice.

Parameters:
language

The recognition language in BCP 47 format. 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.

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 autoPlay value is set to false, audio can be received as a parameter of the VocalizerListener.onSynthesisDone call for the VocalizerListener class, or played back later using SpeechKit's internal resources (by calling Vocalizer.play()).

voice

Voice (see the Vocalizer.Voice class).

Returns:

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

getVersion

public static String getVersion ()

Returns the library version.

play

public void play ()

Launches the speech synthesis process.

This method should be called if autoPlay is set to false.

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.