Hardware Reference
In-Depth Information
Changing pitch
Changing speed
Here's an example of how you could change espeak.py :
import subprocess
DEFAULT_PITCH = 50 # 0-99
DEFAULT_SPEED = 160 # words per min
def say(words, pitch=None, speed=None):
if not pitch:
pitch = DEFAULT_PITCH
if not speed:
speed = DEFAULT_SPEED
devnull = open("/dev/null", "w")
try:
subprocess.call([
"espeak",
"-v", "en-rp", # english received pronunciation
"-p", str(pitch),
"-s", str(speed),
words],
stderr=devnull)
You could change the speech parameters depending on who is talking or the content of
the tweet.
You could connect multiple soft toys, each with different voices, and have a conversa-
tion. (Hint: Create chick0 = chicken.Chicken(pfio,0) and chick1 =
chicken.Chicken(pfio,1) and then wire a different chicken up to each relay.)
You could control more motors in your soft toy and make it dance if it detects certain
hash tags.
If you're really adventurous you could replace the espeak.py module completely with
a module that looks up and plays sound recordings of yourself saying particular words.
Search WWH ::




Custom Search