KoljaB / RealtimeSTT

A robust, efficient, low-latency speech-to-text library with advanced voice activity detection, wake word activation and instant transcription.
MIT License
1.58k stars 144 forks source link

Cannot run example browerclient #29

Open hieuminh65 opened 6 months ago

hieuminh65 commented 6 months ago

I have error when use the example of browser client folder:

Exception in thread Thread-3:
Traceback (most recent call last):
  File "/Users/hieunguyenminh/opt/anaconda3/lib/python3.9/threading.py", line 980, in _bootstrap_inner
    self.run()
  File "/Users/hieunguyenminh/opt/anaconda3/lib/python3.9/threading.py", line 917, in run
    self._target(*self._args, **self._kwargs)
  File "/Users/hieunguyenminh/CODE ALL/TalkToListen/STT-VAD/venv/lib/python3.9/site-packages/RealtimeSTT/audio_recorder.py", line 985, in _recording_worker
    while (self.audio_queue.qsize() >
  File "/Users/hieunguyenminh/opt/anaconda3/lib/python3.9/multiprocessing/queues.py", line 126, in qsize
    return self._maxsize - self._sem._semlock._get_value()
NotImplementedError

Thank you for creating this app, this helps me a lot!

KoljaB commented 6 months ago

Seems like mac os, which has some issues with multiprocessing queue size handling. I'll implement a workaround in the next release.

You can try uncommenting this block in audio_recorder.py for a quick fix:

while (self.audio_queue.qsize() >
       self.allowed_latency_limit):

    if not queue_overflow_logged:
        logging.warning("Audio queue size exceeds latency "
                        "limit. Current size: "
                        f"{self.audio_queue.qsize()}. "
                        "Discarding old audio chunks."
                        )
        queue_overflow_logged = True
    data = self.audio_queue.get()