FastLED 3.9.15
Loading...
Searching...
No Matches

◆ rms()

float fl::AudioSample::rms ( ) const

Definition at line 77 of file audio.cpp.

77 {
78 if (!isValid()) {
79 return 0.0f;
80 }
81 uint64_t sum_sq = 0;
82 const int N = size();
83 for (int i = 0; i < N; ++i) {
84 int32_t x32 = int32_t(pcm()[i]);
85 sum_sq += x32 * x32;
86 }
87 float rms = sqrtf(float(sum_sq) / N);
88 return rms;
89}
const VectorPCM & pcm() const
Definition audio.cpp:18
bool isValid() const
Definition audio.h:28
float rms() const
Definition audio.cpp:77
size_t size() const
Definition audio.cpp:31

References isValid(), pcm(), rms(), and size().

Referenced by rms().

+ Here is the call graph for this function:
+ Here is the caller graph for this function: