64 {
66
68 Serial.println("Audio source is null!");
69 delay(1000);
70 return;
71 }
72
73
76 Serial.print("Audio error: ");
77 Serial.println(errorMsg.
c_str());
78 delay(100);
79 return;
80 }
81
82
84
87 const auto& audioBuffer = sample.
pcm();
88 const i16* max_sample =
fl::max_element(audioBuffer.begin(), audioBuffer.end());
89 const i16* min_sample =
fl::min_element(audioBuffer.begin(), audioBuffer.end());
91 ss <<
"\nRead " << audioBuffer.size() <<
" samples, timestamp: " << sample.
timestamp() <<
"ms\n";
92 ss << "Max sample: " << *max_sample << "\n";
93 ss << "Min sample: " << *min_sample << "\n";
94 ss <<
"RMS: " << sample.
rms() <<
"\n";
95 ss <<
"ZCF: " << sample.
zcf() <<
"\n";
97 }
98 }
99}
const VectorPCM & pcm() const
fl::u32 timestamp() const
const char * c_str() const
const string & str() const
#define EVERY_N_MILLIS(N)
Checks whether to execute a block of code every N milliseconds.
Iterator min_element(Iterator first, Iterator last)
Iterator max_element(Iterator first, Iterator last)