SHARE
TWEET

pyttsx3 - Linux - espeak

furas Jul 19th, 2018 87 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #
  2. # Linux:
  3. #
  4. # pip install pyttsx3
  5. # apt install espeak
  6. # apt install libespeak1 # I'm not sure. Maybe espeak will install it.
  7. #
  8. # http://pyttsx.readthedocs.io/en/latest/index.html
  9. # http://espeak.sourceforge.net/languages.html
  10. #
  11.  
  12. import pyttsx3
  13.  
  14. engine = pyttsx3.init()
  15.  
  16. print('voices:')
  17. for item in engine.getProperty('voices'):
  18.     print(item.name)
  19.  
  20. print('---')
  21. print('voice:', engine.getProperty('voice'))
  22. print('rate:', engine.getProperty('rate'))
  23. print('volume:', engine.getProperty('volume'))
  24. print('---')
  25.  
  26. engine.setProperty('voice', 'english')
  27. engine.say('Good Day, what a nice day today.')
  28.  
  29. engine.setProperty('voice', 'polish')
  30. engine.say('Dzień dobry, jaki ładny dzisiaj dzień.')
  31.  
  32. engine.setProperty('voice', 'russian')
  33. engine.say('Доброе утро, сегодня хороший день.')
  34.  
  35. engine.runAndWait()
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top