MayaFlux 0.3.0
Digital-First Multimedia Processing Framework
Loading...
Searching...
No Matches

◆ rms_combined()

MAYAFLUX_API double MayaFlux::rms_combined ( const std::vector< Kakshya::DataVariant > &  channels)

Calculate RMS energy across all channels (mix then analyze)

Parameters
channelsVector of channel data
Returns
Single RMS value across all mixed channels

Definition at line 112 of file Yantra.cpp.

113{
114 auto data = Yantra::OperationHelper::extract_numeric_data(channels);
115 if (is_same_size(data)) {
116 auto result = rms_per_channel(channels);
117 double sum_squares = 0.0;
118 for (double rms_val : result) {
119 sum_squares += rms_val * rms_val;
120 }
121 return std::sqrt(sum_squares / result.size());
122 } else {
123 auto mixed = concat_vectors(data);
124 return rms(mixed);
125 }
126}
double rms(const std::vector< double > &data)
Calculate RMS (Root Mean Square) energy of single-channel data.
Definition Yantra.cpp:84
static bool is_same_size(const std::vector< std::span< double > > &data)
Definition Yantra.cpp:14
static std::vector< double > concat_vectors(const std::vector< std::span< double > > &data)
Definition Yantra.cpp:24
std::vector< double > rms_per_channel(const std::vector< Kakshya::DataVariant > &channels)
Calculate RMS energy per channel for multi-channel data.
Definition Yantra.cpp:100

References concat_vectors(), MayaFlux::Yantra::OperationHelper::extract_numeric_data(), is_same_size(), rms(), and rms_per_channel().

+ Here is the call graph for this function: