I tried espeak but didn't succeed and some functionalities only supported in python 2.
Here's how to use this accessibility feature in Windows 10 and Windows 11. Windows has long offered a screen reader and text-to-speech feature called Narrator. This tool can read web pages, text documents, and other files aloud, as well as speak every action you take in Windows.
There are several APIs available to convert text to speech in Python. One of such APIs is the Google Text to Speech API commonly known as the gTTS API. gTTS is a very easy to use tool which converts the text entered, into audio which can be saved as a mp3 file.
For offline use in Windows, use SAPI directly.
You can use SpVoice.
import win32com.client
speaker = win32com.client.Dispatch("SAPI.SpVoice")
speaker.Speak("Jumpman Jumpman Jumpman Them boys up to something!")
Have you tried using Google Text-to-Speech via gTTS?
The syntax for using it in Python 3.x is as follows:
from gtts import gTTS
my_tts = "Text you want to process"
tts = gTTS(text=my_tts, lang='en')
tts.save("Absolute/path/to/file.mp3")
Here is the github repo of gTTS.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With