35void linear(std::span<double> data,
double a,
double b)
noexcept;
43void power(std::span<double> data,
double exponent)
noexcept;
54 double base = std::numbers::e)
noexcept;
66void logarithmic(std::span<double> data,
double a,
double b,
double c,
67 double base = std::numbers::e)
noexcept;
78template <
typename TrigFunc>
79 requires std::invocable<TrigFunc, double>
80 && std::same_as<std::invoke_result_t<TrigFunc, double>,
double>
85 double phase)
noexcept
87 std::ranges::transform(data, data.begin(),
88 [&](
double x) { return amplitude * func(frequency * x + phase); });
97void clamp(std::span<double> data,
double lo,
double hi)
noexcept;
107void quantize(std::span<double> data, uint8_t bits)
noexcept;
118 double target_min = -1.0,
119 double target_max = 1.0) noexcept;
139void fade(
std::span<
double> data,
140 double fade_in_ratio,
141 double fade_out_ratio) noexcept;
150[[nodiscard]]
std::vector<
double>
slice(
151 std::span<const
double> data,
162[[nodiscard]]
std::vector<
double>
delay(
163 std::span<const
double> data,
164 uint32_t delay_samples,
165 double fill_value = 0.0);
180 std::span<
double> dst) noexcept;
189 std::span<
double> dst) noexcept;
202 std::span<const
double> data,
203 double stretch_factor);
void exponential(std::span< double > data, double a, double b, double base) noexcept
Exponential map y = a * base^(b*x) applied in-place Scalar transcendental — not SIMD hot-path.
void fade(std::span< double > data, double fade_in_ratio, double fade_out_ratio) noexcept
Apply equal-power (cosine) fade-in then fade-out envelope in-place The cosine taper maintains constan...
void linear(std::span< double > data, double a, double b) noexcept
Linear map y = a*x + b applied in-place.
void clamp(std::span< double > data, double lo, double hi) noexcept
Clamp values to [lo, hi] in-place.
void interpolate_cubic(std::span< const double > src, std::span< double > dst) noexcept
Catmull-Rom cubic interpolation from src into dst (caller sizes dst) Branchless boundary clamping; Ho...
std::vector< double > slice(std::span< const double > data, double start_ratio, double end_ratio)
Extract a contiguous slice by ratio, returning a new vector.
std::vector< double > delay(std::span< const double > data, uint32_t delay_samples, double fill_value)
Prepend delay_samples zero-valued (or fill_value) samples, returning a new vector.
void reverse(std::span< double > data) noexcept
Reverse temporal order in-place.
std::vector< double > time_stretch(std::span< const double > data, double stretch_factor)
Time-stretch via linear interpolation resampling Fast but alias-naive: no anti-aliasing pre-filter is...
void normalize(std::span< double > data, double target_min, double target_max) noexcept
Normalize to [target_min, target_max] in-place Single-pass min/max reduction followed by a single tra...
void logarithmic(std::span< double > data, double a, double b, double c, double base) noexcept
Logarithmic map y = a * log_base(b*x + c) applied in-place Values where (b*x + c) <= 0 are mapped to ...
void quantize(std::span< double > data, uint8_t bits) noexcept
Quantize to n-bit resolution in-place Input is assumed to be in [-1, 1]; values outside are clamped f...
void interpolate_linear(std::span< const double > src, std::span< double > dst) noexcept
Linear interpolation from src into dst (caller sizes dst) Branchless inner loop with precomputed step...
std::vector< double > power(std::span< const double > data, size_t n_windows, uint32_t hop_size, uint32_t window_size)
Power (sum of squares) per window.
void apply_trig(std::span< double > data, TrigFunc func, double frequency, double amplitude, double phase) noexcept
Trigonometric map y = amplitude * f(frequency*x + phase) applied in-place.