Browse Source

Hyper Chorus and Vintage Chorus exact engines (REA round 59), wired into the FL import and the mixer; chorus tests

Ka1-S 1 month ago
parent
commit
b4ff35a423

+ 609 - 0
src/core/ChorusFx.cpp

@@ -10,10 +10,14 @@
 #include <cmath>
 #include <cstdio>
 #include <cstring>
+#include <functional>
 
 #if defined(__SSE__) || defined(_M_X64) || defined(__x86_64__)
 #include <xmmintrin.h>
 #define LYNX_CHORUS_MXCSR 1
+#if defined(__GNUC__) || defined(__clang__)
+#include <immintrin.h>
+#endif
 #endif
 
 #if defined(__clang__)
@@ -837,6 +841,16 @@ private:
 } // namespace
 
 std::unique_ptr<Effect> make (int instance) { return std::make_unique<HyperChorusEffect> (instance); }
+int instanceOf (const std::vector<std::uint8_t>& slotState) noexcept
+{
+    return slotState.size() == 4 ? std::clamp ((int) i32At (slotState, 0), 0, 1 << 20) : 0;
+}
+std::vector<std::uint8_t> instanceState (int instance)
+{
+    std::vector<std::uint8_t> b (4);
+    std::memcpy (b.data(), &instance, 4);
+    return b;
+}
 const EffectInfo& info()
 {
     static const EffectInfo i = [] {
@@ -849,13 +863,594 @@ const EffectInfo& info()
 }
 } // namespace hyperchorusfx
 
+// ================================================================================================ Vintage Chorus (§3)
+namespace vintagechorusfx
+{
+namespace
+{
+// fused multiply-add: the engine's library runs its FMA variant on processors that have FMA (§3.7)
+#if defined(LYNX_CHORUS_MXCSR) && (defined(__GNUC__) || defined(__clang__))
+__attribute__ ((target ("fma"))) double fmaHw (double a, double b, double c) noexcept
+{
+    return _mm_cvtsd_f64 (_mm_fmadd_sd (_mm_set_sd (a), _mm_set_sd (b), _mm_set_sd (c)));
+}
+bool hasFma() noexcept
+{
+    static const bool f = __builtin_cpu_supports ("fma");
+    return f;
+}
+inline double fmaD (double a, double b, double c) noexcept { return hasFma() ? fmaHw (a, b, c) : std::fma (a, b, c); }
+#else
+inline double fmaD (double a, double b, double c) noexcept { return std::fma (a, b, c); }
+#endif
+
+// the library's sinf for |x| < 2^24 (§3.7): double evaluation, odd/even polynomials after a reduction by π/2
+float libSinf (float xf) noexcept
+{
+    const double x = xf, ax = std::fabs (x);
+    if (! (ax > 0.7853981633974483))
+    {
+        if (ax < 0.0078125)
+        {
+            if (ax < 0.0001220703125)
+                return xf;
+            const double x3 = (x * x) * x;
+            return (float) fmaD (-x3, 0.16666666666666666, x);
+        }
+        const double x2 = x * x;
+        double p = fmaD (x2, 2.7557319223985893e-06, -0.0001984126984126984);
+        p = fmaD (p, x2, 0.008333333333333333);
+        p = fmaD (p, x2, -0.16666666666666666);
+        return (float) fmaD (p, x * x2, x);
+    }
+    const int n = (int) fmaD (ax, 0.6366197723675814, 0.5);
+    const double nd = n;
+    const double r = fmaD (-nd, 1.5707963267341256, ax) - nd * 6.077100506506192e-11;
+    const double r2 = r * r;
+    double y;
+    if (n & 1)
+    {
+        const double c = fmaD (r2, -0.5, 1.0);
+        double p = fmaD (r2, -2.755731922398589e-07, 2.4801587301587298e-05);
+        p = fmaD (p, r2, -0.0013888888888888887);
+        p = fmaD (p, r2, 0.041666666666666664);
+        y = fmaD (p, r2 * r2, c);
+    }
+    else
+    {
+        double p = fmaD (r2, 2.7557319223985893e-06, -0.0001984126984126984);
+        p = fmaD (p, r2, 0.008333333333333333);
+        p = fmaD (p, r2, -0.16666666666666666);
+        y = fmaD (p, r * r2, r);
+    }
+    const bool negate = ((n & 3) >= 2) != std::signbit (x);
+    return (float) (negate ? -y : y);
+}
+
+constexpr float pif = 3.14159274f;
+inline float hexF (std::uint32_t u) noexcept
+{
+    float f;
+    std::memcpy (&f, &u, 4);
+    return f;
+}
+constexpr int lineSize = 32768, lineMask = lineSize - 1;
+
+struct Biquad5
+{
+    float c[5] {}; // feed-forward x, x1, x2; feedback y1, y2 (already negated)
+    float x1[2] {}, x2[2] {}, y1[2] {}, y2[2] {};
+    float run (int ch, float x) noexcept
+    {
+        const float y = (((c[1] * x1[ch] + c[0] * x) + c[2] * x2[ch]) + c[3] * y1[ch]) + c[4] * y2[ch];
+        x2[ch] = x1[ch], x1[ch] = x, y2[ch] = y1[ch], y1[ch] = y;
+        return y;
+    }
+    void clear() noexcept
+    {
+        for (int ch = 0; ch < 2; ++ch)
+            x1[ch] = x2[ch] = y1[ch] = y2[ch] = 0.0f;
+    }
+};
+struct OnePole
+{
+    float b0 = 0.0f, b1 = 0.0f, a1 = 0.0f, piOverFs = 0.0f;
+    float x1[2] {}, y1[2] {};
+    float run (int ch, float x) noexcept
+    {
+        const float y = (b1 * x1[ch] + b0 * x) + a1 * y1[ch];
+        x1[ch] = x, y1[ch] = y;
+        return y;
+    }
+    void highPass (float f) noexcept
+    {
+        const auto t = (float) std::tan ((double) (f * piOverFs));
+        b0 = 1.0f / (t + 1.0f);
+        b1 = -b0;
+        a1 = -(t - 1.0f) / (t + 1.0f);
+    }
+    void lowPass (float f) noexcept
+    {
+        const auto t = (float) std::tan ((double) (piOverFs * f));
+        b0 = b1 = t / (t + 1.0f);
+        a1 = -(t - 1.0f) / (t + 1.0f);
+    }
+    void clear() noexcept { x1[0] = x1[1] = y1[0] = y1[1] = 0.0f; }
+};
+} // namespace
+
+struct Engine::Impl
+{
+    float value[params] { 0.0f, 0.0f, 0.5f, 0.0f, 0.5f, 0.1f, 0.5f, 0.5f, 0.0f, 0.0f, 0.0f, 0.5f, 0.0f, 0.5f, 0.0f, 0.0f, 0.0f };
+    int mode = 5;
+    double fs = 44100.0;
+    // the chorus core
+    bool mono = false, sync = false, started = false, gate = false;
+    float startPhase = 0.0f, inc = 0.0f, phase = 0.0f, phaseDiff = 0.5f, d1 = 0.0f, d2 = 0.0f, dd = 0.0f;
+    double period = 0.0, lastPpq = -1.0;
+    int wave = 0;
+    std::vector<float> line[2] { std::vector<float> (lineSize, 0.0f), std::vector<float> (lineSize, 0.0f) };
+    int w[2] {};
+    OnePole pre, post;
+    Biquad5 bq1, bq2, noiseF;
+    float fb = 0.0f, out[2] {};
+    std::uint32_t seed[2] {};
+    float hiss = 0.0f, fsF = 44100.0f, invFs = 0.0f, k = 0.0f;
+    int noiseCount = 16;
+    float gateThr = 0.0025f, gateGain = 1.0f, gateDecay = 0.0f;
+    int gateHold = 440, gateCount = 440;
+    float gainT = 1.0f, polarity = 1.0f, mixT = 0.5f, mixS = 0.0f, gainS = 0.0f, gainS2 = 0.0f, dl = 0.01f, dr = 0.01f;
+    float noiseC[2][5] {};
+
+    explicit Impl (int instance)
+    {
+        const auto g = (std::uint32_t) (333784u + 0xb66adu * (std::uint32_t) std::max (0, instance));
+        seed[0] = g, seed[1] = g + 0x1099eu;
+        gateDecay = (float) std::pow (0.1, 0.00015117157373598967);
+        rateSetup (44100.0);
+        for (int pass = 0; pass < 2; ++pass)
+            for (int i = 0; i < params; ++i)
+                set (i, value[i]);
+    }
+    void rateSetup (double rate) noexcept
+    {
+        k = (float) (1.0 - std::pow (0.09999999999999998, 1.0 / (rate * 0.05)));
+        noiseCount = 16;
+        fsF = (float) rate;
+        invFs = 1.0f / fsF;
+        pre.piOverFs = (float) (1.0 / (double) fsF) * pif;
+        post.piOverFs = pre.piOverFs;
+        pre.highPass (50.0f);
+        post.lowPass (7000.0f);
+        const auto om = (double) (43982.2969f / fsF);
+        const auto S = (float) std::sin (om) / 1.41400003f, C = (float) std::cos (om);
+        const float inv = 1.0f / (S + 1.0f), h = ((1.0f - C) * 0.5f) * inv;
+        bq1.c[0] = h, bq1.c[1] = (1.0f - C) * inv, bq1.c[2] = h, bq1.c[3] = -(C * -2.0f) * inv, bq1.c[4] = -(1.0f - S) * inv;
+        std::copy (std::begin (bq1.c), std::end (bq1.c), bq2.c);
+    }
+    void setRate (double rate) noexcept
+    {
+        fs = (double) (float) rate;
+        rateSetup (fs);
+        for (int i = 0; i < params; ++i)
+            set (i, value[i]);
+    }
+    void wetHighPass (float f) noexcept { pre.highPass (f); }
+    void set (int i, float x) noexcept
+    {
+        value[i] = x;
+        switch (i)
+        {
+            case 0:
+            case 1:
+            {
+                mode = (int) ((value[0] * 3.0f) * 0.999899983f);
+                if (mode == 0 || mode == 1)
+                {
+                    if (0.5f <= value[1])
+                    {
+                        inc = 8.0f / fsF, wave = 1, phaseDiff = hexF (0x3cea61dau);
+                        d1 = hexF (0x3b3ac711u), d2 = hexF (0x3b5cdb38u), dd = hexF (0x3a08509cu);
+                    }
+                    else
+                    {
+                        inc = (mode == 0 ? 0.4f : 0.6f) / fsF, wave = 0, phaseDiff = 0.5f;
+                        d1 = hexF (0x3a8d8ec9u), d2 = hexF (0x3bab606bu), dd = hexF (0x3b87fcb9u);
+                    }
+                    mixT = 0.5f, polarity = 1.0f, fb = 0.0f;
+                    wetHighPass (0.5f);
+                    sync = false, started = false;
+                }
+                else if (mode == 2)
+                    for (int j = 2; j < params; ++j)
+                        set (j, value[j]);
+                break;
+            }
+            case 2:
+            case 15:
+                if (mode == 2)
+                {
+                    const float v = value[2];
+                    started = false;
+                    sync = 0.5f <= value[15];
+                    inc = ((v * v) * 10.0f) / fsF;
+                    const double e = std::pow (2.0, (double) ((1.0f - v) * 7.0f));
+                    const auto t = (float) ((e - 1.0) * 1.0078740119934082);
+                    period = ((double) (int) (((t * 48.0f) * 6143.0f) / 6144.0f + 1.10000002f) / 48.0) * 0.25;
+                    if (sync)
+                        started = false;
+                }
+                break;
+            case 3:
+                if (mode == 2)
+                    wave = 0.5f <= x ? 1 : 0;
+                break;
+            case 4:
+                if (mode == 2)
+                    phaseDiff = x;
+                break;
+            case 5:
+                if (mode == 2)
+                {
+                    d1 = (x * 9.80000019f + 0.200000003f) * 0.00100000005f;
+                    dd = d2 - d1;
+                }
+                break;
+            case 6:
+                if (mode == 2)
+                {
+                    d2 = (x * 9.80000019f + 0.200000003f) * 0.00100000005f;
+                    dd = d2 - d1;
+                }
+                break;
+            case 7:
+                if (mode == 2)
+                    mixT = x;
+                break;
+            case 8: mono = 0.5f <= x; break;
+            case 9:
+                if (mode == 2)
+                    polarity = x < 0.5f ? 1.0f : -1.0f;
+                break;
+            case 10:
+                if (mode == 2)
+                    fb = x * 0.629999995f;
+                break;
+            case 11:
+                if (mode == 2)
+                    wetHighPass ((x * x) * 160.0f + 10.0f);
+                break;
+            case 12: gainT = (float) std::pow (10.0, (double) ((x * 12.0f) / 20.0f)); break;
+            case 13:
+                if (x == 0.0f)
+                    hiss = 0.0f, gateThr = 0.0f;
+                else
+                {
+                    hiss = (float) std::pow (10.0, (double) ((x * 50.0f - 90.0f) / 20.0f)) * 0.200000003f;
+                    gateThr = hiss * 8.0f;
+                }
+                break;
+            case 14: gate = 0.5f <= x; break;
+            case 16: startPhase = x; break;
+            default: break;
+        }
+    }
+    static float tri (float p) noexcept
+    {
+        if (p < 0.25f)
+            return (p + p) + 0.5f;
+        if (p < 0.75f)
+            return (1.5f - p) - p;
+        return (p - 0.75f) + (p - 0.75f);
+    }
+    float tap (int ch, float delay) const noexcept
+    {
+        const float* s = line[ch].data();
+        const float pos = delay * fsF;
+        const int n = (int) pos, u = w[ch] - n;
+        const float y0 = s[u & lineMask], y1 = s[(u - 1) & lineMask], y2 = s[(u - 2) & lineMask], y3 = s[(u - 3) & lineMask];
+        const float f = pos - (float) n;
+        const float c = (y2 - y0) * 0.5f, A = y1 - y2, B = A + c, D = (y3 - y1) * 0.5f + (B + A);
+        return ((((D * f) - (D + B)) * f) + c) * f + y1;
+    }
+    void sample (float& L, float& R, double tempo, double ppq) noexcept
+    {
+        if (mono)
+        {
+            const float v = (L + R) * 0.5f;
+            L = R = v;
+        }
+        if (lastPpq < 0.0 && 0.0 <= ppq)
+            started = true;
+        lastPpq = ppq;
+        if (sync)
+        {
+            if (started && 0.0 <= ppq)
+            {
+                const float f = (float) (ppq / period) + startPhase;
+                phase = f - (float) (int) f;
+            }
+            inc = (float) ((tempo / 60.0) / period) * invFs;
+        }
+        const float p = phase, pr = (p + phaseDiff) - (float) (int) (p + phaseDiff);
+        float lfoL, lfoR;
+        if (wave == 1)
+        {
+            lfoL = libSinf (p * 6.28318548f) * 0.5f + 0.5f;
+            lfoR = libSinf (pr * 6.28318548f) * 0.5f + 0.5f;
+        }
+        else
+            lfoL = tri (p), lfoR = tri (pr);
+        dl = ((dd * lfoL + d1) - dl) * k + dl;
+        dr = ((dd * lfoR + d1) - dr) * k + dr;
+        const float xL = fb * out[0] + L, xR = fb * out[1] + R;
+        phase = (p + inc) - (float) (int) (p + inc);
+        float yL = pre.run (0, xL), yR = pre.run (1, xR);
+        yL = bq2.run (0, bq1.run (0, yL));
+        yR = bq2.run (1, bq1.run (1, yR));
+        line[0][(std::size_t) w[0]] = yL;
+        w[0] = (w[0] + 1) & lineMask;
+        float oL = tap (0, dl);
+        line[1][(std::size_t) w[1]] = yR;
+        w[1] = (w[1] + 1) & lineMask;
+        out[0] = oL;
+        float oR = tap (1, dr);
+        out[1] = oR;
+        if (hiss > 0.0f)
+        {
+            ++noiseCount;
+            seed[0] = seed[0] * 0x0BB38435u + 0x3619636Bu;
+            seed[1] = seed[1] * 0x0BB38435u + 0x3619636Bu;
+            const float nL = (float) (std::int32_t) seed[0] * 4.65661287e-10f, nR = (float) (std::int32_t) seed[1] * 4.65661287e-10f;
+            if (noiseCount >= 16)
+            {
+                noiseCount = 0;
+                const auto om = (double) (40840.7070f / fsF);
+                const float S2 = (float) std::sin (om) + (float) std::sin (om), c2 = (float) std::cos (om) * -2.0f;
+                const float g[2] { (lfoL + lfoL) + 1.0f, (lfoR + lfoR) + 1.0f };
+                for (int ch = 0; ch < 2; ++ch)
+                {
+                    const float q = S2 / g[ch], pp = S2 * g[ch], inv = 1.0f / (q + 1.0f);
+                    noiseC[ch][0] = (pp + 1.0f) * inv;
+                    noiseC[ch][1] = c2 * inv;
+                    noiseC[ch][2] = (1.0f - pp) * inv;
+                    noiseC[ch][3] = -c2 * inv;
+                    noiseC[ch][4] = -(1.0f - q) * inv;
+                }
+            }
+            float nf[2];
+            for (int ch = 0; ch < 2; ++ch)
+            {
+                std::copy (std::begin (noiseC[ch]), std::end (noiseC[ch]), noiseF.c);
+                nf[ch] = noiseF.run (ch, ch == 0 ? nL : nR);
+            }
+            oL = oL + hiss * nf[0];
+            oR = oR + hiss * nf[1];
+        }
+        const float pL = post.run (0, oL), pR = post.run (1, oR);
+        const float m = (mixT - mixS) * k + mixS;
+        mixS = m;
+        const float dryArg = 1.0f - m;
+        const float g = (gainT - gainS) * k + gainS;
+        gainS = g;
+        gainS2 = (gainT - gainS2) * k + gainS2;
+        const float dry = std::sqrt (dryArg), wet = std::sqrt (m);
+        float sL = ((pL * wet) * polarity) + L * dry, sR = ((pR * wet) * polarity) + R * dry;
+        if (gate)
+        {
+            int cnt;
+            if (std::fabs (sL) >= gateThr || std::fabs (sR) >= gateThr)
+            {
+                cnt = gateHold;
+                gateCount = cnt;
+                gateGain = 1.0f;
+            }
+            else
+                cnt = gateCount;
+            if (cnt > 0)
+                gateCount = cnt - 1;
+            else
+                gateGain = gateGain * gateDecay;
+            sL = gateGain * sL, sR = gateGain * sR;
+        }
+        L = sL * g;
+        R = sR * g;
+    }
+    void settle() noexcept
+    {
+        for (auto& l : line)
+            std::fill (l.begin(), l.end(), 0.0f);
+        w[0] = w[1] = 0;
+        pre.clear(), post.clear(), bq1.clear(), bq2.clear(), noiseF.clear();
+        out[0] = out[1] = 0.0f;
+        mixS = mixT, gainS = gainS2 = gainT;
+        const float p = phase, pr = (p + phaseDiff) - (float) (int) (p + phaseDiff);
+        dl = dd * (wave == 1 ? libSinf (p * 6.28318548f) * 0.5f + 0.5f : tri (p)) + d1;
+        dr = dd * (wave == 1 ? libSinf (pr * 6.28318548f) * 0.5f + 0.5f : tri (pr)) + d1;
+        gateGain = 1.0f, gateCount = gateHold;
+    }
+};
+
+Engine::Engine (int instance) : d (std::make_unique<Impl> (instance)) {}
+Engine::~Engine() = default;
+void Engine::setRate (double sampleRate) noexcept { d->setRate (sampleRate); }
+void Engine::setParam (int index, float value) noexcept
+{
+    if (index >= 0 && index < params)
+        d->set (index, value);
+}
+float Engine::param (int index) const noexcept { return d->value[index]; }
+void Engine::settle() noexcept { d->settle(); }
+void Engine::render (const float* in, float* out, int n, double tempo, double ppq, bool playing) noexcept
+{
+    CsrMode mode (0x8040u);
+    const double step = playing ? tempo / 60.0 / (double) d->fsF : 0.0;
+    double pos = playing ? ppq : -1.0;
+    for (int i = 0; i < n; ++i)
+    {
+        float L = in[2 * i], R = in[2 * i + 1];
+        d->sample (L, R, tempo, pos);
+        out[2 * i] = L, out[2 * i + 1] = R;
+        pos += step;
+    }
+}
+
+std::optional<State> parse (const std::vector<std::uint8_t>& state)
+{
+    if (state.size() < 4 + 4 * params || i32At (state, 0) >= 2)
+        return std::nullopt;
+    State s {};
+    for (int i = 0; i < params; ++i)
+        s[(std::size_t) i] = i32At (state, 4 + 4 * (std::size_t) i);
+    return s;
+}
+void toParams (const State& s, float* p) noexcept
+{
+    for (int i = 0; i < params; ++i)
+        p[i] = norm (s[(std::size_t) i], rawMin[(std::size_t) i], rawMax[(std::size_t) i]);
+}
+State fromParams (const float* p) noexcept
+{
+    State s {};
+    for (int i = 0; i < params; ++i)
+        s[(std::size_t) i] = rawFrom (p[i], rawMin[(std::size_t) i], rawMax[(std::size_t) i]);
+    return s;
+}
+const char* paramName (int param) noexcept
+{
+    static const char* names[params] { "Mode",      "Link Chorus 1&2", "LFO speed",   "LFO wave",   "LFO L/R phase", "Delay time 1",
+                                       "Delay time 2", "Wet/dry mix",   "Mono input",  "Wet polarity", "Feedback",     "Wet HP freq",
+                                       "Gain",      "Hiss",            "Noise gate",  "LFO sync",   "LFO start phase" };
+    return param >= 0 && param < params ? names[param] : "";
+}
+std::string paramText (int param, float value01)
+{
+    char text[40];
+    const int p = std::clamp (param, 0, params - 1);
+    const int raw = rawFrom (value01, rawMin[(std::size_t) p], rawMax[(std::size_t) p]);
+    const double x = (double) (raw - rawMin[(std::size_t) p]) / (rawMax[(std::size_t) p] - rawMin[(std::size_t) p]);
+    switch (p)
+    {
+        case 0:
+        {
+            static const char* modes[3] { "Chorus 1", "Chorus 2", "custom" };
+            return modes[std::clamp ((int) (x * 3.0 * 0.9999), 0, 2)];
+        }
+        case 1:
+        case 8:
+        case 14:
+        case 15: return x >= 0.5 ? "on" : "off";
+        case 2: std::snprintf (text, sizeof (text), "%.2f Hz", x * x * 10.0); return text;
+        case 3: return x >= 0.5 ? "sine" : "triangle";
+        case 5:
+        case 6: std::snprintf (text, sizeof (text), "%.2f ms", x * 9.8 + 0.2); return text;
+        case 7: std::snprintf (text, sizeof (text), "%.0f%% wet", x * 100.0); return text;
+        case 9: return x >= 0.5 ? "inverted" : "normal";
+        case 11: std::snprintf (text, sizeof (text), "%.0f Hz", x * x * 160.0 + 10.0); return text;
+        case 12: std::snprintf (text, sizeof (text), "%.1f dB", x * 12.0); return text;
+        case 13:
+            if (x == 0.0)
+                return "off";
+            std::snprintf (text, sizeof (text), "%.1f dB", x * 50.0 - 90.0);
+            return text;
+        default: std::snprintf (text, sizeof (text), "%.2f", x); return text;
+    }
+}
+
+namespace
+{
+class VintageChorusEffect final : public Effect
+{
+public:
+    explicit VintageChorusEffect (int instance) : engine (instance) {}
+    void prepare (double sampleRate) noexcept override
+    {
+        rate = sampleRate;
+        engine.setRate (sampleRate);
+        engine.settle();
+    }
+    void reset() noexcept override { engine.settle(); }
+    void setSongPosition (double ticks) noexcept override { songTicks = ticks; }
+    void process (float* left, float* right, int n, const EffectParams& params, double bpm) noexcept override
+    {
+        const auto s = fromParams (params.data());
+        bool changed = false;
+        for (int i = 0; i < vintagechorusfx::params; ++i)
+        {
+            const float v = flValue (s[(std::size_t) i], rawMin[(std::size_t) i], rawMax[(std::size_t) i]);
+            if (v != engine.param (i) || ! started)
+                engine.setParam (i, v), changed = true;
+        }
+        if (! started && changed)
+            engine.settle();
+        started = true;
+        const double beats = songTicks / (double) lynx::ppq;
+        for (int o = 0; o < n; o += 512)
+        {
+            const int m = std::min (512, n - o);
+            for (int i = 0; i < m; ++i)
+            {
+                buf[2 * (std::size_t) i] = left[o + i];
+                buf[2 * (std::size_t) i + 1] = right[o + i];
+            }
+            engine.render (buf.data(), buf.data(), m, bpm, beats + (double) o * bpm / 60.0 / rate, songTicks >= 0.0);
+            for (int i = 0; i < m; ++i)
+            {
+                left[o + i] = buf[2 * (std::size_t) i];
+                right[o + i] = buf[2 * (std::size_t) i + 1];
+            }
+        }
+    }
+
+private:
+    Engine engine;
+    bool started = false;
+    double songTicks = -1.0, rate = 44100.0;
+    std::array<float, 1024> buf {};
+};
+} // namespace
+
+std::unique_ptr<Effect> make (int instance) { return std::make_unique<VintageChorusEffect> (instance); }
+const EffectInfo& info()
+{
+    static const EffectInfo i = [] {
+        EffectInfo e { "Vintage Chorus", {} };
+        for (int k = 0; k < params; ++k)
+            e.params.push_back ({ paramName (k), norm (defaults[(std::size_t) k], rawMin[(std::size_t) k], rawMax[(std::size_t) k]) });
+        return e;
+    }();
+    return i;
+}
+} // namespace vintagechorusfx
+
 // ============================================================================================================ FL import
 int chorusControls (const std::string& pluginName) noexcept
 {
     if (pluginName == "Fruity Chorus")
         return fruitychorusfx::params;
+    if (pluginName == "Hyper Chorus")
+        return hyperchorusfx::params;
+    if (pluginName == "Vintage Chorus")
+        return vintagechorusfx::params;
     return 0;
 }
+void numberChorusInstances (Song& song)
+{
+    int next = 0, nextVintage = 0;
+    std::function<void (std::vector<EffectSlot>&)> walk = [&] (std::vector<EffectSlot>& chain) {
+        for (auto& fx : chain)
+        {
+            if (fx.kind == EffectKind::hyperChorus)
+                fx.state = hyperchorusfx::instanceState (next++);
+            if (fx.kind == EffectKind::vintageChorus)
+                fx.state = hyperchorusfx::instanceState (nextVintage++);
+            for (auto& b : fx.branches)
+                walk (b.chain);
+        }
+    };
+    for (auto& t : song.mixer)
+        walk (t.effects);
+}
 std::optional<EffectSlot> chorusFromFl (const std::string& pluginName, const std::vector<std::uint8_t>& state)
 {
     if (pluginName == "Fruity Chorus")
@@ -865,6 +1460,20 @@ std::optional<EffectSlot> chorusFromFl (const std::string& pluginName, const std
             fruitychorusfx::toParams (*s, slot.params.data());
             return slot;
         }
+    if (pluginName == "Hyper Chorus")
+        if (const auto s = hyperchorusfx::parse (state))
+        {
+            auto slot = makeEffectSlot (EffectKind::hyperChorus);
+            hyperchorusfx::toParams (*s, slot.params.data());
+            return slot;
+        }
+    if (pluginName == "Vintage Chorus")
+        if (const auto s = vintagechorusfx::parse (state))
+        {
+            auto slot = makeEffectSlot (EffectKind::vintageChorus);
+            vintagechorusfx::toParams (*s, slot.params.data());
+            return slot;
+        }
     return std::nullopt;
 }
 } // namespace lynx

