Should 'r.pause_threshold' be defined one time or for every listen?

20 Views Asked by At

In many voice recognition codes I can see that pause_threshold is configured inside a while loop.
I believe it should be defined only once outside the while True loop. Is that correct?

while True:
    if working == True:
         
        with sr.Microphone() as source: 
            
            r.pause_threshold=0.5
            audio = r.listen(source)
            queue.put(audio)
0

There are 0 best solutions below