Shcoder001

text_to_speech

May 5th, 2023
358
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.30 KB | None | 0 0
  1. import time
  2.  
  3. import pygame
  4. from gtts import gTTS
  5.  
  6. my_text = 'Добро пожаловать в программу.'
  7. audio = gTTS(text=my_text, lang="ru")
  8. audio.save("sample.mp3")
  9.  
  10. pygame.mixer.init()
  11. pygame.mixer.music.load('sample.mp3')
  12. pygame.mixer.music.play()
  13. time.sleep(5)
  14. print(123)
  15.  
Advertisement
Add Comment
Please, Sign In to add comment