MikeCoder96 / HappyLighting-py

HappyLight BLE communication using Bleak (QHM Led Controller)
GNU Affero General Public License v3.0
20 stars 5 forks source link

Nogui #14

Closed read-0nly closed 1 year ago

read-0nly commented 1 year ago
python .\cmdver.py /c "scan;connect;on;color 0,0,255;wait;color 128,255,255;wait;color 255,0,0;wait;off;quit"
MikeCoder96 commented 1 year ago

Thanks for this super support, really appreciate <3

read-0nly commented 1 year ago

Happily! Got distracted by audio visualization lol, it's still a hardcoded mess while I tune things but this is what's cooking

https://www.youtube.com/watch?v=ShN7VwWv5Ak https://www.youtube.com/watch?v=0bxw485zAa8 Right now it's just a matter of calling "audio FILENAME" but once I've got it behaving I'll add ways to tune and customize the visualizer from commands and file another PR

MikeCoder96 commented 1 year ago

Not totally clear to me. Are you trying to improve the audio part?

read-0nly commented 1 year ago

Oh, I might have veered off without checking if it was already done lol - had you build an audio visualizer in here? I've been sorta myopically hacking away at this - been wanting to put together a FFT-driven audio visualizer for a while, something that encodes both pitch and pulse. If it's already something you implemented I'll take a look at what you made instead - maybe a third option would work, where it takes some python as input and applies it to all WAV frames, then users could feed in their own processing logic

MikeCoder96 commented 1 year ago

I've already implemented it but for microphone due to the fact that sometime I like to listen music from my Bluetooth speaker.

Here: https://github.com/MikeCoder96/HappyLighting-py/blob/master/LEDStripController/ExternalAudio.py

Need to be improved or reworked

read-0nly commented 1 year ago

lmao this keeps happening - ExternalAudio is exactly what I was looking for and it does it so much better than I was doing it. On windows 10 Stereo Mix can be enabled to loop-back system audio to microphones, it then gets picked up fine without changing the way you implemented it. I like the effect you programmed, though I'd still like to be able to save/load visualizer logic - so i'll start playing with an idea for feeding/swapping what visualize_spectrum does at runtime. This other tool I use for video editing, ffglitch, lets you feed in javascript then executes that javascript on every frame - something like that would be cool here too

Edit: I'm not making sense of how this is getting filtered down, it looks like it's just the lowest freq bins that are exciting the LEDs but I'm not seeing how it's filtering out the high-freq stuff. Could you point me in the direction of the culprit? Mostly just so I understand how you're doing this - it's much smarter than the bruteforce approach I was taking.

Edit part 2 electric boogaloo: "Exponential smoothing...acting as low-pass filters to remove high-frequency noise" - I think I'm on track now

Edit the third: I think I get it now, and I got my fft-bucket>hue effect I was trying to get working and a way to live-swap visualizers, will keep cleaning this up and undo the hacking I did on ExternalAudio then start another PR.