mallorbc / whisper_mic

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

Allow the selection of faster_whisper or stock whisper library #64

Closed evranch closed 6 months ago

evranch commented 6 months ago

Whisper_mic for faster-whisper/CTranslate2? #21

Also silenced the torrent of garbage error messages thrown by ALSA (at least on my system)

mallorbc commented 6 months ago

A few issues with ALSA, but I will fix that. What you have is a linux only fix to what I believe are just warnings.

evranch commented 6 months ago

Yup, never considered that the ALSA thing was Linux only. Been away from Windows for awhile. I tried to wrap that code into a function inside the class, but for some reason it won't work unless it's inlined at the start.

Those are just warnings, but I think they need to be silenced somehow, in C this just would be a job for #defines but honestly I don't have multiplatform Python experience.

There's a huge volume of them, drowning out any significant log output. And they look like real errors, which can be misleading to a potential user who thinks their system is broken. Here's the output on my system, where I tried to pointlessly fix ALSA for an hour on first run:

[01/23/24 16:18:17] INFO No mic index provided, using default
ALSA lib pcm.c:2675:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.rear ALSA lib pcm.c:2675:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.center_lfe ALSA lib pcm.c:2675:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.side ALSA lib pcm_route.c:878:(find_matching_chmap) Found no matching channel map ALSA lib pcm_route.c:878:(find_matching_chmap) Found no matching channel map ALSA lib pcm_route.c:878:(find_matching_chmap) Found no matching channel map ALSA lib pcm_route.c:878:(find_matching_chmap) Found no matching channel map ALSA lib pcm_oss.c:397:(_snd_pcm_oss_open) Cannot open device /dev/dsp ALSA lib pcm_oss.c:397:(_snd_pcm_oss_open) Cannot open device /dev/dsp ALSA lib pcm_a52.c:1001:(_snd_pcm_a52_open) a52 is only for playback ALSA lib confmisc.c:160:(snd_config_get_card) Invalid field card ALSA lib pcm_usb_stream.c:482:(_snd_pcm_usb_stream_open) Invalid card 'card' ALSA lib confmisc.c:160:(snd_config_get_card) Invalid field card ALSA lib pcm_usb_stream.c:482:(_snd_pcm_usb_stream_open) Invalid card 'card' ALSA lib dlmisc.c:339:(snd_dlobj_cache_get0) Cannot open shared library libasound_module_pcm_bluealsa.so (/usr/lib/alsa-lib/libasound_module_pcm_bluealsa.so: cannot open shared object file: No such file or directory) ALSA lib dlmisc.c:339:(snd_dlobj_cache_get0) Cannot open shared library libasound_module_pcm_bluealsa.so (/usr/lib/alsa-lib/libasound_module_pcm_bluealsa.so: cannot open shared object file: No such file or directory) ALSA lib pcm.c:2675:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.rear ALSA lib pcm.c:2675:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.center_lfe ALSA lib pcm.c:2675:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.side ALSA lib pcm_route.c:878:(find_matching_chmap) Found no matching channel map ALSA lib pcm_route.c:878:(find_matching_chmap) Found no matching channel map ALSA lib pcm_route.c:878:(find_matching_chmap) Found no matching channel map ALSA lib pcm_route.c:878:(find_matching_chmap) Found no matching channel map ALSA lib pcm_oss.c:397:(_snd_pcm_oss_open) Cannot open device /dev/dsp ALSA lib pcm_oss.c:397:(_snd_pcm_oss_open) Cannot open device /dev/dsp ALSA lib pcm_a52.c:1001:(_snd_pcm_a52_open) a52 is only for playback ALSA lib confmisc.c:160:(snd_config_get_card) Invalid field card ALSA lib pcm_usb_stream.c:482:(_snd_pcm_usb_stream_open) Invalid card 'card' ALSA lib confmisc.c:160:(snd_config_get_card) Invalid field card ALSA lib pcm_usb_stream.c:482:(_snd_pcm_usb_stream_open) Invalid card 'card' ALSA lib dlmisc.c:339:(snd_dlobj_cache_get0) Cannot open shared library libasound_module_pcm_bluealsa.so (/usr/lib/alsa-lib/libasound_module_pcm_bluealsa.so: cannot open shared object file: No such file or directory) ALSA lib dlmisc.c:339:(snd_dlobj_cache_get0) Cannot open shared library libasound_module_pcm_bluealsa.so (/usr/lib/alsa-lib/libasound_module_pcm_bluealsa.so: cannot open shared object file: No such file or directory) [01/23/24 16:18:18] INFO Mic setup complete INFO Listening... ALSA lib pcm_dmix.c:1000:(snd_pcm_dmix_open) unable to open slave ALSA lib pcm.c:2675:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.rear ALSA lib pcm.c:2675:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.center_lfe ALSA lib pcm.c:2675:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.side ALSA lib pcm_route.c:878:(find_matching_chmap) Found no matching channel map ALSA lib pcm_oss.c:397:(_snd_pcm_oss_open) Cannot open device /dev/dsp ALSA lib pcm_oss.c:397:(_snd_pcm_oss_open) Cannot open device /dev/dsp ALSA lib pcm_a52.c:1001:(_snd_pcm_a52_open) a52 is only for playback ALSA lib confmisc.c:160:(snd_config_get_card) Invalid field card ALSA lib pcm_usb_stream.c:482:(_snd_pcm_usb_stream_open) Invalid card 'card' ALSA lib confmisc.c:160:(snd_config_get_card) Invalid field card ALSA lib pcm_usb_stream.c:482:(_snd_pcm_usb_stream_open) Invalid card 'card' ALSA lib dlmisc.c:339:(snd_dlobj_cache_get0) Cannot open shared library libasound_module_pcm_bluealsa.so (/usr/lib/alsa-lib/libasound_module_pcm_bluealsa.so: cannot open shared object file: No such file or directory) ALSA lib dlmisc.c:339:(snd_dlobj_cache_get0) Cannot open shared library libasound_module_pcm_bluealsa.so (/usr/lib/alsa-lib/libasound_module_pcm_bluealsa.so: cannot open shared object file: No such file or directory) ALSA lib pcm_dmix.c:1000:(snd_pcm_dmix_open) unable to open slave

mallorbc commented 6 months ago

Yeah perhaps we should log to the terminal that there may be a warning and that the program is working fine.

BenWolfaardt commented 1 month ago

I see there is some cross posting, I get the same warning.

https://github.com/mallorbc/whisper_mic/issues/72#issuecomment-2132146439