First, I had to put r.adjust_for_noise(source, duration=1) because otherwise no audio was being recognized at all. But when I change the value from 1 to 2, it stops working again.When I change it from 1 to 0.5 it again stops working. Here is the code I am using :

import speech_recognition as sr
r = sr.Recognizer()
mic = sr.Microphone()
with mic as source:
    r.adjust_for_ambient_noise(source,duration=1)
    audio=r.listen(source)

Can someone highlight why doesn't it work for values other than 1 ?

🔴 No definitive solution yet