askbob.speech package

Submodules

askbob.speech.synthesiser module

class askbob.speech.synthesiser.TextToSpeechService(voice_id: Optional[str] = None)

Bases: object

The TextToSpeechService is responsible for speech synthesis.

say(text: str) → None

Converts the text into speech and outputs the audio.

Parameters

text (str) – The text to say.

tts: pyttsx3.engine.Engine

askbob.speech.transcriber module

class askbob.speech.transcriber.Transcriber(model: str, scorer: str, us: askbob.speech.listener.listener.UtteranceService, save_path: Optional[str] = None)

Bases: object

The transcriber performs speech-to-text on captured utterances spoken by the user.

init_deepspeech(model_path: str, scorer_path: str = '') → deepspeech.Model

Initialises the DeepSpeech model.

Parameters
  • model_path (str) – The path to the DeepSpech model.

  • scorer_path (str, optional) – The path to an external scorer. Defaults to “”.

Returns

The DeepSpeech model.

Return type

deepspeech.Model

transcribe()

Transcribes spoken words.

Yields

TranscriptionEvent – Whether the utterance has started or ended. str: The transcribed phrase spoken by the user.

class askbob.speech.transcriber.TranscriptionEvent(value)

Bases: enum.Enum

An enum representing utterance-related events.

END_UTTERANCE = 2
START_UTTERANCE = 1

Module contents