Advertisement
TTpocToXaKep

Text speacher [free] 4 languages

Feb 7th, 2023
625
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.34 KB | None | 0 0
  1. from gtts import gTTS
  2.  
  3. language = input('ru/en/de/fr: ') # russian, english (original), deutsch, french
  4. def text_to_speech(text, file_name):
  5.     tts = gTTS(text=text, lang=language)
  6.     tts.save(file_name)
  7.  
  8. text = input('Write text to speach: ')
  9. file_name = "output.mp3"
  10. text_to_speech(text, file_name)
  11. # sample of convert text to speach
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement