Ok your code does this
```
rms in [0, 50) -> alpha = 100
rms in [50, 150) -> alpha = ceil(rms)
rms in [150, infinity) -> alpha = 255
```
I don't get why you compare this to electronics because you actually USE the middle part instead of discarding it, you map to more then 2 states.

And do you know how much the rms values spread? Are they always usually between 50 and 150? Or why is 50-150 reasonable?