70 {
72 Serial.println(
"Loop active...");
73 }
74
75
77 Serial.println(
"Audio source is null!");
79 return;
80 }
81
82
85 Serial.print(
"Audio error: ");
88 return;
89 }
90
91
93
96 const auto& audioBuffer =
sample.pcm();
97 const i16* max_sample =
fl::max_element(audioBuffer.begin(), audioBuffer.end());
98 const i16* min_sample =
fl::min_element(audioBuffer.begin(), audioBuffer.end());
99
101 ss << "\n--- Audio Sample ---\n";
102 ss << "Samples: " << audioBuffer.size() << "\n";
103 ss <<
"Timestamp: " <<
sample.timestamp() <<
" ms\n";
104 ss << "Max: " << *max_sample << "\n";
105 ss << "Min: " << *min_sample << "\n";
106 ss <<
"RMS: " <<
sample.rms() <<
"\n";
107 ss <<
"Zero Crossing Frequency: " <<
sample.zcf() <<
" Hz\n";
109 }
110 }
111}
const char * c_str() const FL_NOEXCEPT
string str() const FL_NOEXCEPT
#define EVERY_N_MILLIS(N)
Checks whether to execute a block of code every N milliseconds.
void delay(u32 ms, bool run_async=true) FL_NOEXCEPT
Public delay wrapper that keeps bare Arduino delay() preferred after using fl::delay; while still all...
Iterator min_element(Iterator first, Iterator last) FL_NOEXCEPT
CRGB sample(const CRGB *grid, const XYMap &xyMap, float x, float y, SampleMode mode)
Sample a pixel from a 2D CRGB grid at floating-point coordinates.
Iterator max_element(Iterator first, Iterator last) FL_NOEXCEPT