brightness = matrix - mean + (std * 0.5)
brightness = (brightness / (std * 1.25)) * (1.0 - (attenuate_pct / 100.0))
brightness = clip(brightness, 0.0, 1.0)
For this discussion, attenuation is not enabled, so that's not a factor.
In practice, this effectively clips brightness to a very narrow range. I think it would be easier to understand if I use actual numbers:
mean = 10
std = 2
If the actual value for this interval is 9 or less, the brightness will be 0.0 (off)
If the value is 11.5 or higher, the brightness will be 1.0 (maximum)
Between these two values, it will increase at a linear rate.
The net effect: only values between -0.5SD and +0.75SD will result in any variation in brightness. Everything outside this range will clip to 0.0 or 1.0.
To understand the effect, here's a bell curve that explains how a normal distribution of numbers will fall within the SD thresholds:
If you have difficulty reading the image, here's the direct link: https://www.mathsisfun.com/data/images/normal-distrubution-large.gif
The graph doesn't show 0.75SD, but -0.5SD to +0.75SD will encompass only 46.48% of a normal distribution of random values.
I realize that a particular music track is unlikely to be normally distributed, but this appears to impose a significant limitation on range of brightness, and skew it a bit to the "higher" side of the mean.
I've tried this calculation:
SD = 1.0
brightness = matrix - mean + (std * SD)
brightness = (brightness / (std * SD * 2.0)) * (1.0 - (attenuate_pct / 100.0))
brightness = clip(brightness, 0.0, 1.0)
With this code and the same mean/std, a value of 8.0 and below yields a brightness of 0.0, and a value of 12.0 and above yields a a brightness of 1.0. This encompasses 68.27% of a normal distribution.
I got better results, but I'm sure it's subjective, per the viewer and the music track. But, even SD=0.75 looked better to me, because quieter portions of the track displayed some light activity where it was completely dark with the original calculation.
So, my suggestion is to "recenter" the calculation, so that brightness for a channel is varied from -xSD to +xSD -- whatever x may be. And, I'll also suggest making x (the standard deviation) a configurable parameter, and default it to 0.75 to retain almost the same behavior.
--
http://www.lightshowpi.org/
---
You received this message because you are subscribed to the Google Groups "LightShow Pi Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to lightshowpi-d...@googlegroups.com.
To post to this group, send email to lightsh...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/lightshowpi-dev/42cccf6c-6e4f-4297-8032-97af86946202%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
[edited]
To view this discussion on the web visit https://groups.google.com/d/msgid/lightshowpi-dev/e5bc6a18-0afe-4520-83b1-18cc5a0c003f%40googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/lightshowpi-dev/e145181f-f1ba-43bd-8046-d375364e062b%40googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/lightshowpi-dev/eff93153-083e-434b-9e7c-dac96e749150%40googlegroups.com.
You received this message because you are subscribed to a topic in the Google Groups "LightShow Pi Developers" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/lightshowpi-dev/AnTC1nSBzUc/unsubscribe.
To unsubscribe from this group and all its topics, send an email to lightshowpi-d...@googlegroups.com.
To post to this group, send email to lightsh...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/lightshowpi-dev/f40fe9ea-ab13-4bfb-b5c6-480d5f6dba80%40googlegroups.com.