NoiseReading constructor
Implementation
NoiseReading(List<double> volumes) {
// sort volumes such that the last element is max amplitude
volumes.sort();
// compute average peak-amplitude using the min and max amplitude
double min = volumes.first;
double max = volumes.last;
double mean = 0.5 * (min.abs() + max.abs());
// max amplitude is 2^15
double maxAmp = pow(2, 15) + 0.0;
_maxDecibel = 20 * log(maxAmp * max) * log10e;
_meanDecibel = 20 * log(maxAmp * mean) * log10e;
}