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
239 stars 87 forks source link

python3 compatible #8

Closed brisbaneroboticsclub closed 4 years ago

brisbaneroboticsclub commented 4 years ago

I'm having problems install pyaudio. I had similar problems installing SciPy.... is this Python3 compatible?

naztronaut commented 4 years ago

Yup, from the original Readme by Scott Lawson:

Visualization code is compatible with Python 2.7 or 3.5

PyAudio is a third-party dependency and should also be Python 3 compatible. What problems are you running into?

brisbaneroboticsclub commented 4 years ago

I have installed libraries (scipy/pyaudio), strandtest works. have edited both config files. have edited config.py. I get this error. I am using a pi zero and using the micro usb with a mic.

pi@raspberrypi:~/dancyPi-audio-reactive-led/python $ sudo python3 visualization.py spectrum Traceback (most recent call last): File "visualization.py", line 377, in led.update() File "/home/pi/dancyPi-audio-reactive-led/python/led.py", line 143, in update _update_pi() File "/home/pi/dancyPi-audio-reactive-led/python/led.py", line 107, in _update_pi strip._led_data[i] = rgb[i] File "/usr/local/lib/python3.7/dist-packages/rpi_ws281x-1.0.0-py3.7-linux-armv6l.egg/neopixel.py", line 49, in setitem return ws.ws2811_led_set(self.channel, pos, value) TypeError: in method 'ws2811_led_set', argument 3 of type 'uint32_t'

naztronaut commented 4 years ago

Sorry for the delay @brisbaneroboticsclub. It took me a while to replicate this but I was finally able to. I'm going to work on fixing the repo at some point but in your instance if you're still getting that error, make this change:

In line 107 of led.py (), numpy is sending the wrong type, so change that line to this:

strip._led_data[i] = int(rgb[i])

That should fix the TypeError. Good luck!

naztronaut commented 4 years ago

Actually you can ignore my last response because you were a month ahead of me! I just saw your commit in the latest changes in Scott's repo: https://github.com/naztronaut/dancyPi-audio-reactive-led/commit/cd2ba168efc6e0a93b8961ff44de38eac4b28a2d#diff-d50483273ef30bee89008e0ea5304265

I merged it in earlier into a separate branch.

Great work!