# Run with Python 3
# install python3-espeak

# /usr/lib/python3/dist-packages/espeak/espeak.py

from espeak import espeak
import sys

done = False

while ( done == False ):
	print()
	print( "1. Display voices" )
	print( "2. Speak text" )
	print( "3. View espeak functions" )

	choice = int( input( "What do you want to do? >> " ) )

	print()

	if ( choice == 1 ):
		print( "VOICES" )
		voices = espeak.list_voices()

		print( "Identifier","Name","Gender","Age","Variant" )
		for voice in voices:
			print( "Name: 			", voice.name )
			print( "Identifier: 		", voice.identifier )
			print( "Gender: 		", voice.gender )
			print( "Age: 			", voice.age )
			print( "Variant: 		", voice.variant )
			print()

	elif ( choice == 2 ):
		print( "SPEAK" )
		voice = input( "What voice do you want to use? >> " )
		espeak.set_voice( voice )

		text = input( "What do you want to say? >> " )
		print( "Saying \"" + text + "\"" )
		espeak.synth( text )

	elif ( choice == 3 ):
		print( "FUNCTIONS" )
		for member in dir( espeak ):
			print( member )