+ 47 - 0
src/core/ChorusFx.h

@@ -12,6 +12,10 @@
 //   [5] movement speed (0…1000 each), [6] ArachnaChor mode (0…1), [7] low-pass 7140…22000, [8] high-pass 120…10900
 //   (minimum = off), [9] dry/wet 0…1000, [10] LFO phase difference 0…1000. EffectSlot::state holds the instance
 //   number that picks FL's random LFO start phases (§2.6).
+// Vintage Chorus (EffectKind::vintageChorus): FL's 17 controls, (raw − min) / (max − min): [0] mode (Chorus 1 /
+//   Chorus 2 / custom), [1] link Chorus 1 & 2, [2] LFO speed, [3] LFO wave, [4] LFO L/R phase, [5] delay 1,
+//   [6] delay 2, [7] wet/dry mix, [8] mono input, [9] wet polarity, [10] feedback, [11] wet high-pass, [12] gain,
+//   [13] hiss, [14] noise gate, [15] LFO sync, [16] LFO start phase (§3).
 
 #include <array>
 #include <cstdint>
@@ -29,6 +33,8 @@ namespace lynx
 // other plugins)
 std::optional<EffectSlot> chorusFromFl (const std::string& pluginName, const std::vector<std::uint8_t>& state);
 int chorusControls (const std::string& pluginName) noexcept;
