MayaFlux 1.0.0
Digital-First Multimedia Processing Framework
Loading...
Searching...
No Matches
MayaFlux::Yantra::WaveformAnalyzerConfig Struct Reference

Settings of a WaveformAnalyzer. More...

#include <WaveformAnalyzer.hpp>

Inheritance diagram for MayaFlux::Yantra::WaveformAnalyzerConfig:
Collaboration diagram for MayaFlux::Yantra::WaveformAnalyzerConfig:

Public Member Functions

 WaveformAnalyzerConfig ()
Public Member Functions inherited from MayaFlux::Yantra::OperationConfig
template<typename Op>
void apply_to (Op &operation) const
 Apply retained concrete settings to an operation through its parent contract.
template<typename T>
const T * get () const
 The struct of this type, or nullptr when absent.
 OperationConfig ()=default
template<typename Config>
requires (!std::same_as<std::remove_cvref_t<Config>, OperationConfig> && std::derived_from<std::remove_cvref_t<Config>, OperationConfig>)
 OperationConfig (Config &&config)
 Retain a concrete config whole when placed in a parent-config collection.
 OperationConfig (const OperationConfig &)=default
 OperationConfig (OperationConfig &&) noexcept=default
OperationConfig & operator= (const OperationConfig &)=default
OperationConfig & operator= (OperationConfig &&) noexcept=default
template<typename T>
void set (T value)
 Stores a struct under its type identity.

Public Attributes

double high_frequency { 400.0 }
 Highest repetition frequency searched, in Hz.
bool keep_profiles { false }
 Keep the autocorrelation and mean difference profile of every window.
double low_frequency { 70.0 }
 Lowest repetition frequency searched, in Hz.
Reflect::EnumByte< WaveformMethod > method { WaveformMethod::LEVEL }
 Value reported as the output data, as a WaveformMethod value.
bool native_float { false }
 Fallback: run the device passes in float32 instead of double.
double sample_rate { 16000.0 }
 Samples per second of the analysed signal.
bool unbiased_periodicity { false }
 Report the strength of the chosen lag divided by the share of window pairs that lag has, so it does not fall with the period.
Public Attributes inherited from MayaFlux::Yantra::AnalyzerConfig
bool classification_enabled { false }
 Whether to classify energy or value levels.
AnalysisGranularity granularity { AnalysisGranularity::RAW_VALUES }
 Level at which the analyzer processes input.
uint32_t hop_size { 128 }
 Distance between successive windows in samples.
uint32_t window_size { 256 }
 Analysis window length in samples.

Detailed Description

Settings of a WaveformAnalyzer.

The passes are double, as every path of the library is. The device runs them on word pairs because 64 bit floats are not guaranteed, and they agree with the Kinesis references to rounding. native_float is a fallback to float32 for a stream that cannot afford them: every pass of a window runs in one float32 kernel, with the lanes of a workgroup sharing the lag search. It keeps no profiles, and a lag whose correlation differs from the best by less than float rounding may be chosen instead of it.

The repetition search covers periods from sample_rate / high_frequency to sample_rate / low_frequency samples, truncated to whole samples. The window must hold at least twice the longest period. The hop is any length above 0.

The strength of a lag is its correlation over the window divided by the correlation at lag 0, and a lag can pair only the samples that lie a lag apart, so a perfectly periodic signal reads at most (window - lag) / window: 0.84 at 200 Hz and 0.55 at 70 Hz for a 1536 sample window at 48 kHz. With unbiased_periodicity the lag is still chosen on that strength, which keeps the shortest of a signal's repeating lags, and the strength reported for it is divided by that share of pairs, so one threshold serves every pitch. A window whose level changes can then read slightly above 1.

Definition at line 72 of file WaveformAnalyzer.hpp.


The documentation for this struct was generated from the following file: