User Manual
43
Make the PiSmart broadcast the speech set.
Assign strings.
tts.say = "Hello, world!" # say words
engine
Check and set the speech engine.
Values available: ['festival', 'espeak', 'pico'].
engine = tts.engine # get tts engine
tts.engine = "espeak" # set tts engine
**engine_pa
rams(amp=None, speed=None, gap=None, pitch=None)**
Set the parameters of the engine. Available only when the espeak engine is selected. Four
parameters:
amp=None, amp should be in 0 to 200
speed=None, speed should be in 80 to 260 gap=None
pitch=None, pitch should be in 0 to 99
tts.engine = "espeak" # set espeak
tts.espeak_params(speed = 150)
stt.py
Convert speech into text for PiSmart, used in speech recognition.
Create an instance, parameters should be transferred: (dictionary, device=1,
namecalling=False, timeout=5.0, dictionaryupdate=False).
dictionary: File name of the dictionary under the same directory of the script.
device: Number of the sound card devices for the Raspberry Pi in PiSmart, 1 by default. If
other sound cards are used, assign a parameter based on the device number. name_calling:
Whether to turn on awaking by speaking the name, ranging in [True, False]. timeout: Time of
timeout to end awaking since no command is heard after name_calling.
dictionary_update: Whether to update the dictionary. The update can generate essential
dictionaries and intermediate files needed for speech recognition.
from pismart.tts import TTS
SunFounder