Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ALSA error #138

Open
miguelhg9211 opened this issue Mar 24, 2024 · 14 comments
Open

ALSA error #138

miguelhg9211 opened this issue Mar 24, 2024 · 14 comments

Comments

@miguelhg9211
Copy link

Describe the bug
A clear and concise description of what the bug is.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

@akashkuttappa
Copy link

The mystical fix called out here of importing sounddevice fixed all the ALSA errors for me on Ubuntu 23.10 (Raspberry Pi)

@tyfiero
Copy link
Collaborator

tyfiero commented Mar 29, 2024

Have you tried this fix @miguelhg9211?

@akashkuttappa
Copy link

The mystical fix called out here of importing sounddevice fixed all the ALSA errors for me on Ubuntu 23.10 (Raspberry Pi)

@hpsaturn you can try this to resolve the ALSA error

@hpsaturn
Copy link
Contributor

I tried this but nothing. I added software/pyproject.toml and reinstalling the app, but nothing. Also I removed my .asoundrc config file and other alsa configs but nothing. I can't hear anything and also I think it is not capturing anything too, and also one problem more, after some time of tries with the spacebar the application has a exception:

Complete output details: (clickme)
Starting...                                                                                                                                                                   

INFO:     Started server process [3333027]
INFO:     Waiting for application startup.

Ready.                                                                                                                                                                        

INFO:     Application startup complete.
INFO:     Uvicorn running on http://0.0.0.0:10001 (Press CTRL+C to quit)
ALSA lib pcm_dsnoop.c:638:(snd_pcm_dsnoop_open) unable to open slave
ALSA lib pcm_dmix.c:1075:(snd_pcm_dmix_open) unable to open slave
ALSA lib pcm.c:2660:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.rear
ALSA lib pcm.c:2660:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.center_lfe
ALSA lib pcm.c:2660:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.side
ALSA lib pcm_oss.c:377:(_snd_pcm_oss_open) Unknown field port
ALSA lib pcm_oss.c:377:(_snd_pcm_oss_open) Unknown field port
ALSA lib pcm_a52.c:823:(_snd_pcm_a52_open) a52 is only for playback
ALSA lib pcm_usb_stream.c:486:(_snd_pcm_usb_stream_open) Invalid type for card
ALSA lib pcm_usb_stream.c:486:(_snd_pcm_usb_stream_open) Invalid type for card
ALSA lib pcm_dmix.c:1075:(snd_pcm_dmix_open) unable to open slave
INFO:     ('127.0.0.1', 36132) - "WebSocket /" [accepted]

Hold the spacebar to start recording. Press CTRL-C to exit.INFO:     connection open

Cannot call "receive" once a disconnect message has been received.
Recording started...
Recording stopped.
Recording started...
Recording stopped.
INFO:     ('127.0.0.1', 45220) - "WebSocket /" [accepted]
INFO:     connection open