+// numbers the Hyper Chorus and the Vintage Chorus slots of an imported song in mixer order (EffectSlot::state)
+void numberChorusInstances (Song& song);
 } // namespace lynx
 
 namespace lynx::fruitychorusfx
@@ -109,5 +115,46 @@ private:
 
 const EffectInfo& info();
 std::unique_ptr<Effect> make (int instance = 0);
+int instanceOf (const std::vector<std::uint8_t>& slotState) noexcept; // 0 when the slot holds none
+std::vector<std::uint8_t> instanceState (int instance);
 std::uint32_t randState (int calls) noexcept; // the C runtime's rand() state after `calls` calls from seed 1
 } // namespace lynx::hyperchorusfx
+
+namespace lynx::vintagechorusfx
+{
+constexpr int params = 17;
+using State = std::array<int, params>; // raw controls
+constexpr State defaults { 0, 0, 49152, 0, 3000, 60, 3000, 3000, 0, 0, 0, 3000, 0, 3000, 0, 0, 0 };
+constexpr State rawMin { 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
+constexpr State rawMax { 2, 1, 245760, 1, 6000, 6000, 6000, 6000, 1, 1, 6000, 6000, 6000, 6000, 1, 1, 6000 };
+
+// FL's saved state: i32 version (FL writes 1; 2 and above are not read), seventeen i32 in control order
+std::optional<State> parse (const std::vector<std::uint8_t>& state);
+void toParams (const State& s, float* params) noexcept;
+State fromParams (const float* params) noexcept;
+const char* paramName (int param) noexcept;
+std::string paramText (int param, float value01);
+
+// The engine (FL's VST engine_x64.dll behind the plugin), values 0…1 = (raw − min) / (max − min)
+class Engine
+{
+public:
+    // `instance`: the hiss generator's seeds advance per engine instance created in the process (§3.6)
+    explicit Engine (int instance = 0);
+    ~Engine();
+    void setRate (double sampleRate) noexcept; // re-applies every parameter, like the engine
+    void setParam (int index, float value) noexcept;
+    float param (int index) const noexcept;
+    // the state a long-running instance reaches: smoothed values at their targets, delay lines and filters cleared
+    void settle() noexcept;
+    // ppq: song position in beats (negative = stopped), used only with LFO sync
+    void render (const float* in, float* out, int n, double tempo = 120.0, double ppq = -1.0, bool playing = false) noexcept;
+
+private:
+    struct Impl;
+    std::unique_ptr<Impl> d;
+};
+
+const EffectInfo& info();
+std::unique_ptr<Effect> make (int instance = 0);
+} // namespace lynx::vintagechorusfx

+ 10 - 0
src/core/Effects.cpp

@@ -2277,6 +2277,8 @@ const EffectInfo& effectInfo (EffectKind kind)
         case EffectKind::reeverb2: return reeverb2Info;
         case EffectKind::reeverb1: return reeverb1Info;
         case EffectKind::fruityChorus: return fruitychorusfx::info();
+        case EffectKind::hyperChorus: return hyperchorusfx::info();
+        case EffectKind::vintageChorus: return vintagechorusfx::info();
     }
     return eq;
 }
