mallorbc / whisper_mic

Project that allows one to use a microphone with OpenAI whisper.
MIT License
674 stars 154 forks source link

fixes infinite loop when mic input is too quiet #76

Closed FontaineRiant closed 2 weeks ago

FontaineRiant commented 3 months ago

see issue #67

mallorbc commented 2 months ago

Thanks for the PR.

Looking at the existing code, the issue, and your PR, the current code is definitely an issue, but I am not sure if this is the appropriate solution. I think code like how the listen handler may be better, where it errors out under some circumstances. This fix would be under the record handler. I still need to actually test this though, your solution may be best

https://github.com/mallorbc/whisper_mic/blob/8da1ecec2e642a7a797ab48dfd6d9dae023a9d72/whisper_mic/whisper_mic.py#L126-L136

I will test out your code as well as my idea and fix it ASAP.

Thanks!

mallorbc commented 2 weeks ago

I ended up solving this a bit better way(in my opinion) at #83 . Thanks so much for the PR though. Let me know if you see issues with my implementation. It just recursively calls listen or record again if None is returned(which now happens if its not loud enough)