Python speak🔊
How To Import Sound In Python?
1- First, you need to install pywin32 in python by type (pip
install pywin32) in terminal
2- After downloading you are able to speak anything
3- Now write( from win32com.client import Dispatch
)
4- Then define a function Let's suppose I can { def
speak(str) }
5- Now In define function you can add{ speak=Dispatch(("SAPI.SpVoice"))}
6- Speak.speak(str)
7- Now write the function {
if __name__=="__main__":}
8- Now write speak and write anything in the string it can speak
Note: it can not read Urdu format
Code :
from win32com.client import Dispatch
def speak(str):
speak=Dispatch(("SAPI.SpVoice"))
speak.speak(str)
if __name__=="__main__":
speak("Anything ")