Package rstem :: Package speaker
[hide private]
[frames] | no frames]

Package speaker

source code

Classes [hide private]
  Sound
Basic foreground or background sound from a file
  Speech
Sound using Text to Speech software (espeak)
  Note
A sine wave of given frequeny
Functions [hide private]
 
_init()
Initializes pygame
source code
boolean
is_talking()
Returns: True if speaker is currently saying text (from the say function)
source code
 
set_voice_engine(engine='espeak')
Set the voice engine and do and intial configures if necessary
source code
 
say(text, wait=False)
Plays a voice speaking the given text.
source code
float
get_volume()
Gets the master volume
source code
 
set_volume(value)
Set the master volume
source code
 
stop(background=True)
Stops all playback including background music unless background = False
source code
 
pause(background=True)
Pauses all playback including background music unless background = False
source code
 
play(background=True)
Unpauses all playback including background music unless background = False
source code
 
cleanup()
Cleans up initialization of pygame
source code
Variables [hide private]
  SAMPLERATE = 44100
  BITSIZE = -16
  CHANNELS = 2
  BUFFER = 1024
  FRAMERATE = 30
  talking_procs = set([])
  voice_engine = None
  currently_playing_filename = None
  __package__ = 'rstem.speaker'
Function Details [hide private]

is_talking()

source code 
Returns: boolean
True if speaker is currently saying text (from the say function)

set_voice_engine(engine='espeak')

source code 

Set the voice engine and do and intial configures if necessary

Parameters:
  • engine (string) - Alias of the engine to use. (Currently only "espeak" is supported)

say(text, wait=False)

source code 

Plays a voice speaking the given text.

Parameters:
  • text (string) - text to play
Raises:
  • Exception - espeak errors out (most likely due to not being installed)

Note: Must have espeak installed

get_volume()

source code 

Gets the master volume

Returns: float
the volume between 0-100

set_volume(value)

source code 

Set the master volume

Parameters:
  • value (int) - Volume to set (must be between 0-100)