I’m trying have the mic_energy file within the hal package output decibel levels of the sound data it’s reading.
This is the part of the code that I’m looking at (https://github.com/matrix-io/matrix-creator-hal/blob/master/demos/mic_energy.cpp) for lines 46-59:
while (true) {
mics.Read(); /* Reading 8-mics buffer from de FPGA */
instantE = 0;
for (uint32_t s = 0; s < mics.NumberOfSamples(); s++) {
instantE = instantE + (mics.At(s, 0)) * (mics.At(s, 0));
}
localAverage[j % 20] = instantE;
avgEnergy = 0;
for (auto& data : localAverage) {
avgEnergy = (avgEnergy + data);
}
avgEnergy = avgEnergy / 20;
I’m not sure what sort of data is being read by the microphones or what it’s doing to process the sounds. The current documentation doesn’t seem to explain it either.