rhasspy / rhasspy3

An open source voice assistant toolkit for many human languages
MIT License
301 stars 25 forks source link

SileroVAD fails sometimes with "BrokenPipeError: [Errno 32] Broken pipe" #5

Closed kha84 closed 1 year ago

kha84 commented 1 year ago

Hello there,

I was following your tutorial, up to the point of testing the Silero VAD - "Voice Activity Detection" chapter.

I noticed that sometimes (in my case like in 30% of cases) it throws an exception while recording sound activity like this:

(.venv) root@085dd18c329f:~/rhasspy3# script/run bin/mic_record_sample.py sample.wav
INFO:mic_record_sample:Recording sample.wav
INFO:mic_record_sample:Speaking started
INFO:mic_record_sample:Speaking ended
Traceback (most recent call last):
  File "/root/rhasspy3/config/programs/vad/silero/bin/silero_speech_prob.py", line 89, in <module>
    main()
  File "/root/rhasspy3/config/programs/vad/silero/bin/silero_speech_prob.py", line 34, in main
    print(speech_probability, flush=True)
BrokenPipeError: [Errno 32] Broken pipe

However when it happens it still manages to capture something to sample.wav

If it matters, I'm playing with Rhasspy3 in a ubuntu:latest docker container (22.04.2), for sound inside of the container I'm using ALSA emulation of pipewire client installed in the container. The Pipewire client is connected to my host Pipewire server via socket file. All ALSA native utilities inside of the container (aplay / arecord) are working just fine - I'm pretty sure the sound setup is a solid one.

synesthesiam commented 1 year ago

This is probably due to the main process exiting before the subprocess, which isn't supposed to happen but I haven't got it down perfect just yet.

For now, I updated the silero wrapper to catch BrokenPipeError and just silently exit (since it means it's time to stop anyways).