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 audio in python

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

PREVIOUS NEXT
Code Example
Python :: python aritmethic print 
Python :: elon son name 
Python :: tkinter button background color mac 
Python :: remove characters in array of string python 
Python :: save dataframe as csv 
Python :: python legend outside 
Python :: how to sort values in numpy by one column 
Python :: os file exists 
Python :: python writelines newline 
Python :: import python module from another directory 
Python :: how to use colorama 
Python :: flask clear session 
Python :: from time import sleep, time 
Python :: torch save 
Python :: how to run commands in repl.ot 
Python :: except index out of range python 
Python :: python pdf to excel 
Python :: python rickroll code 
Python :: reset index with pandas 
Python :: django password change view 
Python :: how to construct simple timedelta in python 
Python :: python binary to string 
Python :: log base in python 
Python :: how to get rid of all null values in array python 
Python :: how to add 2 dates in python 
Python :: how to get what type of file in python 
Python :: nb_occurence in list python 
Python :: python check version 
Python :: hot reloading flask 
Python :: distribution plot with curve python 
ADD CONTENT
Topic
Content
Source link
Name
8+7 =