Class OnlineVocalizer.Builder

ru.yandex.speechkit

public  class  OnlineVocalizer.Builder 

Class for creating and configuring OnlineVocalizer.

Methods

Builder(@NonNull final Language language, @Nullable final VocalizerListener listener)

Creates an object of the OnlineVocalizer.Builder class with mandatory settings.

OnlineVocalizerbuild()

Creates an object of the OnlineVocalizer class.

BuildersetAutoPlay(final boolean value)

Sets the flag of speech playback (after synthesis) through the embedded player.

BuildersetEmotion(@NonNull final Emotion emotion)

Sets the emotion of synthesized voice.

BuildersetQuality(@NonNull final Quality value)

Sets the quality of synthesized speech.

BuildersetRequestTimeoutMs(final long requestTimeout, @NonNull final java.util.concurrent.TimeUnit timeUnit)

Sets the maximum connection timeout after initiating a synthesis request.

BuildersetServerRequestVolume(final float value)

Sets the volume of synthesized speech.

BuildersetSoundFormat(@NonNull final SoundFormat value)

Specifies the audio format.

BuildersetSpeed(final float value)

Sets the speed of synthesized speech.

BuildersetSynthesisChunkTimeoutMs(final long chunkTimeout, @NonNull final java.util.concurrent.TimeUnit timeUnit)

Specifies the maximum time to wait for each audio fragment.

BuildersetUniProxySession(@NonNull final UniProxySession session)

Specifies an object of the UniProxySession class.

BuildersetVoice(@NonNull final Voice voice)

Sets the voice that will be used for synthesized speech.

StringtoString()

Method Detail

Builder

public Builder (@NonNull final Language language, @Nullable final VocalizerListener listener)

Creates an object of the OnlineVocalizer.Builder class with mandatory settings.

Parameters:
language

The language of the text for synthesis.

listener

Interface for notification of synthesis events.

build

public OnlineVocalizer build ()

Creates an object of the OnlineVocalizer class.

Returns:

An object of the OnlineVocalizer class with the passed parameters.

setAutoPlay

public Builder setAutoPlay (final boolean value)

Sets the flag of speech playback (after synthesis) through the embedded player.

Parameters:
value

Flag of speech playback (after synthesis) through the embedded player. Default value: true. Acceptable values: true - speech will be played after synthesis; false - speech will not be played. Playback can be started using the play() method.

Returns:

An object of the OnlineVocalizer.Builder class.

setEmotion

public Builder setEmotion (@NonNull final Emotion emotion)

Sets the emotion of synthesized voice.

Parameters:
emotion

Emotion of synthesized voice. Default value: NEUTRAL.

Returns:

An object of the OnlineVocalizer.Builder class.

setQuality

public Builder setQuality (@NonNull final Quality value)

Sets the quality of synthesized speech.

Parameters:
value

Quality of synthesized speech. Default value: ULTRA_HIGH.

Returns:

An object of the OnlineVocalizer.Builder class.

setRequestTimeoutMs

public Builder setRequestTimeoutMs (final long requestTimeout, @NonNull final java.util.concurrent.TimeUnit timeUnit)

Sets the maximum connection timeout after initiating a synthesis request.

Parameters:
requestTimeout

Maximum connection timeout after initiating a synthesis request. Default value: 5 seconds.

timeUnit

Specifies the requestTimeout units.

Returns:

An object of the OnlineVocalizer.Builder class.

setServerRequestVolume

public Builder setServerRequestVolume (final float value)

Sets the volume of synthesized speech.

Parameters:
value

The volume that will be used at speech synthesis (not to be confused with the playback volume). Default value: 1.

Returns:

An object of the OnlineVocalizer.Builder class.

setSoundFormat

public Builder setSoundFormat (@NonNull final SoundFormat value)

Specifies the audio format.

Parameters:
value

Audio format. Default value: OPUS.

Returns:

An object of the OnlineVocalizer.Builder class.

setSpeed

public Builder setSpeed (final float value)

Sets the speed of synthesized speech.

Parameters:
value

Speed of synthesized speech. Default value: 1.

Returns:

An object of the OnlineVocalizer.Builder class.

setSynthesisChunkTimeoutMs

public Builder setSynthesisChunkTimeoutMs (final long chunkTimeout, @NonNull final java.util.concurrent.TimeUnit timeUnit)

Specifies the maximum time to wait for each audio fragment.

Parameters:
chunkTimeout

Maximum time to wait for each audio fragment. Default value: 5 seconds.

timeUnit

Specifies the chunkTimeout units.

Returns:

An object of the OnlineVocalizer.Builder class.

setUniProxySession

public Builder setUniProxySession (@NonNull final UniProxySession session)

Specifies an object of the UniProxySession class.

Parameters:
session

An object of the UniProxySession class that will be used for a network connection. Default value: null.

Returns:

An object of the OnlineVocalizer.Builder class.

setVoice

public Builder setVoice (@NonNull final Voice voice)

Sets the voice that will be used for synthesized speech.

Parameters:
voice

Voice used for synthesized speech. Default value: JANE.

Returns:

An object of the OnlineVocalizer.Builder class.

toString

public String toString ()