Speech Generation package

Submodules

i_speech_generation module

class dronebuddylib.atoms.speechgeneration.i_speech_generation.ISpeechGeneration(engine_configurations: EngineConfigurations)[source]

Bases: IDBLFunction

abstract change_rate(rate: int) bool[source]

Changes the speech rate of the speech generation engine.

Parameters:

rate (int) – The desired speech rate.

Returns:

True if the rate was changed successfully, False otherwise.

Return type:

bool

abstract change_voice(voice_id: str) bool[source]

Changes the voice used by the speech generation engine.

Parameters:

voice_id (str) – The identifier of the desired voice.

Returns:

True if the voice was changed successfully, False otherwise.

Return type:

bool

abstract change_volume(volume: float) bool[source]

Changes the volume of the speech generation engine.

Parameters:

volume (float) – The desired volume level.

Returns:

True if the volume was changed successfully, False otherwise.

Return type:

bool

abstract get_current_configs() dict[source]

Gets the current configurations of the speech generation engine.

Returns:

A dictionary containing the current configurations.

Return type:

dict

abstract read_phrase(phrase: str) None[source]

Generates speech from the provided text and plays it.

Parameters:

phrase (str) – The text to be converted into speech.

Returns:

None

speech_generation_engine module

class dronebuddylib.atoms.speechgeneration.speech_generation_engine.SpeechGenerationEngine(algorithm: SpeechGenerationAlgorithm, config: EngineConfigurations)[source]

Bases: object

A facade that provides a simplified interface to the underlying speech generation engines.

get_class_name() str[source]

Returns the class name.

Returns:

The class name.

Return type:

str

read_phrase(phrase: str) None[source]

Generates speech from the provided phrase.

Parameters:

phrase (str) – The phrase to be converted into speech.

Returns:

None

tts_speech_generation_impl module

class dronebuddylib.atoms.speechgeneration.tts_speech_generation_impl.TTSTextToSpeechGenerationImpl(engine_configurations: EngineConfigurations)[source]

Bases: ISpeechGeneration

Initiates the speechrecognition to text engine.

change_rate(rate) bool[source]

Changes the speech rate of the speech generation engine.

Parameters:

rate (int) – The desired speech rate.

Returns:

True if the rate was changed successfully, False otherwise.

Return type:

bool

change_voice(voice_id) bool[source]

Changes the voice used by the speech generation engine.

Parameters:

voice_id (str) – The identifier of the desired voice.

Returns:

True if the voice was changed successfully, False otherwise.

Return type:

bool

change_volume(volume) bool[source]

Changes the volume of the speech generation engine.

Parameters:

volume (float) – The desired volume level.

Returns:

True if the volume was changed successfully, False otherwise.

Return type:

bool

get_algorithm_name() str[source]
get_class_name() str[source]
get_current_configs() dict[source]

Gets the current configurations of the speech generation engine.

Returns:

A dictionary containing the current configurations.

Return type:

dict

get_optional_params() list[source]
get_required_params() list[source]
read_phrase(text) None[source]

Generates speechrecognition from the provided text using a text-to-speechrecognition engine and plays it.

Parameters:
  • engine (TTS Engine) – The text-to-speechrecognition engine instance capable of generating speechrecognition.

  • text (str) – The text to be converted into speechrecognition and played.

Returns:

None

Example

engine = TextToSpeechEngine() generate_speech_and_play(engine, “Hello, how can I assist you?”)

dronebuddylib.atoms.speechgeneration.tts_speech_generation_impl.logger = <dronebuddylib.utils.logger.Logger object>

This is a wrapper for ttx.

Module contents