pylips.speech.PollyTTS

class pylips.speech.PollyTTS[source]

A text-to-speech backend that uses Amazon Polly.

This class is used to generate audio files from text using Amazon Polly. It can also generate visemes that correspond to the audio files that it generates.

Parameters

None

__init__()[source]

Methods

__init__()

gen_audio_and_visemes(text[, voice_id, fname])

Generates an audio file and visemes from a string of text using Amazon Polly.

get_audio_and_visemes(fname)

Loads presaved audio and visemes from a file.

list_voices()

Lists all the voices that are available in the Amazon Polly TTS backend.

gen_audio_and_visemes(text, voice_id=None, fname=None)[source]

Generates an audio file and visemes from a string of text using Amazon Polly.

Parameters
  • text (str) – the text that the robot should speak

  • voice_id (str) – the voice that the robot should speak in

  • fname (str) – the name of the file that the audio should be saved to

Returns

a tuple containing fname, times, and visemes. fname is the path to the audio file, times is a list of times that correspond to the initiation of the visemes, and visemes is a list of visemes that correspond to the words in the audio

Return type

(tuple)

get_audio_and_visemes(fname)[source]

Loads presaved audio and visemes from a file.

Parameters

fname (str) – the name of the file that the audio and visemes were saved to

Returns

a tuple containing fname, times, and visemes. fname is the path to the audio file, times is a list of times that correspond to the initiation of the visemes, and visemes is a list of visemes that correspond to the words in the audio

Return type

(tuple)

Raises

Exception – if the file does not exist

list_voices()[source]

Lists all the voices that are available in the Amazon Polly TTS backend.

For a more in-depth look at the voices, see the Amazon Polly documentation.

Parameters

None