Class "tts"
Functions enabling Text-To-Speech Synthesis
This tutorial provides functions and parameters description while illustrating each item with examples
Page
8
of
8.
Functions List
1.8) Class : tux.tts
1.8.1) Function : tux.tts.auto_connect
1.8.2) Function : tux.tts.connect
1.8.3) Function : tux.tts.disconnect
1.8.4) Function : tux.tts.kill_daemon
1.8.5) Function : tux.tts.pause
1.8.6) Function : tux.tts.play
1.8.7) Function : tux.tts.select_voice
1.8.8) Function : tux.tts.select_voice_fr_female
1.8.9) Function : tux.tts.select_voice_fr_female_tuxed
1.8.10) Function : tux.tts.select_voice_fr_male
1.8.11) Function : tux.tts.select_voice_fr_male_tuxed
1.8.12) Function : tux.tts.select_voice_us_female
1.8.13) Function : tux.tts.select_voice_us_female_tuxed
1.8.14) Function : tux.tts.select_voice_us_male
1.8.15) Function : tux.tts.select_voice_us_male_tuxed
1.8.16) Function : tux.tts.send_command_to_tts
1.8.17) Function : tux.tts.speak
1.8.18) Function : tux.tts.speak_free
1.8.19) Function : tux.tts.stop
Functions Details
Global variables of this class:
"connected" as boolean : State of the connection to tuxttsdaemon
"print_status" as boolean : Allow to print the raw statuses
"sound_on" as boolean : Speaking state of the tuxttsdaemon
"on_connected" as pof : event on tuxttsdaemon connected
"on_disconnected" as pof : event on tuxttsdaemon disconnected
"on_sound_on" as pof : event on tts speaking on
"on_sound_off" as pof : event on tts speaking off
(pof = pointer of function)
Example of associating a function to an event:
>>> def my_function():
>>> tux.cmd.mouth_open()
>>> tux.tts.on_sound_on=my_function
Functions of the class:
1.8.1) Function : tux.tts.auto_connect
Allow to connect the api to tuxttsdaemon automatically
Parameters:
"value" as boolean : turn on/off the auto_connect mode
"address" as string : Tcp/IP Host address
(default = 'localhost')
"port" as integer : Tcp/IP Port number
(default = 5500)
Examples:
>>> tux.tts.auto_connect(True)
>>> tux.tts.auto_connect(True,'192.168.0.1')
>>> tux.tts.auto_connect(True,'192.168.0.1',5500)
1.8.2) Function : tux.tts.connect
Connect tts object to tuxttsdaemon
Parameters:
"port" as integer : Tcp/IP Port number
(default = 5500)
"address" as string : Tcp/IP Host address
(default = 'localhost')
Examples:
>>> tux.tts.connect()
>>> tux.tts.connect('192.168.0.1')
>>> tux.tts.connect('localhost',5500)
Comment:
The variable "tux.tts.connected" contains the result of this method
1.8.3) Function : tux.tts.disconnect
Disconnect tts object from tuxttsdaemon
Example:
>>> tux.tts.disconnect()
1.8.4) Function : tux.tts.kill_daemon
Kill the tuxttsdaemon
Example:
>>> tux.tts.kill_daemon()
1.8.5) Function : tux.tts.pause
Pause the sound
Example:
>>> tux.tts.pause()
1.8.6) Function : tux.tts.play
Play the sound if it's in "pause" state
Example:
>>> tux.tts.play()
1.8.7) Function : tux.tts.select_voice
Select a speaker voice
Parameters:
"speaker" as integer : speaker id (SPK_FR_MALE|SPK_FR_FEMALE|
SPK_US_MALE|SPK_US_FEMALE)
"pitch" as integer : raised pitch in % (100..330)
Example:
>>> tux.tts.select_voice(SPK_FR_MALE,100)
1.8.8) Function : tux.tts.select_voice_fr_female
Select the French female speaker voice with a normal pitch
Example:
>>> tux.tts.select_voice_fr_female()
1.8.9) Function : tux.tts.select_voice_fr_female_tuxed
Select the French female speaker voice with a raised pitch
Example:
>>> tux.tts.select_voice_fr_female_tuxed()
1.8.10) Function : tux.tts.select_voice_fr_male
Select the French male speaker voice with a normal pitch
Example:
>>> tux.tts.select_voice_fr_male()
1.8.11) Function : tux.tts.select_voice_fr_male_tuxed
Select the French male speaker voice with a raised pitch
Example:
>>> tux.tts.select_voice_fr_male_tuxed(
)
1.8.12) Function : tux.tts.select_voice_us_female
Select the US English female speaker voice with a normal pitch
Example:
>>> tux.tts.select_voice_us_female()
1.8.13) Function : tux.tts.select_voice_us_female_tuxed
Select the US English female speaker voice with a raised pitch
Example:
>>> tux.tts.select_voice_us_female_tuxed()
1.8.14) Function : tux.tts.select_voice_us_male
Select the US English male speaker voice with a normal pitch
Example:
>>> tux.tts.select_voice_us_male()
1.8.15) Function : tux.tts.select_voice_us_male_tuxed
Select the US English male speaker voice with a raised pitch
Example:
>>> tux.tts.select_voice_us_male_tuxed()
1.8.16) Function : tux.tts.send_command_to_tts
Not a user function
1.8.17) Function : tux.tts.speak
Speak a text with the acapela text to speech engine
Parameters:
"text" as string : text to read
Example:
>>> tux.tts.speak('My name is tux! tux droid !')
1.8.18) Function : tux.tts.speak_free
Speak a text with the acapela text to speech engine in free mode
Parameters:
"text" as string : text to read
Example:
>>> tux.tts.speak_free('My name is tux! tux droid !')
1.8.19) Function : tux.tts.stop
Stop the sound
Example:
>>> tux.tts.stop()