Explorar el Código

vmatch124: Fresh Air -> Aether dynamic air model, Doubler -> Gemini measured shifter and timing, H-Delay -> Echoform hybrid loop (measured black-box on the official trials); golden tests

Ka1-S hace 1 mes
padre
commit
54d05bcd62

+ 3 - 0
resources/i18n/pt-BR.txt

@@ -2820,3 +2820,6 @@ countries: br
 "PITCH GRAPH" = "GRÁFICO DE AFINAÇÃO"
 "INPUT" = "ENTRADA"
 "no pitch" = "sem afinação"
+# round 124: Echoform's hybrid engine
+"Hybrid" = "Híbrido"
+"Off|Clean|Analog" = "Desligado|Limpo|Analógico"

+ 89 - 1
src/core/EchoSuite.cpp

@@ -395,6 +395,8 @@ double pitchSemis (float v) noexcept { return 24.0 * bipolar (v); }
 double lowCutHz (float v) noexcept { return 10.0 + 1990.0 * clamp01 (v); }
 double highCutHz (float v) noexcept { return 200.0 + 19800.0 * clamp01 (v); }
 double outputDb (float v) noexcept { return -18.0 + 36.0 * clamp01 (v); }
+int hybridOf (float v) noexcept { return v < 0.25f ? 0 : (v < 0.75f ? 1 : 2); }
+float hybridValue (int h) noexcept { return h <= 0 ? 0.0f : (h == 1 ? 0.5f : 1.0f); }
 Mode modeOf (float v) noexcept { return (Mode) std::clamp ((int) std::floor (clamp01 (v) * (float) modeCount), 0, modeCount - 1); }
 float modeValue (Mode m) noexcept { return ((float) m + 0.5f) / (float) modeCount; }
 Style styleOf (float v) noexcept { return (Style) std::clamp ((int) std::floor (clamp01 (v) * (float) styleCount), 0, styleCount - 1); }
@@ -459,12 +461,19 @@ public:
         steep.reset();
         lfoPhase = 0.0;
         envelope = 0.0f;
+        hyb.dirty = true;
     }
 
     void process (float* l, float* r, int n, const EffectParams& p, double bpm) noexcept override
     {
         if (ch[0].line.buf.empty())
             prepare (sr);
+        if (hybridOf (p[hybrid]) != 0)
+        {
+            hybridProcess (l, r, n, p, bpm);
+            return;
+        }
+        hyb.dirty = true;
 
         const auto md = modeOf (p[mode]);
         const auto st = styleOf (p[style]);
@@ -824,6 +833,83 @@ private:
         return s.held;
     }
 
+    // ---- the hybrid echo (round 124) -----------------------------------------------------------------------------
+    // [EXEC] black-box measurement of the official H-Delay trial (docs/analise/REA_rodada124.md §5), our own code:
+    // - ping-pong: the left line takes (L + R)/√2 plus fb² × the right echo; the right line takes the left echo; the left
+    //   echo comes T after the input, every later pass T + 1 (single-sample impulses land exactly there);
+    // - each write into a line goes through y = v·g, g = min (1 / (1 + |v|), released toward 1 with a 10 ms time
+    //   constant): a lone impulse of 1/√2 comes back as 0.41421 = x / (1 + x), the next pass 0.29289 = f (0.41421);
+    // - stereo: each side its own line, fb × its echo, the same gain on every write;
+    // - analog: the same loop between an input gain and an output gain (fitted on impulses at -66 … +6 dBFS and her takes)
+    //   and a gentle low tilt on the echoes; its hiss (≈ -85 dBFS) is not reproduced.
+    struct HybridState
+    {
+        Line a, b;
+        double ga = 1.0, gb = 1.0, aPrev = 0.0, bPrev = 0.0;
+        Biquad tilt;
+        bool dirty = true;
+    } hyb;
+    static constexpr double analogIn = 0.8866, analogOut = 0.9776;
+
+    static inline double linkedGain (double level, double& g, double rel) noexcept
+    {
+        const auto inst = 1.0 / (1.0 + level);
+        g = std::min (inst, 1.0 - (1.0 - g) * rel);
+        return g;
+    }
+
+    void hybridProcess (float* l, float* r, int n, const EffectParams& p, double bpm) noexcept
+    {
+        if (hyb.a.buf.empty() || hyb.dirty)
+        {
+            if (hyb.a.buf.empty())
+            {
+                hyb.a.allocate (sr * 3.6 + 8.0);
+                hyb.b.allocate (sr * 3.6 + 8.0);
+            }
+            hyb.a.clear();
+            hyb.b.clear();
+            hyb.ga = hyb.gb = 1.0;
+            hyb.aPrev = hyb.bPrev = 0.0;
+            hyb.tilt.reset();
+            hyb.dirty = false;
+        }
+        const bool analog = hybridOf (p[hybrid]) == 2;
+        const bool pp = styleOf (p[style]) == Style::pingPong;
+        const auto t = std::clamp ((int) std::lround (sideMs (p, false, bpm) * sr / 1000.0), 1, (int) hyb.a.maxDelay());
+        const auto fb = feedbackGain (p[feedback]); // H-Delay's feedback / 100 (0 … 2)
+        const auto fbPair = fb * fb;
+        float dryGain = 1.0f, wetGain = 0.0f;
+        equalPowerMix (p[mix], dryGain, wetGain);
+        wetGain *= (float) std::pow (10.0, outputDb (p[output]) / 20.0);
+        const auto rel = std::exp (-1.0 / (0.010 * sr));
+        const auto inGain = analog ? analogIn : 1.0, outGain = analog ? analogOut : 1.0;
+        if (analog)
+            hyb.tilt.shelf (sr, 942.0, 0.63, false, 0.5);
+        constexpr double invSqrt2 = 0.70710678118654752;
+        for (int i = 0; i < n; ++i)
+        {
+            const double xl = l[i], xr = r[i];
+            const double aOut = hyb.a.tap (t), bOut = hyb.b.tap (t);
+            // the two lines share one gain (a loud left pass also turns the right one down)
+            const auto va = pp ? inGain * (xl + xr) * invSqrt2 + fbPair * hyb.bPrev : inGain * xl + fb * hyb.aPrev;
+            const auto vb = pp ? hyb.aPrev : inGain * xr + fb * hyb.bPrev;
+            const auto g = linkedGain (std::max (std::fabs (va), std::fabs (vb)), hyb.ga, rel);
+            hyb.a.push ((float) (va * g));
+            hyb.b.push ((float) (vb * g));
+            hyb.aPrev = aOut;
+            hyb.bPrev = bOut;
+            float el = (float) (aOut * outGain), er = (float) (bOut * outGain);
+            if (analog)
+            {
+                el = hyb.tilt.process (el, 0);
+                er = hyb.tilt.process (er, 1);
+            }
+            l[i] = dryGain * (float) xl + wetGain * el;
+            r[i] = dryGain * (float) xr + wetGain * er;
+        }
+    }
+
     double sr = 48000.0;
     std::array<Channel, 2> ch;
     Butter8 steep;
@@ -1344,7 +1430,8 @@ const EffectInfo& echoformInfo()
                                      { "Diffusion", 0.0f }, { "Diffusion size", 1.0f }, { "Low cut", 0.0f }, { "High cut", 1.0f },
                                      { "Mod rate", 0.2738341f }, { "Mod depth", 0.5f }, { "Wow", 0.5f }, { "Flutter", 0.5f },
                                      { "Shift", 0.5f }, { "Shift detune", 0.58f }, { "Pitch", 0.5f }, { "Pitch detune", 0.5f },
-                                     { "Mode", 0.5f / 12.0f }, { "Ducking", 0.0f }, { "Output", 0.5f }, { "Pairs", 0.0f } } };
+                                     { "Mode", 0.5f / 12.0f }, { "Ducking", 0.0f }, { "Output", 0.5f }, { "Pairs", 0.0f },
+                                     { "Hybrid", 0.0f } } };
     return info;
 }
 
@@ -1428,6 +1515,7 @@ std::string paramText (EffectKind kind, int param, float v)
             case mode: return modeName (modeOf (v));
             case output: return fmt ("%+.1f dB", outputDb (v));
             case pairs: return v >= 0.5f ? "pairs" : "alternate";
+            case hybrid: return hybridOf (v) == 0 ? "off" : (hybridOf (v) == 1 ? "clean" : "analog");
             default: return fmt ("%.2f", v);
         }
     }

+ 4 - 0
src/core/EchoSuite.h

@@ -51,6 +51,8 @@ enum Param
     output,     // round 119: the echoes' level, −18 … +18 dB (0.5 = 0 dB; older projects load the default)
     pairs,      // round 119: ping-pong in pairs — the right side repeats the left echo at full level and the loop
                 // gain applies once per left-right pair (the H-Delay-style ping-pong); off = each side at √gain
+    hybrid,     // round 124: the hybrid echo engine (off / clean / analog) — a plain two-line echo with a level-dependent
+                // gain on every pass, measured on the H-Delay trial (REA_rodada124 §5); off = Echoform as before
     paramCount
 };
 enum class Style { single, ratio, quad, dual, pingPong }; // the two-time styles last (the panel shows the right time for both)
@@ -75,6 +77,8 @@ double pitchSemis (float v) noexcept;    // ±24
 double lowCutHz (float v) noexcept;      // 10 .. 2000
 double highCutHz (float v) noexcept;     // 200 .. 20000
 double outputDb (float v) noexcept;      // −18 .. +18 dB (round 119)
+int hybridOf (float v) noexcept;         // 0 off, 1 clean, 2 analog (round 124)
+float hybridValue (int h) noexcept;
 Mode modeOf (float v) noexcept;
 float modeValue (Mode m) noexcept;
 Style styleOf (float v) noexcept;

+ 164 - 3
src/core/MixSuite.cpp

@@ -715,6 +715,134 @@ double exciterHz (float v) noexcept { return logMap (v, 1000.0, 12000.0); }
 
 namespace
 {
+// ---- the dynamic air model (round 124) ------------------------------------------------------------------------------
+// Black-box measurements of the official Fresh Air trial (docs/analise/REA_rodada124.md §3), our own code:
+//   y = s(mid, high) * x + kMid(mid) * gMid(t) * HPmid(x) + kHigh(high) * gHigh(t) * HPhigh(x)
+// HPmid / HPhigh: RBJ 2nd-order high-passes (2993 Hz, Q 0.629 / 9000 Hz, Q 0.707; the same analog corners at 44.1
+// and 48 kHz); s, kMid, kHigh: measured on a 0.025 grid (small-signal transfer functions, residual < 0.4 %).
+// gMid: a linked peak detector (instant attack, 5 ms hold, 96 ms release) of the band, 4:1 above -30.1 dBFS,
+// released through a 7.7 ms one-pole. gHigh: two 4:1 stages — a peak detector with 2-pole gain smoothing, then a
+// feedback stage on the band after the first one, whose threshold rises as High air goes down (T + c (1 - high)^2).
+namespace dyn
+{
+constexpr double gridMidS[41] { 1.00237, 1.02960, 1.04368, 1.05483, 1.06431, 1.07263, 1.08006, 1.08676, 1.09284, 1.09838, 1.10343,
+    1.10804, 1.11224, 1.11606, 1.11952, 1.12264, 1.12542, 1.12788, 1.13004, 1.13189, 1.13345, 1.13472, 1.13571, 1.13642, 1.13685,
+    1.13700, 1.13689, 1.13650, 1.13584, 1.13492, 1.13373, 1.13227, 1.13055, 1.12855, 1.12629, 1.12376, 1.12097, 1.11790, 1.11456,
+    1.11095, 1.10707 };
+constexpr double gridMidK[41] { 0.00000, 0.13781, 0.22533, 0.30473, 0.38070, 0.45506, 0.52874, 0.60230, 0.67608, 0.75035, 0.82529,
+    0.90102, 0.97767, 1.05531, 1.13403, 1.21388, 1.29491, 1.37717, 1.46071, 1.54556, 1.63175, 1.71932, 1.80829, 1.89870, 1.99056,
+    2.08391, 2.17877, 2.27515, 2.37309, 2.47260, 2.57371, 2.67643, 2.78079, 2.88681, 2.99451, 3.10390, 3.21501, 3.32786, 3.44246,
+    3.55884, 3.67701 };
+constexpr double gridHighS[41] { 1.00237, 1.03339, 1.04999, 1.06349, 1.07527, 1.08587, 1.09559, 1.10462, 1.11306, 1.12100, 1.12851,
+    1.13562, 1.14238, 1.14881, 1.15493, 1.16077, 1.16634, 1.17166, 1.17673, 1.18156, 1.18616, 1.19055, 1.19472, 1.19867, 1.20242,
+    1.20597, 1.20932, 1.21247, 1.21543, 1.21820, 1.22077, 1.22316, 1.22535, 1.22736, 1.22918, 1.23082, 1.23227, 1.23353, 1.23461,
+    1.23550, 1.23620 };
+constexpr double gridHighK[41] { 0.00000, 0.26995, 0.45609, 0.63358, 0.81042, 0.98969, 1.17298, 1.36128, 1.55524, 1.75537, 1.96206,
+    2.17564, 2.39639, 2.62458, 2.86045, 3.10422, 3.35611, 3.61634, 3.88510, 4.16260, 4.44906, 4.74466, 5.04961, 5.36411, 5.68837,
+    6.02260, 6.36699, 6.72176, 7.08712, 7.46329, 7.85048, 8.24890, 8.65879, 9.08036, 9.51384, 9.95946, 10.41747, 10.88807, 11.37154,
+    11.86810, 12.37801 };
+inline double grid (const double (&t)[41], double v) noexcept
+{
+    const auto x = std::clamp (v, 0.0, 1.0) * 40.0;
+    const auto i = std::min (39, (int) x);
+    return t[i] + (t[i + 1] - t[i]) * (x - i);
+}
+// the dry gain with both bands at 0
+constexpr double baseGain = 1.00237;
+
+// the fitted dynamics (REA_rodada124 §3)
+struct Tuning
+{
+    double midThreshold = -30.13, midHoldMs = 5.0, midReleaseMs = 96.03, midGainReleaseMs = 7.706;
+    double highThreshold = -38.03, highReleaseMs = 0.5354, highGainAttackMs = 2.1428, highGainReleaseMs = 55.52;
+    double high2ReleaseMs = 0.0190, high2GainAttackMs = 56.73, high2GainReleaseMs = 53.45, high2Slope = 8.257;
+    double high2Threshold = -41.13, high2Curve = 15.585;
+};
+
+class Engine
+{
+public:
+    void prepare (double rate) noexcept
+    {
+        sr = rate;
+        mid.hp (rate, 2993.0, 0.6291);
+        high.hp (rate, 9000.0, 0.7069);
+        reset();
+    }
+    void reset() noexcept
+    {
+        mid.reset();
+        high.reset();
+        envM = holdM = gM = envH = g1a = g1b = env2 = g2a = g2b = 0.0;
+    }
+    // processes in place; `out` is the output gain (linear)
+    void process (float* l, float* r, int n, double midAmount, double highAmount, double out) noexcept
+    {
+        const Tuning t;
+        const auto c = [this] (double ms) { return ms <= 0.0 ? 0.0 : std::exp (-1000.0 / (ms * sr)); };
+        const auto s = (grid (gridMidS, midAmount) + grid (gridHighS, highAmount) - baseGain) * out;
+        const auto km = grid (gridMidK, midAmount) * out, kh = grid (gridHighK, highAmount) * out;
+        const auto mRel = c (t.midReleaseMs), mGr = c (t.midGainReleaseMs), mHold = t.midHoldMs * sr / 1000.0;
+        const auto hRel = c (t.highReleaseMs), h1a = c (t.highGainAttackMs), h1r = c (t.highGainReleaseMs);
+        const auto h2Rel = c (t.high2ReleaseMs), h2a = c (t.high2GainAttackMs), h2r = c (t.high2GainReleaseMs);
+        const auto t2 = t.high2Threshold + t.high2Curve * (1.0 - highAmount) * (1.0 - highAmount);
+        for (int i = 0; i < n; ++i)
+        {
+            const double xl = l[i], xr = r[i];
+            const double ml = mid.process ((float) xl, 0), mr = mid.process ((float) xr, 1);
+            const double hl = high.process ((float) xl, 0), hr = high.process ((float) xr, 1);
+            // mid: peak with hold, 4:1
+            const auto pm = std::max (std::fabs (ml), std::fabs (mr));
+            if (pm >= envM) { envM = pm; holdM = mHold; }
+            else if (holdM > 0.0) holdM -= 1.0;
+            else envM = pm + (envM - pm) * mRel;
+            const auto gmTarget = -0.75 * std::max (0.0, 20.0 * std::log10 (envM + 1e-30) - t.midThreshold);
+            gM = gmTarget < gM ? gmTarget : gmTarget + (gM - gmTarget) * mGr;
+            // high, stage 1: peak, 4:1, 2-pole gain smoothing
+            const auto ph = std::max (std::fabs (hl), std::fabs (hr));
+            envH = ph > envH ? ph : ph + (envH - ph) * hRel;
+            const auto g1Target = -0.75 * std::max (0.0, 20.0 * std::log10 (envH + 1e-30) - t.highThreshold);
+            const auto k1 = g1Target < g1b ? h1a : h1r;
+            g1a = g1Target + (g1a - g1Target) * k1;
+            g1b = g1a + (g1b - g1a) * k1;
+            const auto g1 = std::pow (10.0, g1b / 20.0);
+            // high, stage 2: feedback (detector after both stages), peak, 2-pole gain smoothing
+            const auto g2 = std::pow (10.0, g2b / 20.0);
+            const auto p2 = ph * g1 * g2;
+            env2 = p2 >= env2 ? p2 : p2 + (env2 - p2) * h2Rel;
+            const auto g2Target = -t.high2Slope * std::max (0.0, 20.0 * std::log10 (env2 + 1e-30) - t2);
+            const auto k2 = g2Target < g2b ? h2a : h2r;
+            g2a = g2Target + (g2a - g2Target) * k2;
+            g2b = g2a + (g2b - g2a) * k2;
+            const auto gm = km * std::pow (10.0, gM / 20.0), gh = kh * g1 * g2;
+            l[i] = (float) (s * xl + gm * ml + gh * hl);
+            r[i] = (float) (s * xr + gm * mr + gh * hr);
+        }
+    }
+    float reductionDb() const noexcept { return (float) std::min (gM, g1b + g2b); }
+
+private:
+    struct Hp2 : Biquad
+    {
+        void hp (double rate, double fc, double q) noexcept
+        {
+            const auto w = 2.0 * 3.14159265358979323846 * fc / rate, a = std::sin (w) / (2.0 * q), cw = std::cos (w);
+            set ((1.0 + cw) / 2.0, -(1.0 + cw), (1.0 + cw) / 2.0, 1.0 + a, -2.0 * cw, 1.0 - a);
+        }
+        double process (float x, int ch) noexcept
+        {
+            const auto y = b0 * x + z1[ch];
+            z1[ch] = b1 * x - a1 * y + z2[ch];
+            z2[ch] = b2 * x - a2 * y;
+            return y;
+        }
+    };
+    double sr = 48000.0;
+    Hp2 mid, high;
+    double envM = 0, holdM = 0, gM = 0, envH = 0, g1a = 0, g1b = 0, env2 = 0, g2a = 0, g2b = 0;
+};
+} // namespace dyn
+
 class Air final : public Effect
 {
 public:
@@ -728,6 +856,7 @@ public:
     {
         sr = rate;
         dry.setLength (Oversampler::latency());
+        dynEngine.prepare (rate);
         reset();
     }
 
@@ -739,18 +868,46 @@ public:
         shelf.reset();
         pre.reset();
         post.reset();
+        dynEngine.reset();
     }
 
-    int latencySamples() const noexcept override { return Oversampler::latency(); }
+    // the dynamic model has no latency (as the measured reference); the exciter path is oversampled
+    int latencySamples() const noexcept override { return dynamicMode ? 0 : Oversampler::latency(); }
     float controlOutput (int k) const noexcept override { return meters.read (k); }
 
     void process (float* l, float* r, int n, const EffectParams& p, double) noexcept override
     {
+        const bool dynamicNow = p[dynamic] >= 0.5f;
+        if (dynamicNow != dynamicMode)
+        {
+            dynamicMode = dynamicNow;
+            reset();
+        }
         for (int off = 0; off < n; off += maxBlock)
-            chunk (l + off, r + off, std::min (maxBlock, n - off), p);
+            if (dynamicMode)
+                dynamicChunk (l + off, r + off, std::min (maxBlock, n - off), p);
+            else
+                chunk (l + off, r + off, std::min (maxBlock, n - off), p);
     }
 
 private:
+    void dynamicChunk (float* l, float* r, int n, const EffectParams& p) noexcept
+    {
+        const auto inPeak = Meters::peak (l, r, n);
+        const auto mx = std::clamp (p[mix], 0.0f, 1.0f);
+        if (mx < 1.0f)
+            for (int i = 0; i < n; ++i)
+                hl[(std::size_t) i] = l[i], hr[(std::size_t) i] = r[i];
+        dynEngine.process (l, r, n, std::clamp (p[midAir], 0.0f, 1.0f), std::clamp (p[highAir], 0.0f, 1.0f), dbToGain (lin (p[output], -12.0, 12.0)));
+        if (mx < 1.0f)
+            for (int i = 0; i < n; ++i)
+            {
+                l[i] = hl[(std::size_t) i] + (l[i] - hl[(std::size_t) i]) * mx;
+                r[i] = hr[(std::size_t) i] + (r[i] - hr[(std::size_t) i]) * mx;
+            }
+        meters.set (0.0f, -dynEngine.reductionDb(), inPeak, Meters::peak (l, r, n));
+    }
+
     void chunk (float* l, float* r, int n, const EffectParams& p) noexcept
     {
         const auto inPeak = Meters::peak (l, r, n);
@@ -808,6 +965,8 @@ private:
     std::array<Oversampler, 2> os;
     Delay2<256> dry;
     Biquad shelf, pre, post;
+    dyn::Engine dynEngine;
+    bool dynamicMode = false;
     std::array<float, maxBlock> hl {}, hr {};
     Meters meters;
 };
@@ -1223,7 +1382,8 @@ const EffectInfo& aetherInfo()
 {
     static const EffectInfo info { "Aether",
                                    { { "Air", 0.0f }, { "Air freq.", 0.62f }, { "Harmonics", 0.0f }, { "Exciter freq.", 0.56f },
-                                     { "Character", 0.5f }, { "Mix", 1.0f }, { "Output", 0.5f } } };
+                                     { "Character", 0.5f }, { "Mix", 1.0f }, { "Output", 0.5f },
+                                     { "Dynamic", 0.0f }, { "Mid air", 0.0f }, { "High air", 0.0f } } };
     return info;
 }
 
@@ -1348,6 +1508,7 @@ std::string paramText (EffectKind kind, int param, float v)
             case exciterFreq: return hzText (exciterHz (v));
             case character: return v < 0.05f ? "even" : (v > 0.95f ? "odd" : fmt ("%.0f%% odd", v * 100.0));
             case output: return fmt ("%+.1f dB", lin (v, -12.0, 12.0));
+            case dynamic: return onOff (v);
             default: return fmt ("%.0f%%", v * 100.0);
         }
     }

+ 4 - 1
src/core/MixSuite.h

@@ -148,7 +148,10 @@ double lookaheadMs() noexcept;         // the fixed lookahead (always reported a
 // ---- Aether (air band + exciter) ----
 namespace aether
 {
-enum Param { air, airFreq, harmonics, exciterFreq, character, mix, output, count };
+// `dynamic` (appended, round 124) switches to the dynamic air model: two parallel high-passed bands (Mid air from
+// ~3 kHz, High air from ~9 kHz), each lifted by a compressed copy of itself, so quiet highs come up more than loud
+// ones; `midAir` / `highAir` set the two amounts (0..1). Off (the default) keeps the shelf + exciter above.
+enum Param { air, airFreq, harmonics, exciterFreq, character, mix, output, dynamic, midAir, highAir, count };
 double airDb (float v) noexcept;       // 0 .. +15 dB
 double airHz (float v) noexcept;       // 5 .. 20 kHz
 double exciterHz (float v) noexcept;   // 1 .. 12 kHz

+ 9 - 1
src/core/PluginLayout.cpp

@@ -1640,10 +1640,15 @@ Layout aetherLayout()
     // two big knobs side by side — the presence / exciter one (MID) on the left, the high shelf (HIGH) on the right —
     // and the output trim between them; LYNX's extra settings (frequencies, character, mix) small under each
     Layout l;
-    l.width = 440;
+    l.width = 530;
     l.height = 270;
     auto& v = l.items;
     v.push_back (section (4, 4, 432, 262, TR_NOOP ("Air")));
+    // round 124: the dynamic air model (Dynamic on) has its own two amounts
+    v.push_back (section (440, 4, 86, 262, TR_NOOP ("Dynamic")));
+    v.push_back (toggle (446, 26, 74, 24, "Dynamic", TR_NOOP ("Dynamic")));
+    v.push_back (dial (483, 100, 30, "Mid air", TR_NOOP ("Mid air")));
+    v.push_back (dial (483, 186, 30, "High air", TR_NOOP ("High air")));
     v.push_back (dial (104, 96, 104, "Harmonics", TR_NOOP ("Mid air"), big));
     v.push_back (dial (336, 96, 104, "Air", TR_NOOP ("High air"), big));
     v.push_back (dial (220, 120, 40, "Output", TR_NOOP ("Trim"), bipolar));
@@ -2266,6 +2271,9 @@ Layout echoformLayout()
     v.push_back (dial (738, k2, d, "Output", TR_NOOP ("Level"), bipolar)); // round 119
     // round 119: ping-pong in pairs (shown with the ping-pong style)
     v.push_back (when (toggle (280, 252, 90, 24, "Pairs", TR_NOOP ("Pairs")), "Style", 0.8f, 1.0f));
+    // round 124: the hybrid engine (H-Delay's measured loop)
+    v.push_back (label (380, 254, 52, 20, TR_NOOP ("Hybrid")));
+    v.push_back (menuOf (436, 252, 120, 24, "Hybrid", TR_NOOP ("Hybrid"), TR_NOOP ("Off|Clean|Analog"), { 0.0f, 0.5f, 1.0f }));
     // the mode selector along the bottom
     v.push_back (label (8, 254, 52, 20, TR_NOOP ("Mode")));
     v.push_back (menuOf (64, 252, 200, 24, "Mode", TR_NOOP ("Mode"),

+ 30 - 13
src/core/PluginSubstitutes.cpp

@@ -490,8 +490,8 @@ product = Fresh Air
 vendor = Slate Digital
 lynx = Aether
 names = Fresh Air; FreshAir
-# round 113: its two air amounts are read from the state (freshAirAmounts) and set Aether's air shelf through laws
-# measured on the official trial
+# round 113: its two air amounts are read from the state (freshAirAmounts); round 124: they drive Aether's dynamic
+# air model, measured black-box on the official trial to match it sample for sample (REA_rodada124 §3)
 translate = fresh-air
 
 [soundtoys-decapitator]
@@ -995,22 +995,28 @@ int translateWavesTune (const std::vector<std::uint8_t>& state, EffectSlot& slot
     return n;
 }
 
-// Fresh Air: its two air amounts become Aether's air shelf. [EXEC] Black-box measurement of the official trial
-// (fxmeasure, pink noise at -20 dBFS RMS, 48 kHz; docs/analise/REA_rodada113.md §3b): each setting's response above
-// 2 kHz is fitted by one high shelf (RBJ, S = 0.6, Aether's); gain and frequency follow these least-squares laws of
-// (mid, high), within 0.5 dB RMS of the measured curves for the settings her projects use. The exciter stays off.
+// Fresh Air: its two air amounts drive Aether's dynamic air model (round 124), which reproduces the official trial
+// measured black-box (docs/analise/REA_rodada124.md §3): the same two parallel compressed high-passed bands, the same
+// amount laws, so the amounts map one to one; Trim (the float at 2526 of the state, -12 … 0 dB) becomes the output.
+// (Round 113 fitted a static shelf; the original is level-dependent: quiet highs get up to +12 dB, loud ones +3.)
 int translateFreshAir (const std::vector<std::uint8_t>& state, EffectSlot& slot)
 {
+    namespace a = mixsuite::aether;
     const auto air = freshAirAmounts (state);
     if (! air || slot.kind != EffectKind::aether)
         return 0;
-    const auto m = (double) air->first, h = (double) air->second;
-    const auto gainDb = std::clamp (10.345 * m + 20.548 * h - 2.32 * m * m - 7.75 * h * h - 11.673 * m * h, 0.0, 15.0);
-    const auto hz = std::clamp (std::exp2 (12.8069 - 0.7108 * m + 0.6746 * h - 0.5369 * m * h), 5000.0, 20000.0);
-    slot.params[mixsuite::aether::air] = (float) (gainDb / 15.0);
-    slot.params[mixsuite::aether::airFreq] = (float) (std::log (hz / 5000.0) / std::log (4.0));
-    slot.params[mixsuite::aether::harmonics] = 0.0f;
-    return 2;
+    slot.params[a::dynamic] = 1.0f;
+    slot.params[a::midAir] = air->first;
+    slot.params[a::highAir] = air->second;
+    slot.params[a::air] = 0.0f;
+    slot.params[a::harmonics] = 0.0f;
+    slot.params[a::mix] = 1.0f;
+    float trimDb = 0.0f;
+    std::memcpy (&trimDb, state.data() + 2526, 4);
+    if (! std::isfinite (trimDb) || trimDb < -12.0f || trimDb > 0.0f)
+        trimDb = 0.0f;
+    slot.params[a::output] = (trimDb + 12.0f) / 24.0f;
+    return 3;
 }
 
 // --- Waves RealWorld lists (round 113). [EXEC] Black-box measurement of the official trials (WaveShell 17.1, tools/
@@ -1212,6 +1218,17 @@ int translateWavesHDelay (const std::vector<std::uint8_t>& state, EffectSlot& sl
             p[(std::size_t) side] = e::timeValue (ms);
     }
     const auto f = std::max (0.0, *fb) / 100.0;
+    // round 124: the hybrid engine reproduces the trial's loop exactly (REA_rodada124 §5) when the state uses no
+    // filter, modulation or lo-fi (every state of her corpus); otherwise the round-119 approximation below
+    const auto hp0 = wavesValue (rw, 17).value_or (19.0), lp0 = wavesValue (rw, 15).value_or (20100.0);
+    if (hp0 <= 19.5 && lp0 >= 20000.0 && wavesValue (rw, 19).value_or (0.0) <= 0.0 && wavesValue (rw, 21).value_or (0.0) < 0.5)
+    {
+        p[e::hybrid] = e::hybridValue (analog ? 2 : 1);
+        p[e::feedback] = (float) std::clamp (f / 2.0, 0.0, 1.0);
+        p[e::mix] = (float) std::clamp (wavesValue (rw, 6).value_or (100.0) / 100.0, 0.0, 1.0);
+        p[e::output] = linNorm (wavesValue (rw, 14).value_or (0.0), -18.0, 18.0);
+        return 9;
+    }
     const auto loop = pingPong ? 0.93 * f * f : 0.98 * f;
     p[e::feedback] = (float) std::clamp (loop / 2.0, 0.0, 1.0);
     p[e::mix] = (float) std::clamp (wavesValue (rw, 6).value_or (100.0) / 100.0, 0.0, 1.0);

+ 74 - 2
src/core/VoiceTools.cpp

@@ -243,6 +243,21 @@ struct Line
         if (++pos == (int) buf.size())
             pos = 0;
     }
+    // d samples ago, linearly interpolated (the measured reference's voices)
+    float linear (double d) const noexcept
+    {
+        const auto size = (int) buf.size();
+        d = std::clamp (d, 1.0, (double) size - 4.0);
+        const auto di = (int) d;
+        const auto f = (float) (d - di);
+        auto i0 = pos - di;
+        if (i0 < 0)
+            i0 += size;
+        auto i1 = i0 - 1;
+        if (i1 < 0)
+            i1 += size;
+        return buf[(std::size_t) i0] + f * (buf[(std::size_t) i1] - buf[(std::size_t) i0]);
+    }
     // d samples ago (d ≥ 1: the sample pushed last is 1 ago)
     float at (double d) const noexcept
     {
@@ -281,6 +296,8 @@ public:
         for (auto& v : voice)
         {
             v.line.clear();
+            v.offset = 495.0;
+            v.second = -1.0;
             v.phase = 0.0;
             v.lfo = 0.0;
             v.last = 0.0f;
@@ -307,7 +324,8 @@ public:
         // [EXEC] measured: with Align the direct signal comes 6.67 ms late and every pass through a voice takes its
         // delay + 10.3 ms (the repeats too); without it a voice takes its delay alone
         const bool aligned = on (p[align]);
-        const auto alignSamples = aligned ? sr / 150.0 : 0.0; // 6.67 ms (320 samples at 48 kHz)
+        // [EXEC] round 124: 320 samples at 44.1 and 48 kHz alike (a fixed sample count, not a time)
+        const auto alignSamples = aligned ? 320.0 : 0.0;
         const auto voiceExtra = (aligned ? 0.0103 * sr : 0.0) - 0.5 * window;
         const bool lowOnV = on (p[lowOn]), highOnV = on (p[highOn]);
 
@@ -361,6 +379,46 @@ public:
                 auto ratio = std::pow (2.0, (s.cents + s.depth * tri) / 1200.0);
                 if (s.octave)
                     ratio *= 0.5;
+                if (! s.octave && aligned)
+                {
+                    // [EXEC] round 124 (official trial, impulse trains at ±1 … ±100 cents, 44.1 / 48 kHz): ONE read head
+                    // at delay + offset, the offset starting at 495 samples (so 0 cents = delay + 495 exactly) and
+                    // drifting by (1 − ratio) per sample inside a 496-sample range; at the range's end the head fades
+                    // out over 1.3 samples of offset, jumps back by the range and fades in again (pitch down), or a
+                    // second head enters at the top while the first finishes at the bottom (pitch up); linear reads
+                    const auto drift = 1.0 - ratio;
+                    float y = 0.0f;
+                    if (drift >= 0.0)
+                    {
+                        v.offset += drift;
+                        if (v.offset >= downMax)
+                            v.offset -= downMax - downMin;
+                        const auto g = std::min ({ 1.0, (downMax - v.offset) / fade, (v.offset - downMin) / fade });
+                        y = (float) std::max (0.0, g) * v.line.linear (1.0 + s.delay + v.offset);
+                        v.second = -1.0;
+                    }
+                    else
+                    {
+                        v.offset += drift;
+                        if (v.second < 0.0 && v.offset <= upMin + upOverlap)
+                            v.second = v.offset + (upMax - upMin - upOverlap);
+                        if (v.second >= 0.0)
+                            v.second += drift;
+                        if (v.offset <= upMin)
+                        {
+                            v.offset = v.second >= 0.0 ? v.second : v.offset + (upMax - upMin);
+                            v.second = -1.0;
+                        }
+                        const auto gIn = std::clamp ((upMax - v.offset) / upFadeIn, 0.0, 1.0);
+                        y = (float) gIn * v.line.linear (1.0 + s.delay + v.offset);
+                        if (v.second >= 0.0)
+                            y += (float) std::clamp ((upMax - v.second) / upFadeIn, 0.0, 1.0) * v.line.linear (1.0 + s.delay + v.second);
+                    }
+                    v.last = y;
+                    wetL += s.gl * y;
+                    wetR += s.gr * y;
+                    continue;
+                }
                 // two read taps half a window apart sweep the window at (1 − ratio) samples per sample
                 v.phase += (1.0 - ratio) / window;
                 v.phase -= std::floor (v.phase);
@@ -410,8 +468,17 @@ private:
         // +4.5 at 3 kHz); the low shelf mirrors it (corners f0 / max (g, 1/g) and f0)
         firstOrderShelf (lowShelf, freqHz (p[lowFreq]), shelfDb (p[lowGain]), false);
         firstOrderShelf (highShelf, freqHz (p[highFreq]), shelfDb (p[highGain]), true);
+        // [EXEC] round 124: the feedback low cut is a first-order (bilinear) high-pass — 16 Hz: -3.0 dB / +45° at
+        // 16 Hz, first sample 0.99895 of a repeat's impulse
+        const auto k = std::tan (pi * std::min (freqHz (p[feedbackCut]), 0.45 * sr) / sr);
         for (auto& v : voice)
-            v.fbHp.filter (sr, 1, std::max (10.0, freqHz (p[feedbackCut])), 0.7071);
+        {
+            v.fbHp.b0 = 1.0 / (1.0 + k);
+            v.fbHp.b1 = -v.fbHp.b0;
+            v.fbHp.b2 = 0.0;
+            v.fbHp.a1 = (k - 1.0) / (k + 1.0);
+            v.fbHp.a2 = 0.0;
+        }
     }
 
     // H(s) = k (1 + s/wz) / (1 + s/wp), bilinear with the corners pre-warped
@@ -438,9 +505,14 @@ private:
         b.a2 = 0.0;
     }
 
+    // the measured read-head range (samples of offset over the voice's delay; REA_rodada124 §4)
+    static constexpr double downMin = 79.4, downMax = 575.7, fade = 1.3;
+    static constexpr double upMin = 62.0, upMax = 558.4, upOverlap = 4.2, upFadeIn = 0.7;
+
     struct Voice
     {
         Line line;
+        double offset = 495.0, second = -1.0;
         double phase = 0.0, lfo = 0.0;
         float last = 0.0f;
         Biquad fbHp;

+ 6 - 1
src/ui/I18nData.h

@@ -7443,6 +7443,11 @@ inline constexpr unsigned char ptBR[] = {
 34, 80, 73, 84, 67, 72, 32, 71, 82, 65, 80, 72, 34, 32, 61, 32, 34, 71, 82, 195, 129, 70, 73, 67,
 79, 32, 68, 69, 32, 65, 70, 73, 78, 65, 195, 135, 195, 131, 79, 34, 10, 34, 73, 78, 80, 85, 84, 34,
 32, 61, 32, 34, 69, 78, 84, 82, 65, 68, 65, 34, 10, 34, 110, 111, 32, 112, 105, 116, 99, 104, 34, 32,
-61, 32, 34, 115, 101, 109, 32, 97, 102, 105, 110, 97, 195, 167, 195, 163, 111, 34, 10,
+61, 32, 34, 115, 101, 109, 32, 97, 102, 105, 110, 97, 195, 167, 195, 163, 111, 34, 10, 35, 32, 114, 111, 117,
+110, 100, 32, 49, 50, 52, 58, 32, 69, 99, 104, 111, 102, 111, 114, 109, 39, 115, 32, 104, 121, 98, 114, 105,
+100, 32, 101, 110, 103, 105, 110, 101, 10, 34, 72, 121, 98, 114, 105, 100, 34, 32, 61, 32, 34, 72, 195, 173,
+98, 114, 105, 100, 111, 34, 10, 34, 79, 102, 102, 124, 67, 108, 101, 97, 110, 124, 65, 110, 97, 108, 111, 103,
+34, 32, 61, 32, 34, 68, 101, 115, 108, 105, 103, 97, 100, 111, 124, 76, 105, 109, 112, 111, 124, 65, 110, 97,
+108, 195, 179, 103, 105, 99, 111, 34, 10,
 };
 } // namespace lynx::i18n::data

+ 14 - 5
src/ui/ProEditors.cpp

@@ -1718,8 +1718,10 @@ private:
     juce::String gestures() const override { return tr ("Link: both knobs move together"); }
     bool usesHistory() const override { return true; }
 
-    int pMid() const { return P ("Harmonics"); }
-    int pHigh() const { return P ("Air"); }
+    // the dynamic air model (round 124) has its own two amounts; the classic mode drives the exciter and the shelf
+    bool dynamicModel() const { return v (P ("Dynamic")) >= 0.5f; }
+    int pMid() const { return dynamicModel() ? P ("Mid air") : P ("Harmonics"); }
+    int pHigh() const { return dynamicModel() ? P ("High air") : P ("Air"); }
     juce::Rectangle<float> display() const { return bodyArea().withHeight (206.0f); }
     juce::Rectangle<float> panel() const { return bodyArea().withTrimmedTop (206.0f); }
 
@@ -1750,9 +1752,16 @@ private:
         out.push_back (knob ({ 626.0f, a.getBottom() - 92.0f, 72.0f, 86.0f }, P ("Output"), tr ("Trim"), 0, true));
         const auto b = barArea();
         const auto y = b.getCentreY() - 11.0f;
-        out.push_back (barValue ({ 8.0f, y, 150.0f, 22.0f }, P ("Exciter freq."), tr ("Mid freq")));
-        out.push_back (barValue ({ 162.0f, y, 170.0f, 22.0f }, P ("Character"), tr ("Even / odd")));
-        out.push_back (barValue ({ 336.0f, y, 150.0f, 22.0f }, P ("Air freq."), tr ("High freq")));
+        out.push_back (barValue ({ 8.0f, y, 110.0f, 22.0f }, P ("Dynamic"), tr ("Dynamic")));
+        if (dynamicModel())
+        {
+            out.push_back (barValue ({ 490.0f, y, 110.0f, 22.0f }, P ("Mix"), tr ("Mix")));
+            out.push_back (barValue ({ 604.0f, y, 110.0f, 22.0f }, P ("Output"), tr ("Trim")));
+            return;
+        }
+        out.push_back (barValue ({ 122.0f, y, 120.0f, 22.0f }, P ("Exciter freq."), tr ("Mid freq")));
+        out.push_back (barValue ({ 246.0f, y, 120.0f, 22.0f }, P ("Character"), tr ("Even / odd")));
+        out.push_back (barValue ({ 370.0f, y, 116.0f, 22.0f }, P ("Air freq."), tr ("High freq")));
         out.push_back (barValue ({ 490.0f, y, 110.0f, 22.0f }, P ("Mix"), tr ("Mix")));
         out.push_back (barValue ({ 604.0f, y, 110.0f, 22.0f }, P ("Output"), tr ("Trim")));
     }

+ 194 - 0
tests/Match124Tests.inc

@@ -0,0 +1,194 @@
+// Round 124: LYNX's substitutes matched to the official trials at her settings (docs/analise/REA_rodada124.md).
+// Golden values are the REFERENCE's measured outputs (fxmeasure, 48 kHz); the substitute must stay within them.
+
+namespace m124
+{
+constexpr double sr = 48000.0;
+struct Stereo
+{
+    std::vector<float> l, r;
+};
+inline Stereo run (const lynx::EffectSlot& slot, Stereo x)
+{
+    auto fx = lynx::makeEffect (slot);
+    fx->prepare (sr);
+    fx->reset();
+    for (std::size_t off = 0; off < x.l.size(); off += 512)
+    {
+        const auto m = (int) std::min<std::size_t> (512, x.l.size() - off);
+        fx->process (x.l.data() + off, x.r.data() + off, m, slot.params, 120.0);
+    }
+    return x;
+}
+inline Stereo sine (double hz, double db, double secs)
+{
+    Stereo s;
+    const auto n = (std::size_t) (secs * sr);
+    s.l.resize (n);
+    for (std::size_t i = 0; i < n; ++i)
+        s.l[i] = (float) (std::pow (10.0, db / 20.0) * std::sin (2.0 * 3.141592653589793 * hz * (double) i / sr));
+    s.r = s.l;
+    return s;
+}
+// the gain (dB) at hz of y over x from `from` on (a single-bin DFT)
+inline double gainDb (const std::vector<float>& x, const std::vector<float>& y, double hz, std::size_t from)
+{
+    double xr = 0, xi = 0, yr = 0, yi = 0;
+    for (auto i = from; i < x.size(); ++i)
+    {
+        const auto w = 2.0 * 3.141592653589793 * hz * (double) i / sr;
+        xr += x[i] * std::cos (w), xi += x[i] * std::sin (w);
+        yr += y[i] * std::cos (w), yi += y[i] * std::sin (w);
+    }
+    return 10.0 * std::log10 ((yr * yr + yi * yi) / (xr * xr + xi * xi));
+}
+inline lynx::EffectSlot substitute (const lynx::ForeignPlugin& fp)
+{
+    auto slot = subst113::pluginSlot (fp);
+    CHECK (lynx::substituteEffectSlot (slot, lynx::pluginIdentity (fp)));
+    slot.mix = 1.0f;
+    return slot;
+}
+} // namespace m124
+
+TEST (fresh_air_dynamic_model_matches_the_trial_round124)
+{
+    using namespace lynx;
+    ForeignPlugin fa;
+    fa.format = ForeignPlugin::Format::vst3;
+    fa.name = "Fresh Air";
+    fa.classId = substtest::classIdOf ("f2a24ccd9800ac4900439bb9001cb96a");
+    fa.hasClassId = true;
+    fa.state = substtest::flVst3State (subst113::freshAirState (0.292f, 0.252f)); // her main setting (733 slots)
+    const auto slot = m124::substitute (fa);
+    CHECK (slot.kind == EffectKind::aether && slot.params[mixsuite::aether::dynamic] == 1.0f);
+    // [EXEC] the official trial at 0.292 / 0.252, steady sines (dB of output over input)
+    struct Point { double hz, level, gain; };
+    static constexpr Point golden[] = { { 1000, -60, 1.083 }, { 1000, -12, 1.083 }, { 1000, 0, 1.461 },
+                                        { 4000, -60, 3.681 }, { 4000, -12, 1.815 }, { 4000, 0, 1.795 },
+                                        { 10000, -60, 9.762 }, { 10000, -30, 8.129 }, { 10000, -12, 3.384 }, { 10000, 0, 2.380 },
+                                        { 16000, -60, 12.077 }, { 16000, -30, 9.432 }, { 16000, -12, 4.087 }, { 16000, 0, 2.647 } };
+    for (const auto& g : golden)
+    {
+        const auto x = m124::sine (g.hz, g.level, 0.5);
+        const auto y = m124::run (slot, x);
+        const auto d = m124::gainDb (x.l, y.l, g.hz, (std::size_t) (0.3 * m124::sr));
+        // (16 kHz at -30 dBFS, a steady sine just past the high band's second knee, is the model's worst point: 0.36 dB;
+        // the dynamics were fitted on her takes, where the spectra agree within 0.05 dB RMS)
+        const auto tolerance = g.hz == 16000 && g.level == -30 ? 0.4 : 0.25;
+        if (std::abs (d - g.gain) > tolerance)
+            std::printf ("  Fresh Air %g Hz %g dBFS: %.3f dB, reference %.3f\n", g.hz, g.level, d, g.gain);
+        CHECK (std::abs (d - g.gain) <= tolerance);
+    }
+    // no latency, unlike the classic oversampled exciter path
+    auto fx = makeEffect (slot);
+    fx->prepare (m124::sr);
+    std::vector<float> l (64, 0.0f), r (64, 0.0f);
+    fx->process (l.data(), r.data(), 64, slot.params, 120.0);
+    CHECK (fx->latencySamples() == 0);
+}
+
+TEST (doubler_her_state_timing_is_sample_exact_round124)
+{
+    using namespace lynx;
+    namespace g = voicetools::gemini;
+    // her Doubler (1969 slots): voices 78.2 / 100 ms, -1 / 0 cents, feedback 39 %, hard left / right, aligned
+    PluginIdentity id;
+    id.format = ForeignPlugin::Format::vst3;
+    id.name = "WaveShell1-VST3 15.5_x64";
+    id.state = substtest::wavesComponent ("Doubler", "0 1 0 0 1 * * * * 0 -28.7 841 3538 -13.7 0 16 0 0 0 0 64 20 32 -60 -40 -20 "
+                                                     "1 0 -45 0 -1 78.2 39 0 1 * 1 0 45 0 0 100 39 0 1 *");
+    const auto* entry = findPluginSubstitute (id, false);
+    CHECK (entry != nullptr);
+    if (entry == nullptr)
+        return;
+    int n = 0;
+    auto slot = makeSubstituteSlot (*entry, &id, &n);
+    slot.mix = 1.0f;
+    CHECK (slot.kind == EffectKind::geminiDoubler);
+    for (const double rate : { 48000.0, 44100.0 })
+    {
+        m124::Stereo x;
+        x.l.assign ((std::size_t) (0.5 * rate), 0.0f);
+        x.r = x.l;
+        x.r[1000] = 0.5f;
+        auto fx = makeEffect (slot);
+        fx->prepare (rate);
+        fx->reset();
+        for (std::size_t off = 0; off < x.l.size(); off += 512)
+            fx->process (x.l.data() + off, x.r.data() + off, (int) std::min<std::size_t> (512, x.l.size() - off), slot.params, 120.0);
+        // [EXEC] the trial at 48 and 44.1 kHz: the direct 320 samples late, the 0-cent voice its delay + 495 samples,
+        // every repeat one sample more, 0.39 × a first-order 16 Hz high-pass (first sample 0.39 × 0.998954)
+        const auto d = (std::size_t) std::lround (0.1 * rate);
+        CHECK (std::abs (x.r[1000 + 320] - 0.5f) < 1e-6f);
+        CHECK (std::abs (x.r[1000 + d + 495] - 0.5f) < 1e-6f);
+        const auto k = std::tan (3.141592653589793 * 16.0 / rate);
+        CHECK (std::abs (x.r[1000 + 2 * (d + 495) + 1] - 0.5f * 0.39f * (float) (1.0 / (1.0 + k))) < 1e-5f);
+    }
+    // the -1-cent voice drifts by 1 - 2^(-1/1200) samples per sample from 495 (linear reads)
+    {
+        m124::Stereo x;
+        x.l.assign (48000 * 2, 0.0f);
+        x.r = x.l;
+        auto s2 = slot;
+        s2.params[g::directOn] = 0.0f;
+        s2.params[(std::size_t) g::voiceParam (0, g::vFeedback)] = 0.0f;
+        const std::size_t at = 48000;
+        x.l[at] = 1.0f;
+        const auto y = m124::run (s2, x);
+        const auto expected = (double) at + 3753.6 + 495.0 + (1.0 - std::pow (2.0, -1.0 / 1200.0)) * (double) (at + 3753.6 + 495.0);
+        double num = 0.0, den = 0.0;
+        for (std::size_t i = (std::size_t) expected - 4; i < (std::size_t) expected + 5; ++i)
+            num += (double) i * y.l[i], den += y.l[i];
+        CHECK (std::abs (num / den - expected) < 0.05);
+    }
+}
+
+TEST (h_delay_hybrid_engine_matches_the_trial_round124)
+{
+    using namespace lynx;
+    namespace e = echosuite::echoform;
+    PluginIdentity id;
+    id.format = ForeignPlugin::Format::vst3;
+    id.name = "WaveShell1-VST3 16.0_x64";
+    id.state = substtest::wavesComponent ("H-Delay", "* 1 120 1000 16 * 100 60 0 0 1 * * * 0 20100 * 19 * 0 0.1 0 * 0");
+    const auto* entry = findPluginSubstitute (id, false);
+    CHECK (entry != nullptr);
+    if (entry == nullptr)
+        return;
+    int n = 0;
+    auto slot = makeSubstituteSlot (*entry, &id, &n);
+    slot.mix = 1.0f;
+    CHECK (e::hybridOf (slot.params[e::hybrid]) == 1);
+    // [EXEC] Analog off, a lone 0 dBFS impulse on the left: (L + R)/√2 through x / (1 + |x|) on every pass
+    m124::Stereo x;
+    x.l.assign (48000 * 4, 0.0f);
+    x.r = x.l;
+    x.l[1000] = 1.0f;
+    x.l[1480] = 0.01f; // 10 ms later: the gain is still released only part of the way (one shared 10 ms release)
+    const auto y = m124::run (slot, x);
+    CHECK (std::abs (y.l[1000 + 48000] - 0.414212f) < 2e-6f);
+    CHECK (std::abs (y.r[1000 + 96001] - 0.292893f) < 2e-6f);
+    CHECK (std::abs (y.l[1000 + 144002] - 0.09538f) < 2e-5f);
+    CHECK (std::abs (y.l[1480 + 48000] - 0.005994f) < 2e-6f);
+    // the two lines share their gain: a loud left pass turns the right one down
+    m124::Stereo z;
+    z.l.assign (48000 * 3, 0.0f);
+    z.r = z.l;
+    for (std::size_t i = 0; i < 4800; ++i)
+        z.l[1000 + i] = (float) (0.5 * std::sin (2.0 * 3.141592653589793 * 200.0 * (double) i / 48000.0));
+    for (std::size_t i = 0; i < 4800; ++i)
+        z.l[49000 + i] = (float) (0.9 * std::sin (2.0 * 3.141592653589793 * 300.0 * (double) i / 48000.0));
+    const auto w = m124::run (slot, z);
+    double eLinked = 0.0;
+    for (std::size_t i = 97001; i < 97001 + 4800; ++i)
+        eLinked += (double) w.r[i] * w.r[i];
+    z.l.assign (z.l.size(), 0.0f);
+    for (std::size_t i = 0; i < 4800; ++i)
+        z.l[1000 + i] = (float) (0.5 * std::sin (2.0 * 3.141592653589793 * 200.0 * (double) i / 48000.0));
+    const auto v = m124::run (slot, z);
+    double eAlone = 0.0;
+    for (std::size_t i = 97001; i < 97001 + 4800; ++i)
+        eAlone += (double) v.r[i] * v.r[i];
+    CHECK (eLinked < eAlone * 0.8);
+}

+ 5 - 6
tests/Substitutes113Tests.inc

@@ -137,12 +137,11 @@ TEST (fresh_air_amounts_become_a_gentle_air_band_round113)
     auto slot = subst113::pluginSlot (fa);
     CHECK (substituteEffectSlot (slot, pluginIdentity (fa)));
     CHECK (slot.kind == EffectKind::aether);
-    // the measured law (official trial, round 113 §3b): mid 0.488 / high 0.374 -> about +8.9 dB from about 6.3 kHz
-    const auto airDb = mixsuite::aether::airDb (slot.params[mixsuite::aether::air]);
-    const auto airHz = mixsuite::aether::airHz (slot.params[mixsuite::aether::airFreq]);
-    CHECK (airDb > 8.5 && airDb < 9.3);
-    CHECK (airHz > 6000.0 && airHz < 6600.0);
-    CHECK (slot.params[mixsuite::aether::harmonics] == 0.0f);
+    // round 124: the dynamic air model takes the two amounts one to one (REA_rodada124 §3)
+    CHECK (slot.params[mixsuite::aether::dynamic] == 1.0f);
+    CHECK (std::abs (slot.params[mixsuite::aether::midAir] - 0.488f) < 1e-6f && std::abs (slot.params[mixsuite::aether::highAir] - 0.374f) < 1e-6f);
+    CHECK (slot.params[mixsuite::aether::harmonics] == 0.0f && slot.params[mixsuite::aether::air] == 0.0f);
+    CHECK (std::abs (slot.params[mixsuite::aether::output] - 0.5f) < 1e-6f); // Trim 0 dB
 }
 
 TEST (gentle_defaults_of_unreadable_vocal_substitutes_round113)

+ 7 - 5
tests/VoiceToolsTests119.inc

@@ -231,9 +231,10 @@ TEST (waves_h_delay_ns1_doubler_translate_round119)
         CHECK (n > 0 && s.kind == EffectKind::echoform);
         CHECK (e::styleOf (s.params[e::style]) == e::Style::pingPong && s.params[e::pairs] == 1.0f);
         CHECK (std::abs (e::sideMs (s.params, false, 120.0) - 1000.0) < 0.01 && std::abs (e::sideMs (s.params, true, 90.0) - 60000.0 / 90.0 * 2.0) < 0.01);
-        CHECK (std::abs (e::feedbackGain (s.params[e::feedback]) - 0.93 * 0.36) < 1e-3);
-        CHECK (s.params[e::mix] == 1.0f && std::abs (e::outputDb (s.params[e::output]) + 1.4) < 0.01);
-        CHECK (e::modeOf (s.params[e::mode]) == e::Mode::clean && s.params[e::lowCut] == 0.0f && s.params[e::highCut] == 1.0f);
+        // round 124: the hybrid engine (analog), H-Delay's own feedback (0.6) and output (0 dB)
+        CHECK (e::hybridOf (s.params[e::hybrid]) == 2);
+        CHECK (std::abs (e::feedbackGain (s.params[e::feedback]) - 0.6) < 1e-3);
+        CHECK (s.params[e::mix] == 1.0f && std::abs (e::outputDb (s.params[e::output])) < 0.01);
     }
     // its own BPM (1/8 dotted at 125 = 360 ms), stereo mode, +8.2 dB, mix 41
     {
@@ -242,8 +243,9 @@ TEST (waves_h_delay_ns1_doubler_translate_round119)
         namespace e = echosuite::echoform;
         CHECK (e::styleOf (s.params[e::style]) == e::Style::single && s.params[e::pairs] == 0.0f);
         CHECK (std::abs (e::sideMs (s.params, false, 90.0) - 360.0) < 2.0);
-        CHECK (std::abs (e::feedbackGain (s.params[e::feedback]) - 0.98 * 0.4) < 1e-3);
-        CHECK (std::abs (s.params[e::mix] - 0.41f) < 1e-4f && std::abs (e::outputDb (s.params[e::output]) - 7.8) < 0.01);
+        CHECK (e::hybridOf (s.params[e::hybrid]) == 1); // Analog off
+        CHECK (std::abs (e::feedbackGain (s.params[e::feedback]) - 0.4) < 1e-3);
+        CHECK (std::abs (s.params[e::mix] - 0.41f) < 1e-4f && std::abs (e::outputDb (s.params[e::output]) - 8.2) < 0.01);
     }
     // NS1: value 229 is the knob
     {

+ 1 - 0
tests/tests.cpp

@@ -15749,3 +15749,4 @@ TEST (plugin_layout_options_match_the_engine_values)
 #include "LoadTraceTests112.inc"
 #include "VoiceToolsTests119.inc"
 #include "LoadTests121.inc"
+#include "Match124Tests.inc"