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

◆ harmonic_enhance()

std::vector< double > MayaFlux::Kinesis::Discrete::harmonic_enhance ( std::span< const double >  src,
double  enhancement_factor,
uint32_t  window_size = 1024,
uint32_t  hop_size = 256 
)

Linear spectral tilt: scale each bin by a factor that rises linearly from 1 at bin 0 to enhancement_factor at the Nyquist bin.

This is a first-order spectral emphasis, not a true harmonic detector; caller should be aware that it brightens high-frequency energy uniformly regardless of harmonic * structure.

Parameters
srcInput samples
enhancement_factorGain at the Nyquist bin (> 1 brightens, < 1 darkens)
window_sizeFFT frame size
hop_sizeAnalysis hop
Returns
Enhanced output

Definition at line 155 of file Spectral.cpp.

160{
161 const auto nyquist_bin = static_cast<double>((double)window_size / 2);
162
163 return apply_spectral(src, window_size, hop_size,
164 [enhancement_factor, nyquist_bin](std::vector<std::complex<double>>& spec, size_t) {
165 for (size_t b = 1; b < spec.size(); ++b) {
166 const double t = static_cast<double>(b) / nyquist_bin;
167 spec[b] *= 1.0 + (enhancement_factor - 1.0) * t;
168 }
169 });
170}
size_t b
std::vector< double > apply_spectral(std::span< const double > src, uint32_t window_size, uint32_t hop_size, const SpectrumProcessor &processor)
Apply a per-frame spectrum processor via WOLA analysis-synthesis.
Definition Spectral.cpp:59

References apply_spectral(), and b.

+ Here is the call graph for this function: