I am trying to take audio input and save it as .wav file.
My code is the following:
import speech_recognition as sr
def save():
r=sr.Recognizer()
r.pause_threshold = 0.6
with sr.Microphone() as source:
print('Yes')
audio=r.listen(source)
with open('test.wav','wb') as wav:
wav.write(audio.get_wav_data())
save()
If I save and run this file it listens forever or till I terminate the code.
Can anybody help me.
Thank you
-Levers