I've noticed that the difference between successive integers affects the volume the most, for example, if the first integer is 4000 and then next integer is -4000, then this is an 8000 difference. This 8000 difference is louder than say a 4000 difference.
At first, I thought, ok this difference is the volume, but it is more complicated than this. For example, if an 8000 for 1/100 second is one particular volume, where the 8000 for 1/1000 second is much less volume. My point is that even though I can find differences in the wav file of say 20000, they only exist for very small amounts of time and create much less volume than the 20000 difference would if it were longer.
Is there an algorithm to look at this and estimate the volume?