@@ -2495,6 +2497,8 @@ std::string formatEffectParam (EffectKind kind, int param, float v, double bpm)
         case EffectKind::reeverb2: return reeverb2ParamText (param, v);
         case EffectKind::reeverb1: return reeverb1ParamText (param, v);
         case EffectKind::fruityChorus: return fruitychorusfx::paramText (param, v);
+        case EffectKind::hyperChorus: return hyperchorusfx::paramText (param, v);
+        case EffectKind::vintageChorus: return vintagechorusfx::paramText (param, v);
 
         case EffectKind::vintagePhaser:
             switch (param)
@@ -2595,6 +2599,10 @@ std::unique_ptr<Effect> makeEffect (const EffectSlot& slot)
         return maximusfx::make (slot.state);
     if (slot.kind == EffectKind::fruityWaveShaper)
         return flshape::makeWaveShaper (slot.state);
+    if (slot.kind == EffectKind::hyperChorus)
+        return hyperchorusfx::make (hyperchorusfx::instanceOf (slot.state));
+    if (slot.kind == EffectKind::vintageChorus)
+        return vintagechorusfx::make (hyperchorusfx::instanceOf (slot.state));
     return makeEffect (slot.kind);
 }
 
@@ -2634,6 +2642,8 @@ std::unique_ptr<Effect> makeEffect (EffectKind kind)
         case EffectKind::reeverb2: return makeReeverb2();
         case EffectKind::reeverb1: return makeReeverb1();
         case EffectKind::fruityChorus: return fruitychorusfx::make();
+        case EffectKind::hyperChorus: return hyperchorusfx::make();
+        case EffectKind::vintageChorus: return vintagechorusfx::make();
         case EffectKind::pitchCorrect: return std::make_unique<PitchCorrect>();
         case EffectKind::plugin: break; // created by the app (RackState::Factories)
     }

+ 2 - 0
src/core/FlEffects.cpp

@@ -1150,6 +1150,8 @@ std::vector<std::string> flPluginsForEffect (EffectKind kind)
         case EffectKind::fruityWaveShaper: return { "Fruity WaveShaper" };
         case EffectKind::fruitySoftClipper: return { "Fruity Soft Clipper" };
         case EffectKind::fruityChorus: return { "Fruity Chorus" };
+        case EffectKind::hyperChorus: return { "Hyper Chorus" };
+        case EffectKind::vintageChorus: return { "Vintage Chorus" };
         case EffectKind::limiter:
         case EffectKind::compressor: return { "Fruity Limiter", "Fruity Compressor" };
         case EffectKind::reverb:

+ 1 - 0
src/core/FlpImport.cpp

@@ -2113,6 +2113,7 @@ Song importFlp (const flp::Project& input, const FlpImportOptions& options)
     for (auto it = drumKits.rbegin(); it != drumKits.rend(); ++it)
         splitDrumChannel (song, it->first, it->second);
 
+    numberChorusInstances (song); // the random LFO phases FL gives each Hyper Chorus instance (REA_rodada59 §2.6)
     return song;
 }
 } // namespace lynx

+ 3 - 1
src/core/Song.h

@@ -301,7 +301,9 @@ enum class EffectKind : std::uint8_t
     fruitySoftClipper, // FL's Fruity Soft Clipper, exact (REA_rodada51, core/FruityShapers.h): threshold, post / range
     reeverb2,     // FL's Fruity Reeverb 2, exact (REA_rodada49, core/Reeverb2.h): FL's 15 controls + 2 options, (raw − min) / range
     reeverb1,     // FL's Fruity Reeverb (first version), exact (REA_rodada49 §6, core/Reeverb2.h): FL's 10 controls, raw / max
-    fruityChorus  // FL's Fruity Chorus, exact (REA_rodada59 §1, core/ChorusFx.h): controls / range
+    fruityChorus, // FL's Fruity Chorus, exact (REA_rodada59 §1, core/ChorusFx.h): controls / range
+    hyperChorus,  // FL's Hyper Chorus, exact (REA_rodada59 §2, core/ChorusFx.h): (raw − min) / range; instance in EffectSlot::state
+    vintageChorus // FL's Vintage Chorus, exact (REA_rodada59 §3, core/ChorusFx.h): (raw − min) / range; instance in EffectSlot::state
 };
 
 constexpr int maxEffectParams = 48; // the 7-band parametric EQ and the Pitcher use most of them

+ 3 - 1
src/engine/ProjectFile.cpp

@@ -152,6 +152,8 @@ const char* effectId (EffectKind k)
         case EffectKind::reeverb2: return "reeverb2";
         case EffectKind::reeverb1: return "reeverb1";
         case EffectKind::fruityChorus: return "fruityChorus";
+        case EffectKind::hyperChorus: return "hyperChorus";
+        case EffectKind::vintageChorus: return "vintageChorus";
     }
     return "eq";
 }
@@ -293,7 +295,7 @@ std::optional<EffectSlot> effectFromVar (const juce::var& e)
 std::optional<EffectKind> effectFromId (const juce::String& id)
 {
     for (auto k : { EffectKind::eq, EffectKind::compressor, EffectKind::delay, EffectKind::reverb, EffectKind::plugin,
-                    EffectKind::limiter, EffectKind::filter, EffectKind::distortion, EffectKind::chorus, EffectKind::parametricEq, EffectKind::utility, EffectKind::volumeGate, EffectKind::peakController, EffectKind::pitchShift, EffectKind::freqShift, EffectKind::parallel, EffectKind::lofi, EffectKind::effector, EffectKind::crossover, EffectKind::rhythmGain, EffectKind::autoPan, EffectKind::vocoder, EffectKind::pitchCorrect, EffectKind::squeeze, EffectKind::vintagePhaser, EffectKind::vocodex, EffectKind::maximus, EffectKind::fruityLimiter, EffectKind::fruityCompressor, EffectKind::fruityWaveShaper, EffectKind::fruitySoftClipper, EffectKind::reeverb2, EffectKind::reeverb1, EffectKind::fruityChorus })
+                    EffectKind::limiter, EffectKind::filter, EffectKind::distortion, EffectKind::chorus, EffectKind::parametricEq, EffectKind::utility, EffectKind::volumeGate, EffectKind::peakController, EffectKind::pitchShift, EffectKind::freqShift, EffectKind::parallel, EffectKind::lofi, EffectKind::effector, EffectKind::crossover, EffectKind::rhythmGain, EffectKind::autoPan, EffectKind::vocoder, EffectKind::pitchCorrect, EffectKind::squeeze, EffectKind::vintagePhaser, EffectKind::vocodex, EffectKind::maximus, EffectKind::fruityLimiter, EffectKind::fruityCompressor, EffectKind::fruityWaveShaper, EffectKind::fruitySoftClipper, EffectKind::reeverb2, EffectKind::reeverb1, EffectKind::fruityChorus, EffectKind::hyperChorus, EffectKind::vintageChorus })
         if (id == effectId (k))
             return k;
 

