Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

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")
Comment

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")
Comment

PREVIOUS NEXT
Code Example
Python :: saving model in pytorch 
Python :: how to check how many items are in a list python 
Python :: xgboosat save_model 
Python :: how to make a string case insensitive in python 
Python :: Using Python Permutations function on a String 
Python :: how to iterate through ordereddict in python 
Python :: pyplot rectangle over image 
Python :: python shortest distance between two points 
Python :: non-integer arg 1 for randrange() 
Python :: add one day to datetime 
Python :: rc.local raspberry pi 
Python :: replace values in a column by condition python 
Python :: add new keys to a dictionary python 
Python :: sort eigenvalues and eigenvectors python 
Python :: load json py 
Python :: pandas where 
Python :: python remove items from list containing string 
Python :: TypeError: expected string or bytes-like object site:stackoverflow.com 
Python :: version python 
Python :: combine dataframes with two matching columns 
Python :: show columns pandas 
Python :: how to calculate z score in python 
Python :: .argsort() python 
Python :: how to use path to change working directory in python 
Python :: count unique elements in list python 
Python :: how to get random number python 
Python :: python get list of file and time created 
Python :: install different python version debian 
Python :: boto3 client python 
Python :: import database in python using sqlalchemy 
ADD CONTENT
Topic
Content
Source link
Name
5+7 =