You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Running the followig code results in the process getting stuck when not speaking loud enough:
mic = WhisperMic()
result = mic.record(duration=2)
print(result)
The issue seems to come from the function __transcribe, where self.result_queue is filled only when is_audio_loud_enough is true:
if is_audio_loud_enough:
# faster_whisper returns an iterable object rather than a string
if self.faster:
segments, info = self.audio_model.transcribe(audio_data)
predicted_text = ''
for segment in segments:
predicted_text += segment.text
else:
if self.english:
result = self.audio_model.transcribe(audio_data,language='english',suppress_tokens="")
else:
result = self.audio_model.transcribe(audio_data,suppress_tokens="")
predicted_text = result["text"]
if not self.verbose:
if predicted_text not in self.banned_results:
self.result_queue.put_nowait(predicted_text)
else:
if predicted_text not in self.banned_results:
self.result_queue.put_nowait(result)
As a result, the functions listen and record get stuck in the following loop, because self.result_queue is always empty:
while True:
if not self.result_queue.empty():
return self.result_queue.get()
The text was updated successfully, but these errors were encountered:
from whisper_mic import WhisperMic, get_logger
class CustomMic(WhisperMic):
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
def listen(self, timeout=None, phrase_time_limit=None):
self.logger.info("Listening...")
while self.result_queue.empty():
self._WhisperMic__listen_handler(timeout, phrase_time_limit)
while True:
if not self.result_queue.empty():
return self.result_queue.get()
def record(self, duration=None, offset=None):
self.logger.info("Listening...")
while self.result_queue.empty():
self._WhisperMic__record_handler(duration, offset)
while True:
if not self.result_queue.empty():
return self.result_queue.get()
Running the followig code results in the process getting stuck when not speaking loud enough:
The issue seems to come from the function __transcribe, where self.result_queue is filled only when is_audio_loud_enough is true:
As a result, the functions listen and record get stuck in the following loop, because self.result_queue is always empty:
The text was updated successfully, but these errors were encountered: