harmoni_tts.aws_tts_service

Module Contents

Classes

AWSTtsService

Amazon tts service

Functions

main()

[summary]

class harmoni_tts.aws_tts_service.AWSTtsService(name, param)

Bases: harmoni_common_lib.service_manager.HarmoniServiceManager

Amazon tts service

tts_pub

Setup the tts request

_setup_aws_tts()

[summary] Setup the tts polly request, connecting to AWS services

_split_text(text)

[summary] Split long sentences :param text: Sentence to be synthetised :type text: str

Returns:

array which containes the part of the text splitted

Return type:

text_array (list)

_split_behaviors(s)

[summary] Split the text from the behaviors :param s: input text :type s: str

Returns:

list of splitted text and actions

Return type:

list

_get_text_and_actions(sentence)

[summary] Get text and actions from the sentence :param sentence: Input text before requesting :type sentence: str

Returns:

Get the text and the action

Return type:

(phrase, actions)

_get_behaviors(response, actions)

[summary] Processing the response from AWS Polly and get the behaviors :param response: Response from Polly service which contains information about word timing, duration, and visemes :type response: json :param actions: Collects the actions in the text (words into stars **: gesture and facial expressions) :type actions: json

Returns:

It contains all the data including words and actions information

Return type:

data (json)

_get_audio(response)

[summary] This function writes the audio file getting data from Polly :param response: response from amazon Polly for getting audio data :type response: obj

Returns:

audio data

Return type:

data

_get_response(behavior_data)

[summary]

Parameters:

behavior_data (json) – json containing behavior data (visemes, facial expressions, and gestures) and audio data (audio_frame, and audio_data)

Returns:

it is a object stringified which contained information about

audio_frame (int) audio_data (str): string of audio data array behavior_data (str): string of behaviors

Return type:

response (str)

request(input_text)

[summary]

Parameters:

input_text (str) – Input string to synthetize

Returns:

It containes information about the response received (bool) and response message (str)

response: bool message: str

Return type:

object

harmoni_tts.aws_tts_service.main()

[summary] Main function for starting HarmoniPolly service