Package speakeasy :: Module speakeasy_controller :: Class SpeakEasyController
[hide private]
[frames] | no frames]

Class SpeakEasyController

source code

object --+
         |
        SpeakEasyController

Control logic behind the speakeasy GUI.

Available voices:

  1. Festival: Usually voice_kal_diphone (male) on Ubuntu installations
  2. Cepstral: Depends on your installation. Voices are individually licensed.
Nested Classes [hide private]
  ReplayDemon
  SoundReplayDemon
  SpeechReplayDemon
Instance Methods [hide private]
 
__init__(self, dirpath, unix_sig_notify_read_socket=None, stand_alone=None)
x.__init__(...) initializes x; see help(type(x)) for signature
source code
 
shutdown(self)
Delete the PID pub file.
source code
boolean
initLocalOperation(self)
Initialize for playing sound and text-to-speech locally.
source code
bool
initROSOperation(self)
Try to initialize operation through ROS messages to a SpeakEasy ROS node.
source code
 
connectWidgetsToActions(self) source code
 
actionUnixSigReceived(self, socket) source code
 
connectProgramButtonsToActions(self) source code
[string]
getAvailableSoundEffectFileNames(self, stand_alone=None)
Determine all the available sound effect files.
source code
 
getAvailableLocalSoundEffectFileNames(self) source code
 
sayText(self, text, voice, ttsEngine="festival", sayOnce=True, stand_alone=None)
Send message to SpeakEasy service to say text, with the given voice, using the given text-to-speech engine.
source code
 
actionRecorderButtons(self, buttonObj)
Handler for one of the recorder buttons pushed: Play Text, or Stop.
source code
 
stopAll(self) source code
 
actionWhereToPlayRadioButton(self, playLocation) source code
 
actionProgramButtons(self, buttonObj) source code
 
actionProgramButtonRelease(self, buttonObj) source code
 
programOneButton(self, buttonObj) source code
 
playProgram(self, buttonObj) source code
 
actionSoundButtons(self, buttonObj) source code
 
actionNewSpeechSet(self) source code
 
actionPickSpeechSet(self) source code
 
actionRepeatPeriodChanged(self) source code
 
actionClear(self) source code
 
actionPaste(self) source code
 
installDefaultSpeechSet(self) source code
 
replaceProgramButtons(self, buttonProgramArray) source code
 
getAllSpeechSetXMLFileNames(self) source code
 
getNewSpeechSetName(self) source code
int
getSpeechSetFromSpeechFileName(self, filePath)
Given a file path to a button set, return the button set's number.
source code
 
publishPID(self) source code
 
handleOS_SIGUSR1_2(self, signum, stack) source code

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __str__, __subclasshook__

Class Variables [hide private]
  VERSION = '1.1'
  PID_PUBLICATION_FILE = "/tmp/speakeasyPID"
  soundPaths = {}
  soundPathsFull = {}
  FOREVER = -1
  REMOTE_CLEAR_TEXT_SIG = signal.SIGUSR1
  REMOTE_PASTE_AND_SPEAK_SIG = signal.SIGUSR2
Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, dirpath, unix_sig_notify_read_socket=None, stand_alone=None)
(Constructor)

source code 

x.__init__(...) initializes x; see help(type(x)) for signature

Overrides: object.__init__
(inherited documentation)

shutdown(self)

source code 

Delete the PID pub file. Not crucial, but nice to let other processes know that SpeakEasy is no longer running.

initLocalOperation(self)

source code 

Initialize for playing sound and text-to-speech locally. OK to call multiple times. Initializes self.sound_file_names to a list of sound file names for use with SoundPlayer instance.

Returns: boolean
True if initialization succeeded, else False.

initROSOperation(self)

source code 

Try to initialize operation through ROS messages to a SpeakEasy ROS node. If that init fails, revert to local operation.

Returns: bool
True if ROS operation init succeeded. Else, if local ops was initiated instead, return False.

actionUnixSigReceived(self, socket)

source code 
Decorators:
  • @Slot(int)

getAvailableSoundEffectFileNames(self, stand_alone=None)

source code 

Determine all the available sound effect files. If this process operates stand-alone, the local '../../sounds' subdirectory is searched. Else, in a ROS environment, the available sound effect file names are obtained from the 'speech_capabilities_inquiry' service call.

Parameters:
  • stand_alone (boolean) - False if referenced sounds are to be from the ROS environment.
Returns: [string]
array of sound file basenames without extensions. E.g.: [rooster, birds, elephant]

sayText(self, text, voice, ttsEngine="festival", sayOnce=True, stand_alone=None)

source code 

Send message to SpeakEasy service to say text, with the given voice, using the given text-to-speech engine. </p> If the voice parameter is the Festival voice 'Male' it is a special case in that it refers to the Festival engine's "voice_kal_diphone". We convert this.

Parameters:
  • text - Text to be uttered by the tts engine @type string
  • voice - Name of speaking voice to be used. @type string
  • ttsEngine - Name of tts engine to use (e.g. "festival" (the default), "cepstral" @type string
  • sayOnce - Whether repeat the utterance over and over, or just say it once. @type bool

actionRecorderButtons(self, buttonObj)

source code 

Handler for one of the recorder buttons pushed: Play Text, or Stop.

Parameters:
  • buttonObj (QPushButton) - The button object that was pushed.

getSpeechSetFromSpeechFileName(self, filePath)

source code 

Given a file path to a button set, return the button set's number. We assume that the path is well formed, and all button sets are named buttonProgramnnn.xml. If malformed path, shows error msg on screen, and returns None.

Parameters:
  • filePath (string) - Path to xml file.
Returns: int
Number encoded in file name (i.e. nnn)