TobKra96 / music_led_strip_control

Audio visualization for LED strips in real-time with web interface on a raspberry pi.
https://tobkra96.github.io/music_led_strip_control/
MIT License
295 stars 63 forks source link

Master branch doesnt work - IndexError: list index out of range in init_audio_service: #195

Open BjoernRave opened 1 year ago

BjoernRave commented 1 year ago

When trying to start the application after running the automatic script I get the following error:

I have attached a microphone to the pi

I am on a rpi 4b, 128gb sd, latest rpi lite 64 bit

INFO     - __main__                       - Initializing MLSC...
ALSA lib pcm.c:2660:(snd_pcm_open_noupdate) Unknown PCM hdmi:1
ALSA lib pcm.c:2660:(snd_pcm_open_noupdate) Unknown PCM hdmi:1
INFO     - __main__                       - Initialization finished.
INFO     - __main__                       - MLSC started...
INFO     - libs.audio_process_service     - Found the following audio sources:
ERROR    - libs.audio_process_service     - ********************************************************
ERROR    - libs.audio_process_service     - *                      Error                           *
ERROR    - libs.audio_process_service     - ********************************************************
ERROR    - libs.audio_process_service     - Could not find the mic with the id: 0
ERROR    - libs.audio_process_service     - Using the first mic as fallback.
ERROR    - libs.audio_process_service     - Please change the id of the mic inside the config.
ERROR    - libs.audio_process_service     - Could not init AudioService.
ERROR    - libs.audio_process_service     - Unexpected error in init_audio_service: list index out of range
Traceback (most recent call last):
  File "/share/music_led_strip_control/server/libs/audio_process_service.py", line 86, in init_audio_service
    self.selected_device = self._devices[0]
IndexError: list index out of range
Process Process-3:
Traceback (most recent call last):
  File "/usr/lib/python3.9/multiprocessing/process.py", line 315, in _bootstrap
    self.run()
  File "/usr/lib/python3.9/multiprocessing/process.py", line 108, in run
    self._target(*self._args, **self._kwargs)
  File "/share/music_led_strip_control/server/libs/webserver/webserver.py", line 83, in start
    serve(self.server, host='0.0.0.0', port=webserver_port, threads=8)
  File "/usr/local/lib/python3.9/dist-packages/waitress/__init__.py", line 13, in serve
    server = _server(app, **kw)
  File "/usr/local/lib/python3.9/dist-packages/waitress/server.py", line 78, in create_server
    last_serv = TcpWSGIServer(
  File "/usr/local/lib/python3.9/dist-packages/waitress/server.py", line 244, in __init__
    self.bind_server_socket()
  File "/usr/local/lib/python3.9/dist-packages/waitress/server.py", line 361, in bind_server_socket
    self.bind(sockaddr)
  File "/usr/local/lib/python3.9/dist-packages/waitress/wasyncore.py", line 396, in bind
    return self.socket.bind(addr)
OSError: [Errno 98] Address already in use
TobKra96 commented 1 year ago

Hi, this sounds like the mlsc is already running in the background or the audio interface has issues.

at the moment we do not support the 64 bit OS. We haven't tested it. Maybe the pyaudio lib has some troubles.

ghost commented 1 year ago

same issue using RPI 4 with 32bit OS

sameert123 commented 9 months ago

Hi,

I'm also getting a very similar issue using RPI 4B w Tonor G11 - . Have tried troubleshootinng on my own but no dice. If anyone found a solution or has an update it would be much appreciated!

Thank you!

"INFO - main - Initialization finished. INFO - main - MLSC started... INFO - libs.audio_process_service - Found the following audio sources: ERROR - libs.audio_process_service - **** ERROR - libs.audio_process_service - Error ERROR - libs.audio_process_service - **** ERROR - libs.audio_process_service - Could not find the mic with the id: 0 ERROR - libs.audio_process_service - Using the first mic as fallback. ERROR - libs.audio_process_service - Please change the id of the mic inside the config. ERROR - libs.audio_process_service - Could not init AudioService. ERROR - libs.audio_process_service - Unexpected error in init_audio_service: list index out of range Traceback (most recent call last): File "/share/music_led_strip_control/server/libs/audio_process_service.py", line 86, in init_audio_service self.selected_device = self._devices[0]"

Teraskull commented 9 months ago

@sameert123 Can you please try the dev_2.3 branch? The master branch does not have many fixes that are in dev_2.3.

sameert123 commented 9 months ago

@sameert123 Can you please try the dev_2.3 branch? The master branch does not have many fixes that are in dev_2.3.

Hey - sorry total newb here how do I switch the branch? I just used the curl automated installation from the setup guide

Teraskull commented 9 months ago

@sameert123 Use this command:

curl -sSL https://raw.githubusercontent.com/TobKra96/music_led_strip_control/master/setup.sh | sudo bash -s -- -b dev_2.3
sameert123 commented 9 months ago

@sameert123 Use this command:

curl -sSL https://raw.githubusercontent.com/TobKra96/music_led_strip_control/master/setup.sh | sudo bash -s -- -b dev_2.3

Hey - when i try a fresh dev2.3 install i get this error

Installing build dependencies ... done Getting requirements to build wheel ... done Installing backend dependencies ... done Preparing metadata (pyproject.toml) ... error error: subprocess-exited-with-error

× Preparing metadata (pyproject.toml) did not run successfully. │ exit code: 1 ╰─> [43 lines of output]

× Encountered error while generating package metadata. ╰─> See above for output.

note: This is an issue with the package mentioned above, not pip. hint: See above for details.

no clue what this means - any advice?

Teraskull commented 9 months ago

@sameert123 Looks like some package can't be installed on your pi. What's your Pi OS version?

sameert123 commented 9 months ago

It’s the latest 32bit Rpi OS Lite running on a 4B+

sameert123 commented 9 months ago

Should I retry w the full OS

Teraskull commented 9 months ago

Try installing a 64bit OS