“Google Text to Speech Python” Kode Jawaban

GTTS

>>> from gtts import gTTS
>>> tts = gTTS('hello')
>>> tts.save('hello.mp3')
Frightened Ferret

Google Text to Speech Python

# Import the required module for text 
# to speech conversion
from gtts import gTTS
  
# This module is imported so that we can 
# play the converted audio
import os
  
# The text that you want to convert to audio
mytext = 'Welcome to geeksforgeeks!'
  
# Language in which you want to convert
language = 'en'
  
# Passing the text and language to the engine, 
# here we have marked slow=False. Which tells 
# the module that the converted audio should 
# have a high speed
myobj = gTTS(text=mytext, lang=language, slow=False)
  
# Saving the converted audio in a mp3 file named
# welcome 
myobj.save("welcome.mp3")
  
# Playing the converted file
os.system("mpg321 welcome.mp3")
Bongblender

Jawaban yang mirip dengan “Google Text to Speech Python”

Pertanyaan yang mirip dengan “Google Text to Speech Python”

Lebih banyak jawaban terkait untuk “Google Text to Speech Python” di Python

Jelajahi jawaban kode populer menurut bahasa

Jelajahi bahasa kode lainnya