5#include "AudioLogger.h"
56 int16_t
clip(int32_t in, int16_t clipLimit = 32767,
57 int16_t resultLimit = 32767) {
59 if (result > clipLimit) {
62 if (result < -clipLimit) {
63 result = -resultLimit;
97 if (!
active())
return input;
99 return factor_q.scale(input);
101 int32_t result =
volume() * input;
141 if (!
active())
return input;
176 v_fixed = (int32_t)(v * 256.0f + (v >= 0 ? 0.5f : -0.5f));
186 if (!
active())
return input;
189 int32_t result2 = (result *
v_fixed) >> 8;
193 int32_t result =
clip(v * input);
247 if (!
active())
return input;
256 signal_depth_q.scale(input) +
257 (int32_t)(((int64_t)tremolo_depth_q.scale(input) *
count) /
268 }
else if (
count <= 0) {
297 float sd = (100.0f -
p_percent) / 100.0f;
321 float feedbackAmount = 1.0, uint32_t
sampleRate = 44100) {
348 inv_depth_q =
q1_14_t(1.0f) - depth_q;
373 if (!
active())
return input;
380 int32_t out = inv_depth_q.scale(input) + depth_q.scale(delayed_value);
385 int32_t write_int = (int32_t)input + feedback_q.scale(delayed_value);
388 int32_t out = ((1.0f -
depth) * input) + (
depth * delayed_value);
392 float write_val = (float)input +
feedback * (
float)delayed_value;
394 int32_t write_int = (int32_t)roundf(write_val);
414 q1_14_t feedback_q{0.0f}, depth_q{0.0f}, inv_depth_q{1.0f};
448 float release = 0.005,
float boostFactor = 1.0) {
482 if (!
active())
return input;
485 return gain.
scale(input);
521 PitchShift(
float shift_value = 1.0,
int buffer_size = 1000) {
543 if (!
active())
return input;
572 Compressor(uint32_t sampleRate = 44100, uint16_t attackMs = 30,
573 uint16_t releaseMs = 20, uint16_t holdMs = 10,
574 uint8_t thresholdPercent = 10,
float compressionRatio = 0.5) {
614 threshold = (int32_t)NumberConverter::maxValueT<effect_t>() *
615 thresholdPercent / 100;
620 if (compressionRatio < 1.0f) {
628 if (!
active())
return input;
669 int32_t mag = inSample < 0 ? -(int32_t)inSample : (int32_t)inSample;
728 return gain.scale(inSample);
long map(long x, long in_min, long in_max, long out_min, long out_max)
Maps input to output values.
Definition Arduino.h:182
#define LOGD(...)
Definition AudioLoggerIDF.h:27
Real-time pitch shifting audio effect implementation.