dancyPi-audio-reactive-led icon indicating copy to clipboard operation
dancyPi-audio-reactive-led copied to clipboard

Persistent bug with code

Open N0WaifuN0Lifu opened this issue 4 years ago • 7 comments

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

N0WaifuN0Lifu avatar Aug 05 '20 08:08 N0WaifuN0Lifu

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.

naztronaut avatar Aug 05 '20 17:08 naztronaut

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.

N0WaifuN0Lifu avatar Aug 06 '20 08:08 N0WaifuN0Lifu

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.

naztronaut avatar Aug 09 '20 03:08 naztronaut

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

N0WaifuN0Lifu avatar Aug 14 '20 00:08 N0WaifuN0Lifu

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.

naztronaut avatar Aug 14 '20 03:08 naztronaut

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 :) .

N0WaifuN0Lifu avatar Aug 14 '20 03:08 N0WaifuN0Lifu

Sounds good. Good luck!

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

naztronaut avatar Aug 14 '20 03:08 naztronaut