Spokestack

This module contains the Spokestack client for text to speech

exception spokestack.tts.clients.spokestack.TTSError(response)[source]

Bases: Exception

Text to speech error wrapper

class spokestack.tts.clients.spokestack.TextToSpeechClient(key_id, key_secret, url='https://api.spokestack.io/v1')[source]

Bases: object

Spokestack Text to Speech Client

Parameters
  • key_id (str) – identity from spokestack api credentials

  • key_secret (str) – secret key from spokestack api credentials

  • url (str) – spokestack api url

synthesize(utterance, mode='text', voice='demo-male')[source]

Converts the given utterance to speech

Parameters
  • utterance (str) – string that needs to be rendered as speech.

  • mode (str) – synthesis mode to use with utterance. text, ssml, markdown.

  • voice (str) – name of the tts voice.

Returns

Encoded audio response in the form of a sequence of bytes

Return type

(Iterator[bytes])

synthesize_url(utterance, mode='text', voice='demo-male')[source]

Converts the given uttrance to speech accessible by a URL.

Parameters
  • utterance (str) – string that needs to be rendered as speech.

  • mode (str) – synthesis mode to use with utterance. text, ssml, markdown.

  • voice (str) – name of the tts voice.

Returns: URL of the audio clip

Return type

str