Hello I need help with my code. I just want it to automatically return any audio outputted by pc to be captured as source (e.i. captures to the audio of video that is playing on the computer), but I can’t figure out how to do so. Can anyone help?
import speech_recognition as sr
r = sr.Recognizer()
while(1):
with sr.Microphone() as source:
try:
print("Talk")
r.adjust_for_ambient_noise(source, duration=0.2)
audio_text = r.listen(source)
MyText = r.recognize_google(audio_text, language="en-US")
MyText = MyText.lower()
print(MyText)
except:
print("Sorry, I did not get that")