karen.devices.Speaker

Speaker device to convert any text to speech send to the audio output device.

__init__(self, parent=None, callback=None) special

Speaker Initialization

Parameters:
  • parent (object) – Containing object's reference. Normally this would be the device container. (optional)

  • callback (function) – Callback function for which to send any captured data.

isRunning(self)

Identifies if the device is actively running.

Returns:
  • (bool) – True if running; False if not running.

say(self, text)

Sends text to the festival executable to be translated and sent to the audio device.

Parameters:
  • text (str) – The text to convert into speech.

Returns:
  • (bool) – True on success else raises exception.

speak(self, httpRequest=None)

Accepts inbound commands from Brain and sends to standard "say()" function.

Parameters:
  • httpRequest (KHTTPHandler) – Handler for inbound request.

Returns:
  • (bool) – True on success else will raise an exception.

start(self, httpRequest=None, useThreads=True)

Starts the speaker. Function provided for compatibility as speaker does not require a daemon.

Parameters:
  • httpRequest (KHTTPHandler) – Handler for inbound request. Not used.

  • useThreads (bool) – Indicates if the brain should be started on a new thread.

Returns:
  • (bool) – True on success else will raise an exception.

stop(self, httpRequest=None)

Stops the speaker. Function provided for compatibility as speaker does not require a daemon.

Parameters:
  • httpRequest (KHTTPHandler) – Handler for inbound request. Not used.

Returns:
  • (bool) – True on success else will raise an exception.

wait(self, seconds=0)

Waits for any active speakers to complete before closing. Provided for compatibility as speaker does not requrie a daemon.

Parameters:
  • seconds (int) – Number of seconds to wait before calling the "stop()" function

Returns:
  • (bool) – True on success else will raise an exception.