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

◆ spectral_gate()

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

Hard spectral gate: zero bins whose magnitude is below the threshold.

Parameters
srcInput samples
threshold_dbGate threshold in dBFS; bins below are zeroed
window_sizeFFT frame size
hop_sizeAnalysis hop
Returns
Gated output

Definition at line 172 of file Spectral.cpp.

177{
178 const double lin = std::pow(10.0, threshold_db / 20.0);
179
180 return apply_spectral(src, window_size, hop_size,
181 [lin](std::vector<std::complex<double>>& spec, size_t) {
182 for (auto& bin : spec) {
183 if (std::abs(bin) < lin)
184 bin = {};
185 }
186 });
187}
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().

+ Here is the call graph for this function: