look into trying a sample rate of 16khz and sample bitsize of 16.
make a methode for the buffer sizes so they reflect the audio format config. following taking from stack overflow
"To see why, you must simply notice that the function in question takes a byte array as an argument and processes each value from that array individually. The byte datatype is an 8-bit value. If you want something that works with 16-bit values, you need to use a different datatype (short) or convert to that from bytes.
Once you do that, you will still get different values for 16 bits vs 8 bit because the range is different: 8 bit goes from -128 to +127 and 16 bit goes from -32768 to +32767, but they are both measuring the same thing, meaning they scaling the same real-word values to different represented values.
As for sound-levels and their relationship to time.... well it depends on your sample rate and the size of the arrays going into this function. For example, if your samplerate is 8kHz and you have 2048 samples per buffer, then your function is going to be called 8000/2048 or about 3.9 times per second, meaning your results are coming in at that rate (every 256 milliseconds)."