+ 1 - 1
src/ui/MixerComponent.cpp

@@ -1003,7 +1003,7 @@ const EffectKind allEffects[] = { EffectKind::eq,     EffectKind::parametricEq,
                                       EffectKind::pitchShift, EffectKind::freqShift, EffectKind::lofi, EffectKind::effector, EffectKind::crossover, EffectKind::autoPan, EffectKind::vocoder, EffectKind::pitchCorrect,
                                       EffectKind::fruityLimiter, EffectKind::fruityCompressor,
                                       EffectKind::fruityWaveShaper, EffectKind::fruitySoftClipper,
-                                      EffectKind::reeverb2, EffectKind::reeverb1, EffectKind::fruityChorus };
+                                      EffectKind::reeverb2, EffectKind::reeverb1, EffectKind::fruityChorus, EffectKind::hyperChorus, EffectKind::vintageChorus };
 } // namespace
 
 const std::vector<EffectKind>& addableEffects()

+ 101 - 2
tests/tests.cpp

@@ -1054,7 +1054,7 @@ TEST (flp_real_files)
                         if (fx.kind == lynx::EffectKind::fruityWaveShaper)
                             shaperExact += lynx::flshape::parseWaveShaper (fx.state).has_value() ? 1 : 0;
                         clipperExact += fx.kind == lynx::EffectKind::fruitySoftClipper;
-                        chorusExact += fx.kind == lynx::EffectKind::fruityChorus ? 1 : 0;
+                        chorusExact += fx.kind == lynx::EffectKind::fruityChorus || fx.kind == lynx::EffectKind::hyperChorus || fx.kind == lynx::EffectKind::vintageChorus ? 1 : 0;
                     }
                 for (const auto& pat : full.patterns)
                     for (const auto& n : pat.notes)
@@ -1715,7 +1715,7 @@ TEST (flp_real_files)
     // (Patcher graphs add WaveShaper nodes of their own to the imported mixer)
     CHECK (shaperExact >= shaperSlots && shaperSlots >= 70 && clipperExact >= clipperSlots && clipperSlots >= 25); // REA_rodada51
     std::printf ("  Chorus family: %d of %d slots on the exact engines\n", chorusExact, chorusSlots);
-    CHECK (chorusExact >= chorusSlots && chorusSlots >= 16); // REA_rodada59
+    CHECK (chorusExact >= chorusSlots && chorusSlots >= 47); // REA_rodada59
 
     // 3x Osc channel presets shipped with FL (.fst): all become synth settings
     int presets = 0, presetsDecoded = 0;
@@ -9357,4 +9357,103 @@ TEST (chorus_family_engines)
            || lynx::effectFromFl ("Fruity Chorus", ints ({ 2, 512, 2250, 341, 1500, 2500, 3500, 23, 0, 0, 0, 2500, 0 }), 120.0)->kind != lynx::EffectKind::fruityChorus);
     CHECK (! lynx::effectFromFl ("Fruity Chorus", { 1, 0, 0, 0 }, 120.0).has_value()
            || lynx::effectFromFl ("Fruity Chorus", { 1, 0, 0, 0 }, 120.0)->kind != lynx::EffectKind::fruityChorus);
