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

◆ rms()

float fl::AudioSample::rms ( ) const

Definition at line 65 of file audio.cpp.

65 {
66 if (!isValid()) {
67 return 0.0f;
68 }
69 uint64_t sum_sq = 0;
70 const int N = size();
71 for (int i = 0; i < N; ++i) {
72 int32_t x32 = int32_t(pcm()[i]);
73 sum_sq += x32 * x32;
74 }
75 float rms = sqrtf(float(sum_sq) / N);
76 return rms;
77}
const VectorPCM & pcm() const
Definition audio.cpp:6
bool isValid() const
Definition audio.h:28
float rms() const
Definition audio.cpp:65
size_t size() const
Definition audio.cpp:19

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: