Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/pysamples/speak.py
diff options
context:
space:
mode:
authorWalter Bender <walter@sugarlabs.org>2013-07-27 22:38:22 (GMT)
committer Walter Bender <walter@sugarlabs.org>2013-07-27 22:38:22 (GMT)
commita308a5425f6f7bed7fc15ba43d9bf3f1894083fa (patch)
treebd6a6c37615a6a69a8d391b0dc4e796c82638dd0 /pysamples/speak.py
parentbf2d9ffa0052fbe2a025d871b9b3c5e91e9c7ff2 (diff)
remove extra stuffv187
Diffstat (limited to 'pysamples/speak.py')
-rw-r--r--pysamples/speak.py57
1 files changed, 0 insertions, 57 deletions
diff --git a/pysamples/speak.py b/pysamples/speak.py
deleted file mode 100644
index 30762a9..0000000
--- a/pysamples/speak.py
+++ /dev/null
@@ -1,57 +0,0 @@
-#Copyright (c) 2009-11, Walter Bender, Tony Forster
-
-# This procedure is invoked when the user-definable block on the
-# "extras" palette is selected.
-
-# Usage: Import this code into a Python (user-definable) block and
-# pass a string to be read by the voice synthesizer. If a second
-# argument is passed, by expanding the Python block, it is used to specify
-# the pitch level of the speaker. Valid range is 0 to 99.
-
-
-def myblock(tw, arg):
- ''' Text to speech '''
-
- TABLE = {'af': 'afrikaans', 'cy': 'welsh-test', 'el': 'greek',
- 'es': 'spanish', 'hi': 'hindi-test', 'hy': 'armenian',
- 'ku': 'kurdish', 'mk': 'macedonian-test', 'pt': 'brazil',
- 'sk': 'slovak', 'sw': 'swahili', 'bs': 'bosnian', 'da': 'danish',
- 'en': 'english', 'fi': 'finnish', 'hr': 'croatian',
- 'id': 'indonesian-test', 'la': 'latin', 'nl': 'dutch-test',
- 'sq': 'albanian', 'ta': 'tamil', 'vi': 'vietnam-test',
- 'ca': 'catalan', 'de': 'german', 'eo': 'esperanto',
- 'fr': 'french', 'hu': 'hungarian', 'is': 'icelandic-test',
- 'lv': 'latvian', 'no': 'norwegian', 'ro': 'romanian',
- 'sr': 'serbian', 'zh': 'Mandarin', 'cs': 'czech', 'it': 'italian',
- 'pl': 'polish', 'ru': 'russian_test', 'sv': 'swedish',
- 'tr': 'turkish'}
- 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)
-
- lang = os.environ['LANG'][0:2]
- if lang in TABLE:
- language_option = '-v ' + TABLE[lang]
- else:
- language_option = ''
- if pitch is None:
- os.system('espeak %s "%s" --stdout | aplay' % (language_option,
- text))
- else:
- os.system('espeak %s "%s" -p "%s" --stdout | aplay' % (
- language_option, text, pitch))