MayaFlux 0.1.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 110 of file Yantra.cpp.

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

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: