Let me try to understand what you are doing? Because it sounds like you're trying to measure sound volume based on a single sample, which cannot work, it doesn't produce any meaningful results.
You need to do something a little bit more elaborate, such as get a bunch of samples (at least few hundred to few thousand), and calculate RMS for that set.
You could get somewhat usable results if you would take a sample more often, say 100 to 1000 times a second and take the most high absolute value. I often do it to get something that resembles a VU meter on a display: take value, convert to dB, and replace the "current value" by it if it's more than the "current value", otherwise decrease the "current value" a little bit. For a human-readable UI it works if you sample more than 100 times per second and can accept that the value is not very accurate.
But to get exact values: sample, window (perhaps), filter, and calculate RMS.
-Panu
loopback VS10xx Prototyping Board
Re: loopback VS10xx Prototyping Board
Info: Line In and Line Out, VS1000 User interface, Overlay howto, Latest VSIDE, MCU Howto, Youtube
Panu-Kristian Poiksalo
Panu-Kristian Poiksalo