onlaj / Piano-LED-Visualizer

Piano LED Visualizer: Connect an LED strip to your Raspberry Pi and create an immersive visual experience for your piano playing
MIT License
534 stars 112 forks source link

Visualizer not Working #345

Closed psscin01 closed 2 years ago

psscin01 commented 2 years ago

Hi Onlaj,

I have made this project before and it works wonderfully! I tried making it again and I was unable to connect to the visualizer. I am using a Pi zero 2 btw. When I give the command, I receive this error:

Screen Shot 2022-03-25 at 2 53 18 PM

Any thoughts as to what the problem might be? As always, thanks for everything!

onlaj commented 2 years ago

Hello. Seems like there is some problem with mido library. Try to reinstall it with command:

sudo pip3 install --upgrade --force-reinstall mido

psscin01 commented 2 years ago

Awesome! Thanks for the quick reply! That definitely got it working with the command. However, I now seem to need to force it to work instead of it working on boot. Do i need to adjust the crontab file?

Screen Shot 2022-03-25 at 3 08 24 PM
onlaj commented 2 years ago

What do you mean by forcing it to work? It should work just fine from crontab

psscin01 commented 2 years ago

I mean that the visualizer will not run unless I use the command. In other words, I gues the crontab isn't being recognized at boot.

onlaj commented 2 years ago

And what does it look like?

@reboot sudo python3 /home/Piano-LED-Visualizer/visualizer.py &

^ this is the right one

If launching script using command from your screenshot works fine then it should also works from crontab. You can try to reinstall cron just to be sure.

psscin01 commented 2 years ago

Yes, that was the one I have in there. I'm not really sure why it only works from the command line, but I will try reinstalling cron. I apologize for my lack of knowledge, but what would the command be for that?

Another question: Would having another visualizer on simultaneously on the same network effect this one?

onlaj commented 2 years ago

sudo apt-get install --reinstall cron

Would having another visualizer on simultaneously on the same network effect this one?

Yes, it will probably fail at launch because port will be already taken. There is launch command that allows you to change default port for web interface. Or you can disable web interface at all on one of your visualizers.

psscin01 commented 2 years ago

Ah that must be it then. I am trying to run multiple visualizers in a classroom, so that's probably where the problem is coming from. Would I need to find an open port using the command 'netstat -lnu | grep udp | awk '{ print ( $4 ) }' | awk 'BEGIN{FS=":"} { print $(NF) }' | sort -n | uniq'? Then would I direct to that port in the crontab file?

onlaj commented 2 years ago

Yep, the command looks like this:

sudo python3 /home/Piano-LED-Visualizer/visualizer.py --port 5000

I'm not sure how it will work with recently introduced websockets, but those are used only for synchronising sheet music with learning, so it shouldn't be a problem.

psscin01 commented 2 years ago

So I tried to adjust the port in the crontab, but it still wouldn't work. I ran sudo nano /etc/profile and entered sudo python3 /home/Piano-LED-Visualizer/visualizer.py at the bottom of the script there. It worked!