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

◆ detect_onsets() [2/2]

MAYAFLUX_API std::vector< double > MayaFlux::detect_onsets ( const std::vector< double > &  data,
double  sample_rate = 48000.0,
double  threshold = 0.1 
)

Detect onset times in single-channel signal.

Parameters
dataInput signal data
sample_rateSample rate for time calculation (default: 48000 Hz)
thresholdEnergy threshold for onset detection (default: 0.1)
Returns
Vector of onset times in seconds

Definition at line 476 of file Yantra.cpp.

477{
478 auto onset_positions = Kinesis::Discrete::onset_positions(
479 std::span<const double>(data.data(), data.size()), 1024, 512, threshold);
480 std::vector<double> times;
481
482 times.reserve(onset_positions.size());
483 for (size_t pos : onset_positions) {
484 times.push_back(static_cast<double>(pos) / sample_rate);
485 }
486 return times;
487}
std::optional< size_t > times

References MayaFlux::Kinesis::Discrete::onset_positions(), and times.

Referenced by detect_onsets_per_channel().

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