“”"
import speech_recognition as sr
import time
r = sr.Recognizer()
time.sleep(3)
print(“Saying something and I will print it.”)
with sr.Microphone() as source:
r.adjust_for_ambient_noise(source)
audio = r.listen(source)
text = r.recognize_google(audio)
print(text)
“”"
This code work in Jupyter Notebook and Terminal, but not in sublime text. I think this is cause by sublime text can’t use microphone. Am I right? I hope someone can help me.