Performs the mathematical operation specified by m_operation on the input data. Supports both in-place and out-of-place transformations based on transformer settings.
81 {
83
85 const auto a = get_parameter_or<double>(
"gain_factor", 1.0);
88 });
89 }
90
92 const auto b = get_parameter_or<double>(
"offset_value", 0.0);
95 });
96 }
97
99 const auto exp = get_parameter_or<double>("exponent", 2.0);
102 });
103 }
104
106 const auto a = get_parameter_or<double>(
"scale", 1.0);
107 const auto b = get_parameter_or<double>(
"input_scale", 1.0);
108 const auto c = get_parameter_or<double>("offset", 1.0);
109 const auto base = get_parameter_or<double>("base", std::numbers::e);
112 });
113 }
114
116 const auto a = get_parameter_or<double>(
"scale", 1.0);
117 const auto b = get_parameter_or<double>(
"rate", 1.0);
118 const auto base = get_parameter_or<double>("base", std::numbers::e);
121 });
122 }
123
125 const auto fn = get_parameter_or<std::string>("trig_function", "sin");
126 const auto freq = get_parameter_or<double>("frequency", 1.0);
127 const auto amp = get_parameter_or<double>("amplitude", 1.0);
128 const auto ph = get_parameter_or<double>("phase", 0.0);
129 if (fn == "cos")
131 D::apply_trig(ch, [](
double x) {
return std::cos(x); }, freq, amp, ph);
132 });
133 if (fn == "tan")
135 D::apply_trig(ch, [](
double x) {
return std::tan(x); }, freq, amp, ph);
136 });
138 D::apply_trig(ch, [](
double x) {
return std::sin(x); }, freq, amp, ph);
139 });
140 }
141
143 const auto bits = get_parameter_or<uint8_t>("bits", 16);
146 });
147 }
148
150 const auto peak = get_parameter_or<double>(
"target_peak", 1.0);
153 });
154 }
155
157 const auto coeffs = get_parameter_or<std::vector<double>>(
158 "coefficients", std::vector<double> { 0.0, 1.0 });
159 auto poly = std::make_shared<Nodes::Generator::Polynomial>(coeffs);
161 std::ranges::transform(ch, ch.begin(),
162 [&poly](double x) { return poly->process_sample(x); });
163 });
164 }
165
166 default:
168 }
169 }
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 linear(std::span< double > data, double a, double b) noexcept
Linear map y = a*x + b applied in-place.
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...
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.
@ GAIN
Linear gain/attenuation.
@ NORMALIZE
Normalization.
@ QUANTIZE
Quantization/bit reduction.
@ TRIGONOMETRIC
Trigonometric functions.
@ LOGARITHMIC
Logarithmic transform.
@ EXPONENTIAL
Exponential transform.
@ POLYNOMIAL
Polynomial transform.
double peak(const std::vector< double > &data)
Find peak amplitude in single-channel data.