naztronaut / dancyPi-audio-reactive-led

Real-time WS2812b LED strip music visualization using Python and the ESP8266 or Raspberry Pi.
https://www.easyprogramming.net/raspberrypi/audio_reactive_holiday_leds.php
MIT License
244 stars 86 forks source link

Persistent bug with code #16

Open N0WaifuN0Lifu opened 4 years ago

N0WaifuN0Lifu commented 4 years ago

Hi, Total noob with code, so huge thanks for doing this and saving me days if not weeks of trouble learning python to run my LEDs. So I keep running into this error;

Traceback (most recent call last):
  File "visualization.py", line 12, in <module>
    visualization_type = sys.argv[1]
IndexError: list index out of range

I have no idea what I am doing wrong with this. I set up just like you specify, and for a mic I am running a USB audio jack spliter, followed by a 3.5mm audio jack combiner (IE Mic/Audio -> 3.5mm combined jack) to the audio output of my computer set to dual playback. (attached is a diagram).

Any idea what could be causing the error?

image

naztronaut commented 4 years ago

What command are you using? It should be:

sudo python3 visualization.py scroll

The scroll can be "energy" or "spectrum" as well.

I'm a little confused about the diagram. Are you connecting the USB audio jack to your computer? Or your Pi? The "mic" should be connected to your Pi and you can play music on your computer. If you have a picture of your whole set up, I can take a look at the connections.

N0WaifuN0Lifu commented 4 years ago

I got the error to go away! which is great, however I am still running into one more issue. The program runs and the lights turn on, but they have no relation to the mic whatsoever (I can mute the audio and the lights will still continue as if nothing had changed). I tried two different setups, the first was a USB audio splitter, into just a headset with a mic. The second is running it into the audio output port of my PC (essentially mimicking a mic input). Here is the headset (microphone) setup; image

Both ran into this issue with all 3 modes. Mic frequency shouldn't be an issue.

naztronaut commented 4 years ago

That's strange! I wonder if the Pi is picking up some kind of ambient noise somewhere. Can you run this and share the output:

cat /proc/asound/cards

That should output the audio cards attached to your Pi. Just curious if there's something else causing this.

N0WaifuN0Lifu commented 4 years ago

Sorry for the huge delay! Shouldn't have started a project during finals... This is the output pi@Ruppy:~/Desktop/Dancy/dancyPi-audio-reactive-led/python $ cat /proc/asound/cards 0 [ALSA ]: bcm2835_alsa - bcm2835 ALSA bcm2835 ALSA 1 [Device ]: USB-Audio - USB Audio Device C-Media Electronics Inc. USB Audio Device at usb-3f980000.usb-1.5, full speed

naztronaut commented 4 years ago

That's strange! Do the lights still flicker if you disconnect the mic while the app is running? The app may crash but it could be worth a try.

N0WaifuN0Lifu commented 4 years ago

The lights still flicker as if nothing had changed, essentially voiding any output from my computer (or microphone, on that setup). I will need to try something tomorrow, but perhaps my audio slitter jack is messing it up, so ill try the different combinations I have for that tomorrow, will update you if that fixes things. Thanks for the help by the way :) .

naztronaut commented 4 years ago

Sounds good. Good luck!

It may also be worth reinstalling the whole thing. Maybe something funky happened during the set up.