Applies the configured spectral operation.
Extracts per-channel double spans, calls the corresponding Kinesis::Discrete::Spectral primitive on each channel, then reconstructs the typed output via OperationHelper.
FREQUENCY_SHIFT is implemented as a bandpass repositioning matching the prior behaviour. True single-sideband frequency shift (complex exponential modulation) is a separate primitive.
105 {
107
109 const auto shift_hz = get_parameter_or<double>("shift_hz", 0.0);
110 const auto window_size = get_parameter_or<uint32_t>("window_size", 1024);
111 const auto hop_size = get_parameter_or<uint32_t>("hop_size", 512);
112 const auto sample_rate = get_parameter_or<double>("sample_rate", 48000.0);
113 const double lo = std::max(0.0, shift_hz);
114 const double hi = sample_rate / 2.0 + shift_hz;
115
117 [lo, hi, sample_rate, window_size, hop_size](std::span<double> ch) {
119 });
120 }
121
123 const auto pitch_ratio = get_parameter_or<double>("pitch_ratio", 1.0);
124 const auto window_size = get_parameter_or<uint32_t>("window_size", 2048);
125 const auto hop_size = get_parameter_or<uint32_t>("hop_size", 512);
126 const double semitones = 12.0 * std::log2(pitch_ratio);
127
129 [semitones, window_size, hop_size](std::span<double> ch) {
131 });
132 }
133
135 const auto lo_freq = get_parameter_or<double>("low_freq", 20.0);
136 const auto hi_freq = get_parameter_or<double>("high_freq", 20000.0);
137 const auto sample_rate = get_parameter_or<double>("sample_rate", 48000.0);
138 const auto window_size = get_parameter_or<uint32_t>("window_size", 1024);
139 const auto hop_size = get_parameter_or<uint32_t>("hop_size", 512);
140
142 [lo_freq, hi_freq, sample_rate, window_size, hop_size](std::span<double> ch) {
144 });
145 }
146
148 const auto factor = get_parameter_or<double>("enhancement_factor", 2.0);
149 const auto window_size = get_parameter_or<uint32_t>("window_size", 1024);
150 const auto hop_size = get_parameter_or<uint32_t>("hop_size", 512);
151
153 [factor, window_size, hop_size](std::span<double> ch) {
155 });
156 }
157
159 const auto threshold = get_parameter_or<double>(
"threshold", -40.0);
160 const auto window_size = get_parameter_or<uint32_t>("window_size", 1024);
161 const auto hop_size = get_parameter_or<uint32_t>("hop_size", 512);
162
164 [
threshold, window_size, hop_size](std::span<double> ch) {
166 });
167 }
168
169 default:
171 }
172 }
Core::GlobalInputConfig input
std::vector< double > harmonic_enhance(std::span< const double > src, double enhancement_factor, uint32_t window_size, uint32_t hop_size)
Linear spectral tilt: scale each bin by a factor that rises linearly from 1 at bin 0 to enhancement_f...
std::vector< double > spectral_gate(std::span< const double > src, double threshold_db, uint32_t window_size, uint32_t hop_size)
Hard spectral gate: zero bins whose magnitude is below the threshold.
std::vector< double > spectral_filter(std::span< const double > src, double lo_hz, double hi_hz, double sample_rate, uint32_t window_size, uint32_t hop_size)
Hard bandpass filter: zero all bins outside [lo_hz, hi_hz].
std::vector< double > pitch_shift(std::span< const double > src, double semitones, uint32_t window_size, uint32_t analysis_hop)
Pitch-shift by resampling around a phase vocoder stretch.
@ SPECTRAL_FILTER
Hard bandpass filter.
@ SPECTRAL_GATE
Hard magnitude gate.
@ HARMONIC_ENHANCE
Linear spectral tilt.
@ PITCH_SHIFT
Phase-vocoder pitch shift, duration preserved.
@ FREQUENCY_SHIFT
Bandpass repositioning (approximate frequency shift)