Ver código fonte

Prism Multiband: each crossover its own slope (Pro-MB's per-band slopes) in every processing mode — the measured Dynamic phase with different orders per side (Aberth roots), translated, Low / High slope in the band's expert part; doc (round 147)

Ka1-S 1 mês atrás
pai
commit
76fc483836

+ 2 - 2
docs/PARITY.md

@@ -275,7 +275,7 @@ lookahead on, expert mode, display range, analyser options.
 | LOOKAHEAD per band | ✅ | round 128: LOOKAHEAD in the band panel (0–20 ms, capped by the global look-ahead, which sets the latency); translated from Pro-MB |
 | EXPERT (»): side-chain filtering, external side chain, stereo link per band | ✅ | round 135: external side chain (Int / Ext: the detectors hear the side chain split by the same crossovers); round 147: **Expert >>** in the band panel — side-chain filtering Band / Free with Low / High (30 Hz – 30 kHz; the free filter measured: 4th-order sides, −24 dB an octave out; one octave and wider within 1 dB, narrower bands boost less than the reference), **stereo link** 0–100 % and 100 % + mid- / side-only with its Mid / Side mode (measured laws, within 0.25 dB of the trial); translated from Pro-MB states (only when its Expert mode is on, as the reference does); the side-chain input stays one switch for all bands |
 | Band output pan (mid / side) | ✅ | round 135: PAN in the band panel (left / right balance of the band); round 144: L/R \| M/S switch in the band panel (mid / side = the reference's law, measured: the far side's gain 1 − \|pan\|), translated from Pro-MB states |
-| Crossover slope per band 6–48 dB/oct | ⚠️ | one global slope 12 / 24 / 48 (round 144: in the band panel, where the reference has it) |
+| Crossover slope per band 6–48 dB/oct | ✅ | round 144: the global slope in the band panel; round 147: **each crossover its own slope** (Global / 12 / 24 / 48: a band's Low / High slope in its expert part), in every processing mode (the measured Dynamic phase with different orders on the two sides of a band: exact to 1e-8 dB); translated from Pro-MB's band slopes; no 6 dB/oct and no continuous values (LYNX's crossovers are Linkwitz-Riley 12 / 24 / 48) |
 | Processing mode Linear / Dynamic / Minimum phase | ✅ | round 144: Phase menu in the bottom bar; linear = FIR crossovers with the same magnitudes, 3072 samples at 48 kHz (measured); minimum = all-pass compensated sum; translated. Round 147: **Dynamic phase measured and rebuilt** — each working band is a minimum-phase filter with the linear-phase magnitude, the bands in cascade (Pro-MB's −4.1 dB / +53° at the crossover, −8.15 dB for two adjacent −12 dB bands: matched within 0.05 dB / 1°); projects saved before round 147 keep the classic engine ("Classic dynamic" in the bottom bar updates them) |
 | Oversampling | ✅ | round 144: Off / 2x / 4x in the bottom bar: the gains applied at the high rate; latency + the oversampler's; translated |
 | Display range 3 / 6 / 12 / 30 dB | ✅ | round 128: 3 dB added |
@@ -286,7 +286,7 @@ lookahead on, expert mode, display range, analyser options.
 
 **After round 144** (REA_rodada144b): configuration 7 → **9**/10, design 7 → **8**/10 — processing modes, oversampling, mid / side band pan, analyser resolution / tilt, the reference's bottom-bar order. Left: per-band slopes, side-chain filtering, per-band stereo link, the dynamic mode's crossover shape, free band placement.
 
-**After round 147** (REA_rodada147 §1–2): configuration **9**/10 (the expert controls are in, per-band slopes are still missing), design 8 → **9**/10 — the measured Dynamic phase (the reference's sound when bands work), the expert panel (side-chain filtering, stereo link per band). Left: per-band slopes (6–48 dB/oct per side; LYNX: one 12 / 24 / 48 for all), free band placement with gaps, a side-chain input per band, the free side-chain filter's extra boost on bands narrower than an octave.
+**After round 147** (REA_rodada147 §1–2): configuration 9 → **10**/10, design 8 → **9**/10 — the measured Dynamic phase (the reference's sound when bands work), the expert panel (side-chain filtering, stereo link, the band's own slopes). Left: free band placement with gaps (a band switched off is the gap), a side-chain input per band, slopes only 12 / 24 / 48 (no 6 or in-between values), the free side-chain filter's extra boost on bands narrower than an octave.
 
 ## Sentry Gate ← Pro-G
 

+ 26 - 2
docs/analise/REA_rodada147.md

@@ -88,6 +88,17 @@ panel opens its right part (Side chain: Band | Free, Low, High; Stereo link: Lin
 translated when their Expert mode is on (an external side-chain input on any band turns LYNX's side-chain switch to
 external). Tests: tests/Parity147Tests.inc.
 
+### Per-crossover slopes
+
+Pro-MB gives every band its own low / high slope. LYNX's bands share their crossovers, so each crossover got its
+own slope (appended `Crossover 1 … 5 slope`: Global = the old Slope, 12, 24, 48 dB/oct), shown as the band's **Low
+slope / High slope** in the expert part of the band panel; Pro-MB states set each crossover from the band below's
+high slope (or the band above's low slope next to a gap). All processing modes follow it (the split, the
+all-pass copies, the FIR kernels, the editor's curve). The measured Dynamic phase with different orders on a band's
+two sides has no quadratic shortcut: its zeros come from P (z) = 1 + g·z^nl + ρ·z^nh + ρ·z^(nl+nh), z = (Ω / Ω_l)²,
+degree ≤ 8, by Aberth's iteration started on the two circles the edge factors give (checked on 1 500 cases: the
+designed magnitude equals 1 + (g − 1)·A within 1e-8 dB, all stable).
+
 ## 3. Hush De-esser: DeEsser's Energy Detector meter
 
 DeEsser (Waves, demo here: its window as a user sees it, round 129) shows the side-chain energy beside its threshold
@@ -98,8 +109,21 @@ the threshold dial's units, so reduction starts where the bar crosses the arrow)
 (second meter slot, unused by Hush before). Test: a 9 kHz tone at −6 / −26 dB reads −6.8 / −26.8 dB, a 200 Hz tone
 −54 dB.
 
+## 4. Measured, not implemented
+
+- [EXEC] PanMan 5.5.5 (Tweak page through its host parameters RateMod ±3, OffsetMod ±180°, WidthMod ±180°): with
+  a 1 kHz tone switching between −40 and −6 dB every 2 s (Rate 1 Hz, Width 180°), the loud halves are modulated and
+  the quiet ones are not: WidthMod −180 → width 0 (no motion), +180 → still full; OffsetMod +90 → the pan centre
+  moves to +0.65 (from centre to right); RateMod +3 → about 8 Hz (3 octaves up), −3 → about 1/8 Hz. So the Tweak
+  modulation follows an input envelope whose threshold / sensitivity live in PanMan's editor, not in host
+  parameters; a level sweep (−60 … 0 dB at Rate 0.01 Hz) did not give a clean law (`D:\lynx-work\parity147\pm\`).
+  ManualTrigger could not be observed through `process` (each run starts from the plug-in's reset). Auto-pan's
+  Tweak row stays ❌.
+- [EXEC] CLA-2A Stereo (Waves, demo) loads in the host from round 127's shell cache, but its VST3 parameter list
+  holds only the shell's generic controls (bypass, meter display, MIDI CC): ANALOG 50 / 60 Hz cannot be set black-box
+  without its window, so Glow's ANALOG row stays ❌.
+
 ## Where I stopped
 
-- Prism: per-band slopes (Pro-MB: 6 – 48 dB/oct per side, continuous; LYNX: one 12 / 24 / 48 for every crossover —
-  the closed-form dynamic filters assume one order per band), free band placement with gaps, one side-chain input
+- Prism: slopes only 12 / 24 / 48 (Pro-MB: 6 – 48 continuous), free band placement with gaps, one side-chain input
   per band, the free side-chain filter's extra boost below one octave, the detector's release shape (§1).

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

@@ -4031,3 +4031,10 @@ countries: br
 "A gradual start of the compression around the threshold" = "Início gradual da compressão em torno do limiar"
 "Soft clipping after the make-up gain: warmer, louder; stronger with more make-up" = "Saturação suave depois do ganho de compensação: mais quente e mais alto; mais forte com mais compensação"
 "Expander" = "Expansor"
+"Low slope" = "Inclinação grave"
+"High slope" = "Inclinação aguda"
+"Slope 1" = "Inclinação 1"
+"Slope 2" = "Inclinação 2"
+"Slope 3" = "Inclinação 3"
+"Slope 4" = "Inclinação 4"
+"Slope 5" = "Inclinação 5"

+ 31 - 13
src/core/DynamicsSuite.cpp

@@ -922,6 +922,13 @@ bool measuredDynamic (const EffectParams& p) noexcept { return on (p[dynamicEngi
 double linkAmount (float v) noexcept { return std::clamp (2.0 * (double) v, 0.0, 1.0); }
 double linkOnly (float v) noexcept { return std::clamp (2.0 * (double) v - 1.0, 0.0, 1.0); }
 double scFilterHz (float v) noexcept { return 30.0 * std::pow (1000.0, (double) std::clamp (v, 0.0f, 1.0f)); }
+int crossoverSlopeDbOct (const EffectParams& p, int k) noexcept
+{
+    static constexpr int own[4] { 0, 12, 24, 48 };
+    const auto s = own[pick (p[(std::size_t) (xoverSlope0 + std::clamp (k, 0, bands - 2))], 4)];
+    return s > 0 ? s : slopeDbOct (p[Global::slope]);
+}
+float crossoverSlopeValue (int dbOct) noexcept { return dbOct <= 0 ? 0.0f : (dbOct <= 12 ? 1.0f / 3.0f : (dbOct <= 24 ? 2.0f / 3.0f : 1.0f)); }
 float scFilterValue (double hz) noexcept { return (float) std::clamp (std::log (std::max (hz, 1.0) / 30.0) / std::log (1000.0), 0.0, 1.0); }
 int oversamplingOf (float v) noexcept { return 1 << pick (v, 3); }
 int linearFftSize (double sampleRate) noexcept
@@ -988,7 +995,6 @@ double bandStaticDb (const EffectParams& p, int b, double inputDb)
 double responseDb (const EffectParams& p, const double* bandGainDb, double sampleRate, double hz)
 {
     const auto f = crossovers (p);
-    const auto slope = slopeDbOct (p[Global::slope]);
     const auto nb = bandCount (p);
     const auto w = 2.0 * pi * hz / sampleRate;
     // bands of the tree: B0 = L1, B1 = H1·L2, B2 = H1·H2·L3, …, the last = H1·…·H(n−1); out = x + Σ (g − 1)·Bk
@@ -997,7 +1003,7 @@ double responseDb (const EffectParams& p, const double* bandGainDb, double sampl
     for (int k = 0; k < nb - 1; ++k)
     {
         Split s;
-        s.design (sampleRate, f[(std::size_t) k], slope);
+        s.design (sampleRate, f[(std::size_t) k], crossoverSlopeDbOct (p, k));
         band[(std::size_t) k] = rest * s.response (false, w);
         rest *= s.response (true, w);
     }
@@ -1013,7 +1019,7 @@ double responseDb (const EffectParams& p, const double* bandGainDb, double sampl
             for (int j = k + 1; j < nb - 1; ++j)
             {
                 Split s;
-                s.design (sampleRate, f[(std::size_t) j], slope);
+                s.design (sampleRate, f[(std::size_t) j], crossoverSlopeDbOct (p, j));
                 band[(std::size_t) k] *= s.response (false, w) + s.response (true, w);
             }
     bool solo = false;
@@ -1022,14 +1028,14 @@ double responseDb (const EffectParams& p, const double* bandGainDb, double sampl
     if (mode == Phase::dynamic && measuredDynamic (p) && ! solo)
     {
         // round 147: the measured engine — the product of each band's 1 + (g − 1)·A (its own crossovers' magnitudes)
-        const auto n = slope <= 12 ? 1 : (slope <= 24 ? 2 : 4);
         const auto om = minphase::warp (hz, sampleRate);
         double m = 1.0;
         for (int b = 0; b < nb; ++b)
         {
             const auto wl = b > 0 ? minphase::warp (f[(std::size_t) (b - 1)], sampleRate) : 0.0;
             const auto wh = b < nb - 1 ? minphase::warp (f[(std::size_t) b], sampleRate) : 0.0;
-            m *= minphase::bandMagnitude (wl, wh, n, dbToGain (bandGainDb[b]), om);
+            const auto nl = b > 0 ? slopeOrder (crossoverSlopeDbOct (p, b - 1)) : 1, nh = b < nb - 1 ? slopeOrder (crossoverSlopeDbOct (p, b)) : 1;
+            m *= minphase::bandMagnitude (wl, wh, nl, nh, dbToGain (bandGainDb[b]), om);
         }
         return gainToDb (std::abs (m)) + trimDb (p[output]);
     }
@@ -1218,7 +1224,9 @@ private:
     void processChunk (float* l, float* r, const float* scl, const float* scr, int n, const EffectParams& p) noexcept
     {
         const auto f = crossovers (p);
-        const auto slope = slopeDbOct (p[Global::slope]);
+        std::array<int, bands - 1> slope {};
+        for (int k = 0; k < bands - 1; ++k)
+            slope[(std::size_t) k] = crossoverSlopeDbOct (p, k);
         const auto nb = bandCount (p);
         const auto md = (Phase) mode;
         const bool linear = md == Phase::linear, minimum = md == Phase::minimum;
@@ -1226,10 +1234,10 @@ private:
         {
             for (int k = 0; k < bands - 1; ++k)
             {
-                split[(std::size_t) k].design (sr, f[(std::size_t) k], slope);
-                scSplit[(std::size_t) k].design (sr, f[(std::size_t) k], slope);
+                split[(std::size_t) k].design (sr, f[(std::size_t) k], slope[(std::size_t) k]);
+                scSplit[(std::size_t) k].design (sr, f[(std::size_t) k], slope[(std::size_t) k]);
                 for (int j = 0; j < bands - 1; ++j)
-                    comp[(std::size_t) j][(std::size_t) k].design (sr, f[(std::size_t) k], slope);
+                    comp[(std::size_t) j][(std::size_t) k].design (sr, f[(std::size_t) k], slope[(std::size_t) k]);
             }
             lastF = f;
             lastSlope = slope;
@@ -1454,7 +1462,6 @@ private:
             }
             for (int b = nb; b < bands; ++b)
                 dynWorks[(std::size_t) b] = false;
-            const auto order = slope <= 12 ? 1 : (slope <= 24 ? 2 : 4);
             const auto run = [&] (int len, double rate, int every, const float* d0, const float* d1, auto&& gainAt, float* o0, float* o1) noexcept {
                 std::array<double, bands> wl {}, wh {};
                 for (int b = 0; b < nb; ++b)
@@ -1475,7 +1482,9 @@ private:
                                 if (std::abs (gc[c] - dynGain[(std::size_t) b][(std::size_t) c]) > 1e-7)
                                 {
                                     dynGain[(std::size_t) b][(std::size_t) c] = gc[c];
-                                    dynBand[(std::size_t) b][(std::size_t) c].design (wl[(std::size_t) b], wh[(std::size_t) b], order, std::max (gc[c], 1e-6));
+                                    dynBand[(std::size_t) b][(std::size_t) c].design (wl[(std::size_t) b], wh[(std::size_t) b],
+                                                                                      b > 0 ? slopeOrder (slope[(std::size_t) (b - 1)]) : 1,
+                                                                                      b < nb - 1 ? slopeOrder (slope[(std::size_t) b]) : 1, std::max (gc[c], 1e-6));
                                 }
                         }
                     const double xl = d0[i], xr = d1[i];
@@ -1720,7 +1729,7 @@ private:
     std::array<double, bands - 1> lastF {};
     const float* scL = nullptr;
     const float* scR = nullptr;
-    int lastSlope = 0;
+    std::array<int, bands - 1> lastSlope {};
     bool designed = false, kernelsDirty = true;
     int mode = -1, osFactor = 0, linSize = 0, lastNb = 0;
     std::array<peqfl::FftConvolver, bands - 1> lin;
@@ -1752,7 +1761,8 @@ private:
     std::array<std::array<double, 2>, bands> dynGain {};
     std::array<bool, bands> dynWorks {};
     std::array<double, bands - 1> dynF {};
-    int dynSlope = 0, dynNb = 0, dynOs = 0;
+    std::array<int, bands - 1> dynSlope {};
+    int dynNb = 0, dynOs = 0;
     std::array<bool, bands> dynMs {};
     LiveMeters meters;
 };
@@ -2165,6 +2175,9 @@ const EffectInfo& prismInfo()
             i.params.push_back ({ n, 0.0f });
         for (const auto* n : { "B1 SC high", "B2 SC high", "B3 SC high", "B4 SC high", "B5 SC high", "B6 SC high" })
             i.params.push_back ({ n, 1.0f });
+        // round 147: each crossover's own slope (0 = the global Slope, the old sound)
+        for (const auto* n : { "Crossover 1 slope", "Crossover 2 slope", "Crossover 3 slope", "Crossover 4 slope", "Crossover 5 slope" })
+            i.params.push_back ({ n, 0.0f });
         return i;
     }();
     return info;
@@ -2317,6 +2330,11 @@ std::string paramText (EffectKind kind, int param, float v)
             case bandScLow0: case bandScLow0 + 1: case bandScLow0 + 2: case bandScLow0 + 3: case bandScLow0 + 4: case bandScLow0 + 5:
             case bandScHigh0: case bandScHigh0 + 1: case bandScHigh0 + 2: case bandScHigh0 + 3: case bandScHigh0 + 4: case bandScHigh0 + 5:
                 return hzText (scFilterHz (v));
+            case xoverSlope0: case xoverSlope0 + 1: case xoverSlope0 + 2: case xoverSlope0 + 3: case xoverSlope0 + 4:
+            {
+                static const char* const names[4] { "global", "12 dB/oct", "24 dB/oct", "48 dB/oct" };
+                return names[pick (v, 4)];
+            }
             case slope: return std::to_string (slopeDbOct (v)) + " dB/oct";
             case lookahead: return v <= 0.0f ? "off" : msText (lookaheadMs (v));
             case mix: return fmt ("%.0f%%", v * 100.0);

+ 6 - 1
src/core/DynamicsSuite.h

@@ -149,7 +149,9 @@ enum Global { xover1 = legacyBands * fieldsPerBand, xover2, xover3, slope, looka
               // high frequency (30 Hz … 30 kHz)
               bandLink0, bandLinkMode0 = bandLink0 + bands, bandScFree0 = bandLinkMode0 + bands,
               bandScLow0 = bandScFree0 + bands, bandScHigh0 = bandScLow0 + bands,
-              count = bandScHigh0 + bands };
+              // round 147: each crossover's own slope (Pro-MB's per-band slopes): 0 = the global Slope, then 12 / 24 / 48
+              xoverSlope0 = bandScHigh0 + bands,
+              count = xoverSlope0 + bands - 1 };
 inline int param (int band, int field) noexcept
 {
     return band < legacyBands ? band * fieldsPerBand + field : band5 + (band - legacyBands) * fieldsPerBand + field;
@@ -189,6 +191,9 @@ double linkAmount (float v) noexcept;
 double linkOnly (float v) noexcept;
 double scFilterHz (float v) noexcept;   // 30 Hz … 30 kHz (30 · 1000^v, the reference's law)
 float scFilterValue (double hz) noexcept;
+int crossoverSlopeDbOct (const EffectParams& p, int k) noexcept; // round 147: crossover k's slope (its own or the global)
+float crossoverSlopeValue (int dbOct) noexcept;                  // 12 / 24 / 48 → its own value (0 = global)
+inline int slopeOrder (int dbOct) noexcept { return dbOct <= 12 ? 1 : (dbOct <= 24 ? 2 : 4); } // n of LR(2n)
 int oversamplingOf (float v) noexcept;   // 1 (off), 2 or 4
 int linearFftSize (double sampleRate) noexcept; // 4096 up to 50 kHz, ×2 per doubling of the rate
 int linearLatency (double sampleRate) noexcept; // 3/4 of the FFT size (3072 samples at 48 kHz, as measured)

+ 11 - 0
src/core/FabFilterStates.cpp

@@ -364,6 +364,17 @@ int fromProMB (const State& s, EffectSlot& slot)
             set (Global::slope, dbOct < 18.0 ? 0.0f : (dbOct < 36.0 ? 0.5f : 1.0f));
         }
     }
+    // round 147: each crossover's own slope — the band below's high slope, or the band above's low slope (gaps)
+    for (int k = 0; k + 1 < std::min (nb, nseg); ++k)
+    {
+        const auto& lo = segs[(std::size_t) k];
+        const auto& hi = segs[(std::size_t) (k + 1)];
+        const auto norm = lo.ref >= 0 ? s.at ((std::size_t) (22 * lo.ref + 4)) : (hi.ref >= 0 ? s.at ((std::size_t) (22 * hi.ref + 2)) : -1.0f);
+        if (norm < 0.0f)
+            continue;
+        const auto dbOct = 6.0 + 42.0 * std::clamp ((double) norm, 0.0, 1.0);
+        set (xoverSlope0 + k, crossoverSlopeValue (dbOct < 18.0 ? 12 : (dbOct < 36.0 ? 24 : 48)));
+    }
     set (Global::lookahead, s.at (141) >= 0.5f ? linValue (la, 0.0, 20.0) : 0.0f);
     set (Global::mix, clamp01 (s.at (133)));
     set (Global::input, linValue (levelDb (s.at (134)), -36.0, 36.0));

+ 79 - 15
src/core/MinPhaseBand.h

@@ -33,25 +33,27 @@ inline double warp (double hz, double sampleRate) noexcept
     return std::tan (pi * std::min (hz, sampleRate * 0.45) / sampleRate);
 }
 
-// the band's crossover magnitude A at Ω (wl ≤ 0: no lower crossover, wh ≤ 0: no upper one), order 2n
-inline double bandShare (double wl, double wh, int n, double w) noexcept
+// the band's crossover magnitude A at Ω (wl ≤ 0: no lower crossover, wh ≤ 0: no upper one), orders 2·nl / 2·nh
+inline double bandShare (double wl, double wh, int nl, int nh, double w) noexcept
 {
     double a = 1.0;
     if (wh > 0.0)
-        a /= 1.0 + std::pow (w / wh, 2.0 * n);
+        a /= 1.0 + std::pow (w / wh, 2.0 * nh);
     if (wl > 0.0)
     {
-        const auto x = std::pow (w / wl, 2.0 * n);
+        const auto x = std::pow (w / wl, 2.0 * nl);
         a *= x / (1.0 + x);
     }
     return a;
 }
+inline double bandShare (double wl, double wh, int n, double w) noexcept { return bandShare (wl, wh, n, n, w); }
 
 // the magnitude of one band's filter at Ω: 1 + (g − 1)·A
-inline double bandMagnitude (double wl, double wh, int n, double g, double w) noexcept
+inline double bandMagnitude (double wl, double wh, int nl, int nh, double g, double w) noexcept
 {
-    return 1.0 + (g - 1.0) * bandShare (wl, wh, n, w);
+    return 1.0 + (g - 1.0) * bandShare (wl, wh, nl, nh, w);
 }
+inline double bandMagnitude (double wl, double wh, int n, double g, double w) noexcept { return bandMagnitude (wl, wh, n, n, g, w); }
 
 class Band
 {
@@ -59,8 +61,12 @@ public:
     static constexpr int maxSections = 8; // S: ≤ 2n = 8 roots → ≤ 4 sections, run twice
 
     // design for gain g (linear) between Ω_l and Ω_h (≤ 0 = absent), crossovers of order 2n (n = 1, 2, 4)
-    void design (double wl, double wh, int n, double g) noexcept
+    void design (double wl, double wh, int n, double g) noexcept { design (wl, wh, n, n, g); }
+
+    // round 147: the band's two crossovers may have different orders 2·nl (lower) and 2·nh (upper)
+    void design (double wl, double wh, int nl, int nh, double g) noexcept
     {
+        const int n = wl <= 0.0 ? nh : nl; // the edge bands have one crossover
         gain = 1.0;
         count = 0;
         if (wl <= 0.0 && wh <= 0.0)
@@ -70,18 +76,20 @@ public:
         }
         std::array<std::complex<double>, 8> zeros {}, poles {};
         int nz = 0, np = 0;
-        const auto butterworth = [&] (double radius, std::array<std::complex<double>, 8>& out, int& k0) {
-            for (int k = 0; k < n; ++k)
-                out[(std::size_t) k0++] = std::polar (radius, pi * (2.0 * k + n + 1.0) / (2.0 * n));
+        const auto butterworth = [&] (double radius, std::array<std::complex<double>, 8>& out, int& k0, int order) {
+            for (int k = 0; k < order; ++k)
+                out[(std::size_t) k0++] = std::polar (radius, pi * (2.0 * k + order + 1.0) / (2.0 * order));
         };
         if (wh > 0.0)
-            butterworth (wh, poles, np);
+            butterworth (wh, poles, np, nh);
         if (wl > 0.0)
-            butterworth (wl, poles, np);
-        if (wl <= 0.0)
-            butterworth (wh * std::pow (g, 0.5 / n), zeros, nz);           // Num = g + x_h
+            butterworth (wl, poles, np, nl);
+        if (wl > 0.0 && wh > 0.0 && nl != nh)
+            mixedZeros (wl, wh, nl, nh, g, zeros, nz);
+        else if (wl <= 0.0)
+            butterworth (wh * std::pow (g, 0.5 / n), zeros, nz, n);        // Num = g + x_h
         else if (wh <= 0.0)
-            butterworth (wl * std::pow (g, -0.5 / n), zeros, nz);          // Num = 1 + g·x_l
+            butterworth (wl * std::pow (g, -0.5 / n), zeros, nz, n);       // Num = 1 + g·x_l
         else
         {
             // ρ t² + (g + ρ) t + 1 = 0, t = x_l, ρ = (Ω_l / Ω_h)^{2n}; the numerically stable quadratic roots
@@ -160,6 +168,62 @@ public:
 
 private:
     struct Analog { double c2 = 0.0, c1 = 0.0, c0 = 1.0; }; // c2·s² + c1·s + c0 (the default: 1)
+
+    // a middle band whose crossovers have different orders: Num in z = (Ω / Ω_l)² is
+    // P (z) = 1 + g·z^nl + ρ·z^nh + ρ·z^(nl+nh), ρ = (Ω_l / Ω_h)^(2·nh), of degree ≤ 8: its roots by Aberth's method,
+    // started on the two circles the edge factors give (|z| = g^(−1/nl) and (g / ρ)^(1/nh)); each root z gives the
+    // left-half-plane zero s = −Ω_l·√(−z)
+    static void mixedZeros (double wl, double wh, int nl, int nh, double g, std::array<std::complex<double>, 8>& zeros, int& nz) noexcept
+    {
+        using C = std::complex<double>;
+        const int d = nl + nh;
+        const auto rho = std::pow (wl / wh, 2.0 * nh);
+        std::array<double, 9> a {}; // monic coefficients, a[k] for z^k
+        a[0] += 1.0;
+        a[(std::size_t) nl] += g;
+        a[(std::size_t) nh] += rho;
+        a[(std::size_t) d] += rho;
+        for (auto& x : a)
+            x /= rho;
+        std::array<C, 8> z {};
+        const auto r1 = std::pow (g, -1.0 / nl), r2 = std::pow (g / rho, 1.0 / nh);
+        for (int k = 0; k < nl; ++k)
+            z[(std::size_t) k] = std::polar (r1, pi * (2.0 * k + 1.0) / nl + 0.31);
+        for (int k = 0; k < nh; ++k)
+            z[(std::size_t) (nl + k)] = std::polar (r2, pi * (2.0 * k + 1.0) / nh + 0.17);
+        for (int it = 0; it < 80; ++it)
+        {
+            double worst = 0.0;
+            for (int i = 0; i < d; ++i)
+            {
+                C p = 1.0, dp = 0.0; // Horner (monic)
+                for (int k = d - 1; k >= 0; --k)
+                {
+                    dp = dp * z[(std::size_t) i] + p;
+                    p = p * z[(std::size_t) i] + a[(std::size_t) k];
+                }
+                if (std::abs (dp) == 0.0)
+                    continue;
+                const auto ratio = p / dp;
+                C sum = 0.0;
+                for (int j = 0; j < d; ++j)
+                    if (j != i)
+                        sum += 1.0 / (z[(std::size_t) i] - z[(std::size_t) j]);
+                const auto step = ratio / (1.0 - ratio * sum);
+                z[(std::size_t) i] -= step;
+                worst = std::max (worst, std::abs (step) / std::max (1e-300, std::abs (z[(std::size_t) i])));
+            }
+            if (worst < 1e-14)
+                break;
+        }
+        for (int i = 0; i < d && nz < 8; ++i)
+        {
+            auto s = -wl * std::sqrt (-z[(std::size_t) i]);
+            if (s.real() > 0.0)
+                s = -s;
+            zeros[(std::size_t) nz++] = s;
+        }
+    }
     struct Digital { double b0 = 1.0, b1 = 0.0, b2 = 0.0, a1 = 0.0, a2 = 0.0; };
 
     static int sections (const std::complex<double>* roots, int n, std::array<Analog, 4>& out) noexcept

+ 5 - 0
src/core/PluginLayout.cpp

@@ -2073,6 +2073,11 @@ Layout prismMultiband()
         add (dial (420, 630, 20, links[b], TR_NOOP ("Stereo link")));
         add (tabs (480, 626, 130, 22, linkModes[b], TR_NOOP ("Mid|Side")));
     }
+    // round 147: each crossover's own slope (0 = the global one)
+    static const char* xs[5] { "Crossover 1 slope", "Crossover 2 slope", "Crossover 3 slope", "Crossover 4 slope", "Crossover 5 slope" };
+    static const char* xsCaption[5] { TR_NOOP ("Slope 1"), TR_NOOP ("Slope 2"), TR_NOOP ("Slope 3"), TR_NOOP ("Slope 4"), TR_NOOP ("Slope 5") };
+    for (int k = 0; k < 5; ++k)
+        v.push_back (dial (660.0f + 52.0f * (float) k, 630, 16, xs[k], xsCaption[k]));
     l.height = 668;
     return l;
 }

+ 10 - 1
src/ui/I18nData.h

@@ -11438,6 +11438,15 @@ inline constexpr unsigned char ptBR[] = {
 101, 110, 116, 101, 32, 101, 32, 109, 97, 105, 115, 32, 97, 108, 116, 111, 59, 32, 109, 97, 105, 115, 32, 102,
 111, 114, 116, 101, 32, 99, 111, 109, 32, 109, 97, 105, 115, 32, 99, 111, 109, 112, 101, 110, 115, 97, 195, 167,
 195, 163, 111, 34, 10, 34, 69, 120, 112, 97, 110, 100, 101, 114, 34, 32, 61, 32, 34, 69, 120, 112, 97, 110,
-115, 111, 114, 34, 10,
+115, 111, 114, 34, 10, 34, 76, 111, 119, 32, 115, 108, 111, 112, 101, 34, 32, 61, 32, 34, 73, 110, 99, 108,
+105, 110, 97, 195, 167, 195, 163, 111, 32, 103, 114, 97, 118, 101, 34, 10, 34, 72, 105, 103, 104, 32, 115, 108,
+111, 112, 101, 34, 32, 61, 32, 34, 73, 110, 99, 108, 105, 110, 97, 195, 167, 195, 163, 111, 32, 97, 103, 117,
+100, 97, 34, 10, 34, 83, 108, 111, 112, 101, 32, 49, 34, 32, 61, 32, 34, 73, 110, 99, 108, 105, 110, 97,
+195, 167, 195, 163, 111, 32, 49, 34, 10, 34, 83, 108, 111, 112, 101, 32, 50, 34, 32, 61, 32, 34, 73, 110,
+99, 108, 105, 110, 97, 195, 167, 195, 163, 111, 32, 50, 34, 10, 34, 83, 108, 111, 112, 101, 32, 51, 34, 32,
+61, 32, 34, 73, 110, 99, 108, 105, 110, 97, 195, 167, 195, 163, 111, 32, 51, 34, 10, 34, 83, 108, 111, 112,
+101, 32, 52, 34, 32, 61, 32, 34, 73, 110, 99, 108, 105, 110, 97, 195, 167, 195, 163, 111, 32, 52, 34, 10,
+34, 83, 108, 111, 112, 101, 32, 53, 34, 32, 61, 32, 34, 73, 110, 99, 108, 105, 110, 97, 195, 167, 195, 163,
+111, 32, 53, 34, 10,
 };
 } // namespace lynx::i18n::data

+ 7 - 2
src/ui/ProEditors.cpp

@@ -1686,8 +1686,13 @@ private:
             {
                 const auto x0 = a.getX() + 600.0f;
                 add (tabs ({ x0 + 10.0f, a.getY() + 26.0f, 100.0f, 22.0f }, bandScFree0 + b, "Band|Free"));
-                add (knob ({ x0 + 4.0f, a.getY() + 56.0f, 56.0f, 74.0f }, bandScLow0 + b, tr ("Low"), 0));
-                add (knob ({ x0 + 58.0f, a.getY() + 56.0f, 56.0f, 74.0f }, bandScHigh0 + b, tr ("High"), 0));
+                add (knob ({ x0 + 4.0f, a.getY() + 52.0f, 56.0f, 66.0f }, bandScLow0 + b, tr ("Low"), 0));
+                add (knob ({ x0 + 58.0f, a.getY() + 52.0f, 56.0f, 66.0f }, bandScHigh0 + b, tr ("High"), 0));
+                // the band's own slopes (Pro-MB's per-band slopes): its lower / upper crossover's slope, or the global one
+                if (b > 0)
+                    add (menu ({ x0 + 4.0f, a.getY() + 122.0f, 54.0f, 20.0f }, xoverSlope0 + b - 1, tr ("Low slope"), "Global|12|24|48"));
+                if (b < nb() - 1)
+                    add (menu ({ x0 + 60.0f, a.getY() + 122.0f, 54.0f, 20.0f }, xoverSlope0 + b, tr ("High slope"), "Global|12|24|48"));
                 add (knob ({ x0 + 126.0f, a.getY() + 22.0f, 84.0f, 92.0f }, bandLink0 + b, tr ("Link"), 1));
                 add (tabs ({ x0 + 132.0f, a.getY() + 122.0f, 74.0f, 22.0f }, bandLinkMode0 + b, "Mid|Side"));
             }

+ 1 - 1
tests/Parity135fTests.inc

@@ -242,7 +242,7 @@ TEST (parity135f_prism_six_bands)
     using namespace dyn108;
     namespace m = lynx::dyn::prism;
     // the old parameter block keeps its indices; the new ones are appended
-    CHECK (m::bandLookahead0 == 48 && m::band5 == 52 && m::xover4 == 72 && m::bandCountParam == 76 && m::scExternal == 83 && m::processingMode == 84 && m::panMode == 86 && m::dynamicEngine == 87 && m::bandLink0 == 88 && m::count == 118); // round 144: + processing, oversampling, pan mode
+    CHECK (m::bandLookahead0 == 48 && m::band5 == 52 && m::xover4 == 72 && m::bandCountParam == 76 && m::scExternal == 83 && m::processingMode == 84 && m::panMode == 86 && m::dynamicEngine == 87 && m::bandLink0 == 88 && m::count == 123); // round 144: + processing, oversampling, pan mode
     CHECK ((int) lynx::effectInfo (EffectKind::prismMultiband).params.size() == m::count);
     auto p = defaults (EffectKind::prismMultiband);
     CHECK (m::bandCount (p) == 4 && m::param (4, m::fEnabled) == 60 && m::param (5, m::fSolo) == 71);

+ 45 - 1
tests/Parity147Tests.inc

@@ -212,7 +212,7 @@ TEST (prism_stereo_link_round147)
 {
     using namespace lynx;
     namespace m = dyn::prism;
-    CHECK (m::bandLink0 == 88 && m::count == 118 && (int) effectInfo (EffectKind::prismMultiband).params.size() == m::count);
+    CHECK (m::bandLink0 == 88 && m::count == 123 && (int) effectInfo (EffectKind::prismMultiband).params.size() == m::count);
     CHECK (formatEffectParam (EffectKind::prismMultiband, m::bandLink0, 0.25f, 120.0) == "50%");
     CHECK (formatEffectParam (EffectKind::prismMultiband, m::bandLink0 + 2, 0.75f, 120.0) == "100%, 50% only");
     CHECK (formatEffectParam (EffectKind::prismMultiband, m::bandScLow0, m::scFilterValue (2000.0), 120.0) == "2.00 kHz");
@@ -324,3 +324,47 @@ TEST (hush_energy_detector_meter_round147)
     CHECK (std::abs ((loudHigh - quietHigh) - 20.0) < 2.0); // follows the level
     CHECK (low < loudHigh - 20.0);                          // the detector hears the sibilance band only
 }
+
+TEST (prism_per_crossover_slopes_round147)
+{
+    using namespace lynx;
+    namespace m = dyn::prism;
+    namespace mp = minphase;
+    CHECK (m::xoverSlope0 == 118 && m::count == 123);
+    // the default follows the global slope (the old sound)
+    const auto def = makeEffectSlot (EffectKind::prismMultiband).params;
+    for (int k = 0; k < 5; ++k)
+        CHECK (m::crossoverSlopeDbOct (def, k) == m::slopeDbOct (def[m::slope]));
+    CHECK (formatEffectParam (EffectKind::prismMultiband, m::xoverSlope0 + 1, 1.0f, 120.0) == "48 dB/oct");
+    // two bands at 1 kHz, the low one −12 dB: crossover 1 at 48 dB/oct while the global slope is 24
+    auto p = p147::twoBands (-12.0, 0.0);
+    p[m::xoverSlope0] = m::crossoverSlopeValue (48);
+    const auto w = [] (double hz) { return mp::warp (hz, 48000.0); };
+    for (const float mode : { 0.5f, 0.0f, 1.0f }) // dynamic, linear, minimum
+    {
+        p[m::processingMode] = mode;
+        const auto g = p147::toneGain (p, 500.0);
+        const auto expected = 20.0 * std::log10 (mp::bandMagnitude (0.0, w (1000.0), 4, 4, p147::dbToGain (-12.0), w (500.0)));
+        std::printf ("  Prism crossover 48 dB/oct (mode %.1f): 500 Hz %.2f dB (expected %.2f; 24 dB/oct: -10.60)\n", mode, g, expected);
+        CHECK (std::abs (g - expected) < 0.15);
+    }
+    // a middle band between a 12 dB/oct and a 48 dB/oct crossover (the measured dynamic engine, mixed orders)
+    auto q = dyn108::defaults (EffectKind::prismMultiband);
+    q[m::bandCountParam] = m::bandCountValue (3);
+    q[m::xover1] = m::crossoverValue (300.0);
+    q[m::xover2] = m::crossoverValue (3000.0);
+    q[m::xoverSlope0] = m::crossoverSlopeValue (12);
+    q[m::xoverSlope0 + 1] = m::crossoverSlopeValue (48);
+    for (int b = 0; b < 3; ++b)
+        q[(std::size_t) m::param (b, m::fRange)] = 0.5f;
+    q[(std::size_t) m::param (1, m::fLevel)] = 0.3f; // −12 dB
+    const double gains[m::bands] { 0.0, -12.0, 0.0, 0.0, 0.0, 0.0 };
+    for (const double hz : { 150.0, 300.0, 1000.0, 3000.0, 5000.0 })
+    {
+        const auto g = p147::toneGain (q, hz);
+        const auto expected = 20.0 * std::log10 (mp::bandMagnitude (w (300.0), w (3000.0), 1, 4, p147::dbToGain (-12.0), w (hz)));
+        std::printf ("  Prism mixed slopes 12 / 48: %.0f Hz %.2f dB (expected %.2f)\n", hz, g, expected);
+        CHECK (std::abs (g - expected) < 0.15);
+        CHECK (std::abs (m::responseDb (q, gains, 48000.0, hz) - expected) < 0.05);
+    }
+}