LedStrip - Audio - Loudness - Printable Version
+- Maniacal Labs User Forum (http://forum.maniacallabs.com)
+-- Forum: BiblioPixel (http://forum.maniacallabs.com/forumdisplay.php?fid=4)
+--- Forum: User Animations (http://forum.maniacallabs.com/forumdisplay.php?fid=6)
+--- Thread: LedStrip - Audio - Loudness (/showthread.php?tid=81)
LedStrip - Audio - Loudness - giovanne - 01-04-2016
I was inpressed from http://jared.geek.nz/2013/jan/sound-reactive-led-lights
I think a very interesting animation.
But how to get this with Bibliopixel working, that
- 1 LEDStrip WS2801 (e.g. 60 LEDs)
- Raspberry Pi SPI
for getting the loudness
and transform into rgb for the leds
- set the leds for the Ws2801 Driver
I already tested https://github.com/ManiacalLabs/BiblioPixelAnimations/blob/master/BiblioPixelAnimations/matrix/FFT_Audio_Animation.py
but this is for LEDMatrix and a Spectrum/Frequency
(btw. how to set the sensitivity for this code? I have to shout into the mic :-(
I think I/we can use the code from the link above combined with Bibliopixel code?
Would be great to get this running.
RE: LedStrip - Audio - Loudness - Adam - 01-04-2016
So... this is definitely a popular one, but live audio processing is kind of a pain in general. It's darn near impossible on windows and seems to be a crap shoot as to if and how it works on Linux. Our FFT animation works on some systems and not really on others. And I didn't write that animation so a bit ashamed to say I'm not 100% sure how it works or how to modify the sensitivity. I'll have to look through it more.
I see no reason the code from the first link wouldn't work.... in the end, it outputs RGB values.
The "noisiness" var gives you the sound level and they take that value and map it to a hue value.
I think the "noisiness" value is 0.0 - 1.0, so I would do something like this
h = int(255*noisiness)
c = colors.hue2rgb(h) #our built-in hue/hsv functions are MUCH faster.
led.fill(c, start=0, end=int(led.numLEDs*noisiness))
Do this in every step() of the animation. You'll get a pulsing bar that changes size and color with the music.
Again, this assumes noisiness is 0.0 - 1.0, the code would be a little different if not, but that assumption made it really easy to cheat at the value mapping.
RE: LedStrip - Audio - Loudness - giovanne - 01-05-2016
Thanks for the hints. Start some Quick&Dirty modifications on the existing FFT/pyaudio UserAnimation to test if it would generally work.
At the moment not so complicated as in the linked example from http://jared.geek.nz/2013/jan/sound-reactive-led-lights
Volume analysed with "audioop": audioop.rms(self.rec.audio, 2)
and calculated in some way to 0.0 -> 1.0 values (not fine at the moment) :-(
I have to read more to the specific topics to understand everything ;-)
Also I have to wait for a better mic, the current cheap one is not so fine (without soundcard).
But the proof of concept is working ;-)
If there is someone with improvements, I'm very interested !!!
Original is from FFT_Audio_Animation.py
RE: LedStrip - Audio - Loudness - giovanne - 01-06-2016
Ok, for the special AUDIO analysis for now I will switch to existing ambi-tv (with audiograbber support) https://github.com/xSnowHeadx/ambi-tv
Directly working with my current cheap mic very well and very configurable also while running and from my Neutrino SAT receiver ;-)
But for the other effects like LarsonScanner I will stay with Bibliopixel ...