Hold the spacebar to start recording. Press CTRL-C to exit.
Task exception was never retrieved
future: <Task finished name='Task-21' coro=<Device.message_sender() done, defined at /home/avp/tmp/src/openia_01/software/source/clients/base_device.py:243> exception=ConnectionClosedError(None, Close(code=<CloseCode.INTERNAL_ERROR: 1011>, reason='keepalive ping timeout'), None)>
Traceback (most recent call last):
  File "/home/avp/.cache/pypoetry/virtualenvs/01os-Niq43RoY-py3.9/lib/python3.9/site-packages/websockets/legacy/protocol.py", line 963, in transfer_data
    message = await self.read_message()
  File "/home/avp/.cache/pypoetry/virtualenvs/01os-Niq43RoY-py3.9/lib/python3.9/site-packages/websockets/legacy/protocol.py", line 1033, in read_message
    frame = await self.read_data_frame(max_size=self.max_size)
  File "/home/avp/.cache/pypoetry/virtualenvs/01os-Niq43RoY-py3.9/lib/python3.9/site-packages/websockets/legacy/protocol.py", line 1108, in read_data_frame
    frame = await self.read_frame(max_size)
  File "/home/avp/.cache/pypoetry/virtualenvs/01os-Niq43RoY-py3.9/lib/python3.9/site-packages/websockets/legacy/protocol.py", line 1165, in read_frame
    frame = await Frame.read(
  File "/home/avp/.cache/pypoetry/virtualenvs/01os-Niq43RoY-py3.9/lib/python3.9/site-packages/websockets/legacy/framing.py", line 68, in read
    data = await reader(2)
  File "/usr/lib/python3.9/asyncio/streams.py", line 723, in readexactly
    await self._wait_for_data('readexactly')
  File "/usr/lib/python3.9/asyncio/streams.py", line 517, in _wait_for_data
    await self._waiter
asyncio.exceptions.CancelledError

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/home/avp/tmp/src/openia_01/software/source/clients/base_device.py", line 249, in message_sender
    await websocket.send(json.dumps(message))
  File "/home/avp/.cache/pypoetry/virtualenvs/01os-Niq43RoY-py3.9/lib/python3.9/site-packages/websockets/legacy/protocol.py", line 635, in send
    await self.ensure_open()
  File "/home/avp/.cache/pypoetry/virtualenvs/01os-Niq43RoY-py3.9/lib/python3.9/site-packages/websockets/legacy/protocol.py", line 939, in ensure_open
    raise self.connection_closed_exc()
websockets.exceptions.ConnectionClosedError: sent 1011 (internal error) keepalive ping timeout; no close frame received
Recording started...
Recording stopped.
Cannot call "receive" once a disconnect message has been received.
INFO:     connection closed
Recording started...
Recording stopped.

@hpsaturn
Copy link
Contributor

hpsaturn commented Apr 5, 2024

I synced the repo, and I don't know, maybe the problem is not ALSA? maybe has relation with the socket and communication with the engine? After some minutes, I had this exception:

Starting...                                                                                                                                    

INFO:     Started server process [835877]
INFO:     Waiting for application startup.

Ready.                                                                                                                                         

INFO:     Application startup complete.
INFO:     Uvicorn running on http://0.0.0.0:10001 (Press CTRL+C to quit)
ALSA lib pcm_dsnoop.c:638:(snd_pcm_dsnoop_open) unable to open slave
ALSA lib pcm_dmix.c:1075:(snd_pcm_dmix_open) unable to open slave
ALSA lib pcm.c:2660:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.rear
ALSA lib pcm.c:2660:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.center_lfe
ALSA lib pcm.c:2660:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.side
ALSA lib pcm_dsnoop.c:638:(snd_pcm_dsnoop_open) unable to open slave
ALSA lib pcm_dmix.c:1075:(snd_pcm_dmix_open) unable to open slave
ALSA lib pcm_dmix.c:1075:(snd_pcm_dmix_open) unable to open slave
INFO:     ('127.0.0.1', 36278) - "WebSocket /" [accepted]
INFO:     connection open

Hold the spacebar to start recording. Press CTRL-C to exit.
 Cannot call "receive" once a disconnect message has been received.
Recording started...
Recording stopped.

INFO:     ('127.0.0.1', 53700) - "WebSocket /" [accepted]

Hold the spacebar to start recording. Press CTRL-C to exit.
INFO:     connection open
INFO:     connection closed
Task exception was never retrieved
future: <Task finished name='Task-24' coro=<Device.message_sender() done, defined at /home/avp/tmp/src/openia_01/software/source/clients/base_device.py:245> exception=ConnectionClosedError(Close(code=1011, reason='keepalive ping timeout'), Close(code=1011, reason='keepalive ping timeout'), True)>
Traceback (most recent call last):
  File "/home/avp/tmp/src/openia_01/software/source/clients/base_device.py", line 251, in message_sender
    await websocket.send(json.dumps(message))
  File "/home/avp/.cache/pypoetry/virtualenvs/01os-Niq43RoY-py3.9/lib/python3.9/site-packages/websockets/legacy/protocol.py", line 635, in send
    await self.ensure_open()
  File "/home/avp/.cache/pypoetry/virtualenvs/01os-Niq43RoY-py3.9/lib/python3.9/site-packages/websockets/legacy/protocol.py", line 939, in ensure_open
    raise self.connection_closed_exc()
websockets.exceptions.ConnectionClosedError: received 1011 (internal error) keepalive ping timeout; then sent 1011 (internal error) keepalive ping timeout
Recording started...
Recording stopped.
Cannot call "receive" once a disconnect message has been received.

@rbrisita
Copy link
Contributor

rbrisita commented Apr 5, 2024

The mystical fix called out here of importing sounddevice fixed all the ALSA errors for me on Ubuntu 23.10 (Raspberry Pi)

This worked for me. Thank you! These are the steps to take with poetry:

poetry shell
pip3 install sounddevice

After install, exit shell, open software\start.py and add as the last import import sounddevice. Running poetry run 01 --model gpt-4-turbo should run without OP's errors.

@mysticaltech
Copy link

@rbrisita That fixed it indeed, wonderful work. You should PR this 🚀

@hpsaturn
Copy link
Contributor

hpsaturn commented Apr 6, 2024

@rbrisita thanks for your comment, I did that, and sounds that it fix fixes the ALSA issue, but after that I had the next exception:

  File "/home/avp/.cache/pypoetry/virtualenvs/01os-Niq43RoY-py3.9/lib/python3.9/site-packages/websockets/legacy/server.py", line 49, in <module>
    from .compatibility import asyncio_timeout
ImportError: cannot import name 'asyncio_timeout' from partially initialized module 'websockets.legacy.compatibility' (most likely due to a circular import) (/home/avp/.cache/pypoetry/virtualenvs/01os-Niq43RoY-py3.9/lib/python3.9/site-packages/websockets/legacy/compatibility.py)

with entering to shell again and installing this missing package: pip3 install asyncio, I don't have the ALSA errors 🍾🍾, but it doesn't works yet, I don't have recording messages or any sound:

:software$ poetry run 01 --model gpt-4-turboStarting...                                                                                                                                    

INFO:     Started server process [137759]
INFO:     Waiting for application startup.

Ready.                                                                                                                                         

INFO:     Application startup complete.
INFO:     Uvicorn running on http://0.0.0.0:10001 (Press CTRL+C to quit)
Recording started...
Recording stopped.
Recording started...
Recording stopped.

@rbrisita
Copy link
Contributor

rbrisita commented Apr 7, 2024

@rbrisita That fixed it indeed, wonderful work. You should PR this 🚀

Created!

@rbrisita
Copy link
Contributor

rbrisita commented Apr 7, 2024

@rbrisita thanks for your comment, I did that, and sounds that it fix fixes the ALSA issue, but after that I had the next exception:

  File "/home/avp/.cache/pypoetry/virtualenvs/01os-Niq43RoY-py3.9/lib/python3.9/site-packages/websockets/legacy/server.py", line 49, in <module>
    from .compatibility import asyncio_timeout
ImportError: cannot import name 'asyncio_timeout' from partially initialized module 'websockets.legacy.compatibility' (most likely due to a circular import) (/home/avp/.cache/pypoetry/virtualenvs/01os-Niq43RoY-py3.9/lib/python3.9/site-packages/websockets/legacy/compatibility.py)

with entering to shell again and installing this missing package: pip3 install asyncio, I don't have the ALSA errors 🍾🍾, but it doesn't works yet, I don't have recording messages or any sound:

:software$ poetry run 01 --model gpt-4-turboStarting...                                                                                                                                    

INFO:     Started server process [137759]
INFO:     Waiting for application startup.

Ready.                                                                                                                                         

INFO:     Application startup complete.
INFO:     Uvicorn running on http://0.0.0.0:10001 (Press CTRL+C to quit)
Recording started...
Recording stopped.
Recording started...
Recording stopped.

I never encountered an issue with asyncio. I have had most success with a X11 and systemd Linux distro and using Python 3.10. I recommend the combination of pyenv and poetry when creating the environment.

@hpsaturn
Copy link
Contributor

hpsaturn commented Apr 7, 2024

Thanks @rbrisita for your reply

I never encountered an issue with asyncio. I have had most success with a X11 and systemd Linux distro and using Python 3.10. I recommend the combination of pyenv and poetry when creating the environment.

but please can you clarify that. I'm Android and esp32 developer, my knows around Python is only for some things. Right now I have Python 3.9.2 in my system, and I did the 01 guide to install it. But you mentioned that we should use pyenv better? that means first generate a env with python 3.10, and then run poetry into it?

@rbrisita
Copy link
Contributor

rbrisita commented Apr 7, 2024

Correct but unfortunately, I can't be much help with Android. I suggest trying to get a Debian based OS and boot from USB or SD Card. Look into a pyenv tutorial to better understand its usage.

@hpsaturn
Copy link
Contributor

hpsaturn commented Apr 7, 2024

Sorry, maybe my message was not clear, but I'm using Debian. Please review my previous messages. I'm not using Android for this, I'm trying to this development runs in Debian for first time..

@rbrisita
Copy link
Contributor

rbrisita commented Apr 7, 2024

All good. My recommendation with pyenv still stands. To add, when installing a Python version make sure the dependencies it needs are installed to have a clean install. For instance, I had to install libsqlite3 when it complained it couldn't find it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants