Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

How to convert text into audio file in python?

"""
Convert text into audio file.
"""
# pip install playsound
from playsound import playsound
# pip install gtts
from gtts import gTTS

audio_file = "speech.mp3"
text_to_convert = "Sample text to convert"
language = "en"
speech = gTTS(text=text_to_convert, lang=language, slow=False)

speech.save(audio_file)
playsound(audio_file)
Comment

text to sound python

#pip3 install pyttsx3
#apt-get install alsa-utils
import pyttsx3, time 
engine = pyttsx3.init() 
engine.say("Hi, I am text to speach") 
engine.runAndWait()
Comment

text to audio in python

import pyttsx3  
s = pyttsx3.init()  
data = "Sample Text"  
s.say(data)  
s.runAndWait()
Comment

python library to convert text to audio

import pyttsx3.
# initialize Text-to-speech engine.
engine = pyttsx3.init()
# convert this text to speech.
text = "Python is a great programming language"
engine.say(text)
# play the speech.
engine.runAndWait()
Comment

PREVIOUS NEXT
Code Example
Python :: python matplt 
Python :: redirect in dajango 
Python :: how to check if there are duplicates in a list python 
Python :: python infinity 
Python :: print variable name 
Python :: google text to speech python 
Python :: flask heroku 
Python :: multiline comment python 
Python :: python create file if doesnt exist 
Python :: loop over twodimensional array python 
Python :: python using datetime as id 
Python :: django id 
Python :: python sum array 
Python :: docker django development and production 
Python :: python regex 
Python :: pygame window at center 
Python :: how to find if the numpy array contains negative values 
Python :: python sort class by attribute 
Python :: python sort list 
Python :: add fonts to matplotlib from a particular location 
Python :: python set day of date to 1 
Python :: django queryset last 10 
Python :: python asctime 
Python :: .argsort() python 
Python :: change index of dataframe with list 
Python :: python json normalize 
Python :: concatenate python 
Python :: python code to exe file 
Python :: python round to two decimals 
Python :: python pandas give column names 
ADD CONTENT
Topic
Content
Source link
Name
2+9 =