scottlawsonbc / audio-reactive-led-strip

:musical_note: :rainbow: Real-time LED strip music visualization using Python and the ESP8266 or Raspberry Pi
MIT License
2.68k stars 644 forks source link

quick sequential flash of strip, not responding to audio #229

Open Tallis161 opened 5 years ago

Tallis161 commented 5 years ago

So i got the usb audio config working, it's the system default, then i fixed a weird issue where my mic was muted by default under amixer. then I got visualization running, starting at 30fps before dropping to 6, all while doing a constant quick flash up the whole strip every second or two. I've tried changing the volume threshold parameter and the mic level in alsamixer, neither worked. I was actually getting better results at the start, now when I run it I get this returned:

ALSA lib pcm.c:2565:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.rear ALSA lib pcm.c:2565:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.center_lfe ALSA lib pcm.c:2565:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.side ALSA lib pcm.c:2565:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.hdmi ALSA lib pcm.c:2565:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.hdmi ALSA lib pcm.c:2565:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.modem ALSA lib pcm.c:2565:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.modem ALSA lib pcm.c:2565:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.phoneline ALSA lib pcm.c:2565:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.phoneline Cannot connect to server socket err = No such file or directory Cannot connect to server request channel jack server is not running or cannot be started JackShmReadWritePtr::~JackShmReadWritePtr - Init not done for -1, skipping unlock JackShmReadWritePtr::~JackShmReadWritePtr - Init not done for -1, skipping unlock

I'm not sure if the problem is actually being able to read the audio, I thought that was solved as it was giving me the no volume detected error before, but since unmuting the mic it gets signal, but the script isnt responding to the sound with the lights. I'd appreciate help fixing this :)

joeybab3 commented 5 years ago

Just out of curiosity, have you tried testing the light strip works on its own without the software running, such as if you run a test program instead?

In addition, what platform are you on?

Tallis161 commented 5 years ago

Yes, I tested the lights. I'm using an RPi with Ws2812b strip and it controls the lights just fine, with audio configured it records audio fine. I can't get the two to work together with the visualisation code.

joeybab3 commented 5 years ago

Are you using Jack for loopback audio processing, I'm assuming so from the output.

Tallis161 commented 5 years ago

No, using usb audio adapter, I verified its picking up signal with a test recording. it displays the jack error even when you're not using jack, it's an error that apparently does t matter.

Tallis161 commented 5 years ago

so i've managed a new behaviour, it will flash some lights, about 40 of 300 while getting about 5fps for about 5-10 seconds, before I think it hits an overflow and begins flashing the whole strip, though this time its the whole strip pulsing at once, not sequential.

I also get this code. still the same

Expression 'alsa_snd_pcm_hw_params_set_period_size_near( pcm, hwParams, &alsaPeriodFrames, &dir )' failed in 'src/hostapi/alsa/pa_linux_alsa.c', line: 924 ALSA lib pcm.c:2565:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.rear ALSA lib pcm.c:2565:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.center_lfe ALSA lib pcm.c:2565:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.side ALSA lib pcm.c:2565:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.hdmi ALSA lib pcm.c:2565:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.hdmi ALSA lib pcm.c:2565:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.modem ALSA lib pcm.c:2565:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.modem ALSA lib pcm.c:2565:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.phoneline ALSA lib pcm.c:2565:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.phoneline Cannot connect to server socket err = No such file or directory Cannot connect to server request channel jack server is not running or cannot be started JackShmReadWritePtr::~JackShmReadWritePtr - Init not done for -1, skipping unlock JackShmReadWritePtr::~JackShmReadWritePtr - Init not done for -1, skipping unlock

but I also get this code, which is new.

^CTraceback (most recent call last): File "visualization.py", line 356, in microphone.start_stream(microphone_update) File "/home/pi/arls/python/microphone.py", line 19, in start_stream y = np.fromstring(stream.read(frames_per_buffer, exception_on_overflow=False), dtype=np.int16) File "/usr/lib/python2.7/dist-packages/pyaudio.py", line 608, in read return pa.read_stream(self._stream, num_frames, exception_on_overflow) KeyboardInterrupt

So I guess maybe progress? I was thinking it had something to do with levels, I tried changing the input threshold to -3 instead of -7, I'd already set a normal level for the input at about 50% in alsa mixer. I'm really not sure what else to try as the audio seems to work from arecord, even without specifying the default card. strandtest works fine too. I'm not using the jack audio, from my googling it just comes up as a failed connection even if you're not trying to use it. I have the usb audio set to default, it should be receiving the signal. I'm going to try with the gui though im running headless, maybe it can shed some light on the input signal.

Tallis161 commented 5 years ago

ok so i dont have pyqtgraph to run the gui. and i doubt it'll fix the problem anyway, unless im missing something. i'm also running off a pi zero w but I can get a mini hdmi adapter, plug in a usb hub for a mouse and keyboard and try running without ssh on my display.

joeybab3 commented 5 years ago

What are you using to power the LEDs?

Tallis161 commented 5 years ago

5v 3A supply, also connected to pi ground pin 6. It seems to control it just fine, the strand test works normally. Then I had audio issues, but that seems solved as I can record and got the levels reasonable.

On 21 Aug. 2019 1:05 am, "Joey Babcock" notifications@github.com wrote:

What are you using to power the LEDs?

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/scottlawsonbc/audio-reactive-led-strip/issues/229?email_source=notifications&email_token=AM3ZEIN2X5J5N6ARET3WB7DQFQB3TA5CNFSM4IKZTKC2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD4WTTIQ#issuecomment-523057570, or mute the thread https://github.com/notifications/unsubscribe-auth/AM3ZEIMHJYE4EOPY6DRU65DQFQB3TANCNFSM4IKZTKCQ .