Struct ibm_watson::tts::TextToSpeech[][src]

pub struct TextToSpeech { /* fields omitted */ }
Expand description

Defines text to speech options.

Implementations

Creates a new text to speech options and sets headers based on IamAuthenticator.

Arguments
  • auth - a reference to IamAuthenticator to use, ideally of the same language as the query.
  • service_url - your IBM Watson TTS endpoint.
Examples
let tts_service_url = String::from("https://my.service.url/foobar");
let auth = IamAuthenticator::new("{myapikey}");
let mut tts = TextToSpeech::new(
                &auth,
                tts_service_url,
              );

Changes the voice (from the default).

Arguments
Examples
tts.set_voice(AvailableVoices::en_US_OliviaV3);

Returns the String equivalent of the current AvailableVoices set on the current options.

Examples
println!("{}", tts.current_voice());

Returns a Vec of all the Voices IBM Watson has.

Examples
let voices = tts.voices().await?;
for i in &voices {
   println!("{}", i.name);
}

Returns details about a selected voice from

Examples
let olivia = tts.voice(AvailableVoices::en_US_OliviaV3).await?;
println!("{:#?}", olivia);

Returns a stream of bytes containing synthesised text.

Arguments
  • utterance - text to synthesise.
  • format - audio format to return.
Examples
let synth_bytes = tts.synthesise_text(
                        "This is just fantastic",
                        AudioFormats::default()
                  ).await?;
tts.set_voice(AvailableVoices::en_US_LisaV3);
let synth_bytes = tts.synthesise_text(
                        "I have changed the voice",
                        AudioFormats::AudioWav
                  ).await?;

Gets the phonetic pronunciation for the specified word. You can request the pronunciation for a specific format. You can also request the pronunciation for a specific voice to see the default translation for the language of that voice or for a specific custom model to see the translation for that model.

Arguments
  • utterance - text to synthesise.
  • format - audio format to return.
Examples
let options = PronunciationOptions::new(
                PhonemeFormat::default(),
                "ça va",
                AvailableVoices::fr_FR_Renee,
              );
let pronunciation = tts.pronunciation(&options).await?;
println!("{}", pronunciation);

Trait Implementations

The base URL for your service instance.

Additional headers to use in your request.

Enable Data collection (IBM Cloud), Text to Speech service instances managed on IBM Cloud that are not part of Premium plans collect data about API requests and their results.

Disable Data collection (IBM Cloud).

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more

Instruments this type with the current Span, returning an Instrumented wrapper. Read more

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more