0
Q:

speech to text

import pyttsx3
engine = pyttsx3.init()
engine.say("write  here what you want to speak")
engine.runAndWait()
4
import pyttsx3
engine = pyttsx3.init()
engine.say("")
engine.runAndWait()
3
#If you use windows you can install win32com.client using the command pip 
#install pypiwin and then pip install win32com
from win32com.client import Dispatch
s = Dispatch('Sapi.SpVoice')
s.speak('Whatever you would want your code to speak')
1
import speech_recognition as sr
def mycommand():
    r = sr.Recognizer()
    with sr.Microphone() as source:
        print("listening....")
        r.pause_threshold =  1
        audio = r.listen(source)
query = mycommand()
print(query)
#prints whatever you said
0

New to Communities?

Join the community