RealtimeSTT icon indicating copy to clipboard operation
RealtimeSTT copied to clipboard

issue with microphone

Open UniversalTechno opened this issue 2 years ago • 4 comments

dear

my card sound working fine but with your program i tried many change in my ubuntun pci sound configuration but its not working and giving me errors ALSA lib pcm_dmix.c:1032:(snd_pcm_dmix_open) unable to open slave ALSA lib pcm_route.c:877:(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 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 pcm_dmix.c:1032:(snd_pcm_dmix_open) unable to open slave

please any helps

UniversalTechno avatar Dec 10 '23 19:12 UniversalTechno

I am no unix expert, maybe anybody can help? Quite sure it's not an issue with the lib, but more the environment. Sry cant help better other than provide what gpt says, maybe it helps.

KoljaB avatar Dec 10 '23 20:12 KoljaB

yes for sure its not about library , its common issue in linux

UniversalTechno avatar Dec 10 '23 21:12 UniversalTechno

Same here

ALSA lib pcm_dsnoop.c:601:(snd_pcm_dsnoop_open) unable to open slave
ALSA lib pcm_dmix.c:1032:(snd_pcm_dmix_open) unable to open slave
ALSA lib pcm.c:2664:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.rear
ALSA lib pcm.c:2664:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.center_lfe
ALSA lib pcm.c:2664:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.side
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 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 pcm_dmix.c:1032:(snd_pcm_dmix_open) unable to open slave

Also find similar issue here: https://github.com/dosbox-staging/dosbox-staging/issues/2821

Environment:

  • Ubuntu 22.04
  • RTX 3090
  • CUDA 12.3
  • The microphone and earphone have two separate slots on my computer; I use an adapter cable to connect a headset with a microphone.
aplay -l

**** List of PLAYBACK Hardware Devices ****
card 0: NVidia [HDA NVidia], device 3: HDMI 0 [HDMI 0]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 0: NVidia [HDA NVidia], device 7: HDMI 1 [HDMI 1]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 0: NVidia [HDA NVidia], device 8: HDMI 2 [HDMI 2]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 0: NVidia [HDA NVidia], device 9: HDMI 3 [HDMI 3]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 1: Generic [HD-Audio Generic], device 0: ALC1220 Analog [ALC1220 Analog]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 1: Generic [HD-Audio Generic], device 1: ALC1220 Digital [ALC1220 Digital]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
  • Issue with Unknown PCM cards.pcm.rear can be ignored according to https://stackoverflow.com/questions/31603555/unknown-pcm-cards-pcm-rear-pyaudio
  • Issue with Cannot open device /dev/dsp can be ignored according to https://stackoverflow.com/questions/16756178/cannot-open-dev-dsp

Still working on resolution.

markyfsun avatar Jan 15 '24 02:01 markyfsun

By setting level=logging.DEBUG, I found that the root cause is about DLL:

RealTimeSTT: root - INFO - Starting RealTimeSTT
RealTimeSTT: root - INFO - Initializing faster_whisper main transcription model tiny
RealTimeSTT: root - INFO - Initializing faster_whisper realtime transcription model tiny
RealTimeSTT: root - INFO - Initializing audio recording (creating pyAudio input stream)
ALSA lib pcm_dsnoop.c:601:(snd_pcm_dsnoop_open) unable to open slave
ALSA lib pcm_dmix.c:1032:(snd_pcm_dmix_open) unable to open slave
ALSA lib pcm.c:2664:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.rear
ALSA lib pcm.c:2664:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.center_lfe
ALSA lib pcm.c:2664:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.side
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 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 pcm_dmix.c:1032:(snd_pcm_dmix_open) unable to open slave
RealTimeSTT: root - DEBUG - Audio recording (pyAudio input stream) initialized successfully
RealTimeSTT: urllib3.connectionpool - DEBUG - Starting new HTTPS connection (1): huggingface.co:443
RealTimeSTT: urllib3.connectionpool - DEBUG - Starting new HTTPS connection (1): huggingface.co:443
RealTimeSTT: urllib3.connectionpool - DEBUG - https://huggingface.co:443 "GET /api/models/Systran/faster-whisper-tiny/revision/main HTTP/1.1" 200 1836
RealTimeSTT: urllib3.connectionpool - DEBUG - https://huggingface.co:443 "GET /api/models/Systran/faster-whisper-tiny/revision/main HTTP/1.1" 200 1836
RealTimeSTT: root - DEBUG - Faster_whisper realtime speech to text transcription model initialized successfully
RealTimeSTT: root - INFO - Initializing WebRTC voice with Sensitivity 3
RealTimeSTT: root - DEBUG - WebRTC VAD voice activity detection engine initialized successfully
RealTimeSTT: root - DEBUG - Faster_whisper main speech to text transcription model initialized successfully
RealTimeSTT: torchaudio._extension - DEBUG - Failed to initialize sox extension
Traceback (most recent call last):
  File "/home/markyfsun/.cache/pypoetry/virtualenvs/parrot-patter-Y87L2jnJ-py3.11/lib/python3.11/site-packages/torchaudio/_extension/__init__.py", line 60, in <module>
    _init_sox()
  File "/home/markyfsun/.cache/pypoetry/virtualenvs/parrot-patter-Y87L2jnJ-py3.11/lib/python3.11/site-packages/torchaudio/_extension/utils.py", line 70, in _init_sox
    _load_lib("libtorchaudio_sox")
  File "/home/markyfsun/.cache/pypoetry/virtualenvs/parrot-patter-Y87L2jnJ-py3.11/lib/python3.11/site-packages/torchaudio/_extension/utils.py", line 64, in _load_lib
    torch.ops.load_library(path)
  File "/home/markyfsun/.cache/pypoetry/virtualenvs/parrot-patter-Y87L2jnJ-py3.11/lib/python3.11/site-packages/torch/_ops.py", line 852, in load_library
    ctypes.CDLL(path)
  File "/home/markyfsun/anaconda3/envs/Bert-VITS2/lib/python3.11/ctypes/__init__.py", line 376, in __init__
    self._handle = _dlopen(self._name, mode)
                   ^^^^^^^^^^^^^^^^^^^^^^^^^
OSError: libsox.so: cannot open shared object file: No such file or directory
RealTimeSTT: torchaudio._extension.utils - DEBUG - Attempting to load FFmpeg version 6.
RealTimeSTT: torchaudio._extension.utils - DEBUG - Failed to load FFmpeg 6 extension.
Traceback (most recent call last):
  File "/home/markyfsun/.cache/pypoetry/virtualenvs/parrot-patter-Y87L2jnJ-py3.11/lib/python3.11/site-packages/torchaudio/_extension/utils.py", line 128, in _find_ffmpeg_extension
    return _find_versionsed_ffmpeg_extension(ffmpeg_ver)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/markyfsun/.cache/pypoetry/virtualenvs/parrot-patter-Y87L2jnJ-py3.11/lib/python3.11/site-packages/torchaudio/_extension/utils.py", line 113, in _find_versionsed_ffmpeg_extension
    _try_access_avutil(ffmpeg_ver)
  File "/home/markyfsun/.cache/pypoetry/virtualenvs/parrot-patter-Y87L2jnJ-py3.11/lib/python3.11/site-packages/torchaudio/_extension/utils.py", line 89, in _try_access_avutil
    torchaudio.lib._torchaudio.find_avutil(libavutil)
RuntimeError: Error in dlopen: libavutil.so.58: cannot open shared object file: No such file or directory
Exception raised from DynamicLibrary at ../aten/src/ATen/DynamicLibrary.cpp:38 (most recent call first):
frame #0: c10::Error::Error(c10::SourceLocation, std::string) + 0x57 (0x7f24c49a5617 in /home/markyfsun/.cache/pypoetry/virtualenvs/parrot-patter-Y87L2jnJ-py3.11/lib/python3.11/site-packages/torch/lib/libc10.so)
frame #1: <unknown function> + 0x109413c (0x7f24a689413c in /home/markyfsun/.cache/pypoetry/virtualenvs/parrot-patter-Y87L2jnJ-py3.11/lib/python3.11/site-packages/torch/lib/libtorch_cpu.so)
frame #2: torchaudio::find_avutil(char const*) + 0x1a (0x7f24428404ca in /home/markyfsun/.cache/pypoetry/virtualenvs/parrot-patter-Y87L2jnJ-py3.11/lib/python3.11/site-packages/torchaudio/lib/libtorchaudio.so)
frame #3: <unknown function> + 0x6f8e (0x7f244936ff8e in /home/markyfsun/.cache/pypoetry/virtualenvs/parrot-patter-Y87L2jnJ-py3.11/lib/python3.11/site-packages/torchaudio/lib/_torchaudio.so)
frame #4: <unknown function> + 0x11847 (0x7f244937a847 in /home/markyfsun/.cache/pypoetry/virtualenvs/parrot-patter-Y87L2jnJ-py3.11/lib/python3.11/site-packages/torchaudio/lib/_torchaudio.so)
frame #5: python() [0x525f07]
<omitting python frames>
frame #8: python() [0x5c82ce]
frame #10: python() [0x5e1623]
frame #11: python() [0x51c107]
frame #14: python() [0x524a53]
frame #17: python() [0x566270]
frame #18: python() [0x51c107]
frame #21: python() [0x524a53]
frame #25: python() [0x5c82ce]
frame #27: python() [0x5e1623]
frame #28: python() [0x51c107]
frame #31: python() [0x524a53]
frame #35: python() [0x5c82ce]
frame #37: python() [0x5e1623]
frame #38: python() [0x51c107]
frame #41: python() [0x524a53]
frame #45: python() [0x5c82ce]
frame #47: python() [0x5e1623]
frame #48: python() [0x51c107]
frame #54: python() [0x53ca72]
frame #57: python() [0x5c82ce]
frame #59: python() [0x5e8807]
frame #60: python() [0x5e4e40]
frame #61: python() [0x5f9132]

RealTimeSTT: torchaudio._extension.utils - DEBUG - Attempting to load FFmpeg version 5.
RealTimeSTT: torchaudio._extension.utils - DEBUG - Failed to load FFmpeg 5 extension.
Traceback (most recent call last):
  File "/home/markyfsun/.cache/pypoetry/virtualenvs/parrot-patter-Y87L2jnJ-py3.11/lib/python3.11/site-packages/torchaudio/_extension/utils.py", line 128, in _find_ffmpeg_extension
    return _find_versionsed_ffmpeg_extension(ffmpeg_ver)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/markyfsun/.cache/pypoetry/virtualenvs/parrot-patter-Y87L2jnJ-py3.11/lib/python3.11/site-packages/torchaudio/_extension/utils.py", line 113, in _find_versionsed_ffmpeg_extension
    _try_access_avutil(ffmpeg_ver)
  File "/home/markyfsun/.cache/pypoetry/virtualenvs/parrot-patter-Y87L2jnJ-py3.11/lib/python3.11/site-packages/torchaudio/_extension/utils.py", line 89, in _try_access_avutil
    torchaudio.lib._torchaudio.find_avutil(libavutil)
RuntimeError: Error in dlopen: libavutil.so.57: cannot open shared object file: No such file or directory
......

It seems that on Linux, RuntimeErrors are ommited unless setting log level to DEBUG.

markyfsun avatar Jan 15 '24 05:01 markyfsun

Just use ffmpeg6, maybe you are using ffmpeg7. Torchaudio is not support ffmpeg7 now

duoduo70 avatar Oct 08 '24 22:10 duoduo70