+
+    // Hyper Chorus engine in FL's load sequence (defaults, then the state: the parameters glide), instance k's phases
+    auto hyper = [&] (std::initializer_list<int> raws, int instance, std::initializer_list<Gold> gold) {
+        namespace hc = lynx::hyperchorusfx;
+        hc::Engine e (instance);
+        const std::vector<int> r (raws);
+        auto val = [] (int i, int raw) { return (float) std::clamp ((double) (raw - hc::rawMin[(std::size_t) i]) * (1.0 / (double) (hc::rawMax[(std::size_t) i] - hc::rawMin[(std::size_t) i])), 0.0, 1.0); };
+        for (int i = 0; i < hc::params; ++i)
+            e.setParam (i, val (i, hc::defaults[(std::size_t) i]));
+        for (int i = 0; i < hc::params; ++i)
+            e.setParam (i, val (i, r[(std::size_t) i]));
+        e.setRate (44100.0);
+        std::vector<float> io (8192);
+        for (int n = 0; n < 4096; ++n)
+            io[2 * (std::size_t) n] = inL[(std::size_t) n], io[2 * (std::size_t) n + 1] = inR[(std::size_t) n];
+        for (int s = 0; s < 4096; s += 512)
+            e.render (io.data() + 2 * s, io.data() + 2 * s, 512);
+        for (const auto& g : gold)
+            CHECK (close (io[2 * (std::size_t) g.i], g.l) && close (io[2 * (std::size_t) g.i + 1], g.r));
+    };
+    hyper ({ 562, 919, 499, 505, 709, 716, 1, 19247, 10900, 191, 1000 }, 0,
+           { { 100, 0.0f, -0.4115639328956604f }, { 1000, -0.658551037311554f, 0.28647756576538086f }, { 2047, 0.24743860960006714f, -0.5088979005813599f },
+             { 3000, -0.5171564221382141f, -0.3630276620388031f }, { 4095, 0.08128821104764938f, 0.18811003863811493f } });
+    hyper ({ 1000, 555, 0, 400, 300, 300, 0, 22000, 120, 368, 750 }, 2,
+           { { 100, 0.0f, -0.398922324180603f }, { 1000, -1.1528236865997314f, 0.2839684784412384f }, { 2047, 0.5115746855735779f, -0.3330395221710205f },
+             { 3000, -0.6094785928726196f, 0.17040175199508667f }, { 4095, -0.11666109412908554f, 0.21931695938110352f } });
+    CHECK (lynx::hyperchorusfx::randState (1) == 1u * 214013u + 2531011u);
+    {
+        // the import: controls as parameters; a song's Hyper Chorus slots are numbered in mixer order
+        const auto st = ints ({ 2, 1000, 555, 0, 400, 300, 300, 0, 22000, 120, 368, 750, 0 });
+        const auto slot = lynx::effectFromFl ("Hyper Chorus", st, 120.0);
+        CHECK (slot && slot->kind == lynx::EffectKind::hyperChorus && lynx::hyperchorusfx::fromParams (slot->params.data())[9] == 368);
+        lynx::Song song;
+        song.mixer.resize (3);
+        song.mixer[1].effects = { *slot, *slot };
+        song.mixer[2].effects = { *slot };
+        lynx::numberChorusInstances (song);
+        CHECK (lynx::hyperchorusfx::instanceOf (song.mixer[2].effects[0].state) == 2);
+        auto fx = lynx::makeEffect (song.mixer[2].effects[0]);
+        fx->prepare (48000.0);
+        std::vector<float> l (inL), r (inR);
+        fx->process (l.data(), r.data(), 4096, slot->params, 120.0);
+        bool finite = true, wet = false;
+        for (int n = 0; n < 4096; ++n)
+        {
+            finite = finite && std::isfinite (l[(std::size_t) n]) && std::isfinite (r[(std::size_t) n]);
+            wet = wet || l[(std::size_t) n] != inL[(std::size_t) n];
+        }
+        CHECK (finite && wet);
+        CHECK (lynx::formatEffectParam (lynx::EffectKind::hyperChorus, 8, 0.0f, 120.0) == "off");
+        CHECK (! lynx::effectFromFl ("Hyper Chorus", ints ({ 3, 1000, 555, 0, 400, 300, 300, 0, 22000, 120, 368, 750, 0 }), 120.0).has_value()
+               || lynx::effectFromFl ("Hyper Chorus", ints ({ 3, 1000, 555, 0, 400, 300, 300, 0, 22000, 120, 368, 750, 0 }), 120.0)->kind != lynx::EffectKind::hyperChorus);
+    }
+
+    // Vintage Chorus engine as FL drives it (created, sample rate, each control), fresh instance (its smoothed values
+    // start from the engine's initial ones)
+    auto vintage = [&] (std::initializer_list<int> raws, std::initializer_list<Gold> gold) {
+        namespace vc = lynx::vintagechorusfx;
+        vc::Engine e;
+        e.setRate (44100.0);
+        int i = 0;
+        for (int raw : raws)
+        {
+            e.setParam (i, (float) std::clamp ((double) (raw - vc::rawMin[(std::size_t) i]) * (1.0 / (double) (vc::rawMax[(std::size_t) i] - vc::rawMin[(std::size_t) i])), 0.0, 1.0));
+            ++i;
+        }
+        std::vector<float> io (8192);
+        for (int n = 0; n < 4096; ++n)
+            io[2 * (std::size_t) n] = inL[(std::size_t) n], io[2 * (std::size_t) n + 1] = inR[(std::size_t) n];
+        for (int s = 0; s < 4096; s += 512)
+            e.render (io.data() + 2 * s, io.data() + 2 * s, 512);
+        for (const auto& g : gold)
+            CHECK (close (io[2 * (std::size_t) g.i], g.l) && close (io[2 * (std::size_t) g.i + 1], g.r));
+    };
+    vintage ({ 2, 0, 211046, 1, 2411, 960, 1985, 5121, 0, 1, 4420, 6000, 273, 0, 0, 0, 0 },
+             { { 100, 0.0f, -0.05606573447585106f }, { 1000, -0.3413679003715515f, 0.20469821989536285f }, { 2047, 0.1487489938735962f, -0.28199973702430725f },
+               { 3000, -0.31699514389038086f, -0.43230289220809937f }, { 4095, 0.1255197525024414f, 0.0810704305768013f } });
+    vintage ({ 2, 0, 80, 0, 0, 60, 3000, 3000, 0, 0, 0, 3000, 0, 3000, 0, 0, 0 }, // hiss
+             { { 100, -1.2527654007499223e-06f, -0.053655341267585754f }, { 1000, -0.44306400418281555f, 0.25606146454811096f }, { 2047, 0.23425261676311493f, -0.21375307440757751f },
+               { 3000, -0.5793180465698242f, -0.13371579349040985f }, { 4095, 0.05595953390002251f, 0.11362095922231674f } });
+    vintage ({ 0, 1, 49152, 0, 3000, 60, 3000, 3000, 0, 0, 0, 3000, 0, 0, 0, 0, 0 }, // Chorus 1 + 2
+             { { 100, 0.0f, -0.05365874245762825f }, { 1000, -0.5095958113670349f, 0.2809423506259918f }, { 2047, 0.17256303131580353f, -0.3563305139541626f },
+               { 3000, -0.471851646900177f, -0.30123069882392883f }, { 4095, 0.0959278866648674f, 0.13436323404312134f } });
+    {
+        const auto st = ints ({ 1, 2, 0, 211046, 1, 2411, 960, 1985, 5121, 0, 1, 4420, 6000, 273, 0, 0, 0, 0 });
+        const auto slot = lynx::effectFromFl ("Vintage Chorus", st, 120.0);
+        CHECK (slot && slot->kind == lynx::EffectKind::vintageChorus && lynx::vintagechorusfx::fromParams (slot->params.data())[2] == 211046);
+        auto fx = lynx::makeEffect (*slot);
+        fx->prepare (44100.0);
+        std::vector<float> l (inL), r (inR);
+        fx->process (l.data(), r.data(), 4096, slot->params, 120.0);
+        bool finite = true;
+        for (int n = 0; n < 4096; ++n)
+            finite = finite && std::isfinite (l[(std::size_t) n]) && std::isfinite (r[(std::size_t) n]);
+        CHECK (finite && l[3000] != inL[3000]);
+        CHECK (lynx::formatEffectParam (lynx::EffectKind::vintageChorus, 0, 0.0f, 120.0) == "Chorus 1");
+        CHECK (! lynx::effectFromFl ("Vintage Chorus", ints ({ 2, 2, 0, 211046, 1, 2411, 960, 1985, 5121, 0, 1, 4420, 6000, 273, 0, 0, 0, 0 }), 120.0).has_value()
+               || lynx::effectFromFl ("Vintage Chorus", ints ({ 2, 2, 0, 211046, 1, 2411, 960, 1985, 5121, 0, 1, 4420, 6000, 273, 0, 0, 0, 0 }), 120.0)->kind != lynx::EffectKind::vintageChorus);
+    }
 }