Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWalter Bender <walter.bender@gmail.com>2011-03-03 02:22:39 (GMT)
committer Walter Bender <walter.bender@gmail.com>2011-03-03 02:22:39 (GMT)
commit97b2b2e5c63ca94f619dd2f8fbe069486f2b2856 (patch)
tree93c7c1f2898b769f2c26b888c8a7919ac7732bc9
parent5c1f6192bf1ca6e1d4a62f47c6dd100e5bfee486 (diff)
added pitch option
-rw-r--r--pysamples/speak.py19
1 files changed, 17 insertions, 2 deletions
diff --git a/pysamples/speak.py b/pysamples/speak.py
index 666fc6b..e8d3864 100644
--- a/pysamples/speak.py
+++ b/pysamples/speak.py
@@ -23,7 +23,7 @@
# palette is selected.
-def myblock(lc, text):
+def myblock(lc, arg):
###########################################################################
#
@@ -33,9 +33,24 @@ def myblock(lc, text):
import os
+ pitch = None
+ if type(arg) == type([]):
+ text = arg[0]
+ if len(arg) > 1:
+ pitch = int(arg[1])
+ if pitch > 99:
+ pitch = 99
+ elif pitch < 0:
+ pitch = 0
+ else:
+ text = arg
+
# Turtle Art numbers are passed as float,
# but they may be integer values.
if type(text) == float and int(text) == text:
text = int(text)
- os.system('espeak "%s" --stdout | aplay' % (text))
+ if pitch is None:
+ os.system('espeak "%s" --stdout | aplay' % (text))
+ else:
+ os.system('espeak "%s" -p "%s" --stdout | aplay' % (text, pitch))