[ create a new paste ] login | about

Link: http://codepad.org/rNBzVtkx    [ raw code | output | fork ]

Python, pasted on Jan 29:
###############################################################################
# speech-test.py
#
# Author: electronut.in
#
# Description:
#
# Testing Raspberry Pi audio using pyttsx - Python Cross-platform
# text-to-speech wrapper
#
# test run:
#
# python speech-test.py "hello there"
###############################################################################

import sys
import pyttsx

# main() function
def main():
	# use sys.argv if needed
	print 'running speech-test.py...'
	engine = pyttsx.init()
	str = "I speak. Therefore. I am.  "
	if len(sys.argv) > 1:
		str = sys.argv[1]
	engine.say(str)
	engine.runAndWait()

# call main
if __name__ == '__main__':
	main()


Output:
1
2
3
4
Traceback (most recent call last):
  Line 17, in <module>
    import pyttsx
ImportError: No module named pyttsx


Create a new paste based on this one


Comments: