Explorar o código

Issue #14: pitch audit checks against the note played 7 semitones up; engines the estimate can't read are listed

Ka1-S hai 1 mes
pai
achega
d73fbf9f6c
Modificáronse 2 ficheiros con 21 adicións e 6 borrados
  1. 7 2
      docs/analise/REA_rodada166a.md
  2. 14 4
      tests/Issue14bugsTests.inc

+ 7 - 2
docs/analise/REA_rodada166a.md

@@ -145,8 +145,13 @@ Only the key clicked with the mouse was drawn pressed.
 - `Instrument::setLivePitch (cents)`: the renderer passes each channel's PITCH knob + fine tune + main pitch before
   every block. A hosted plugin (`PluginInstrument`) turns it into MIDI pitch bend scaled by the wrapper's pitch bend
   range, and a slide note into a pitch-bend glide (64-sample steps) that a new note resets.
-- Tests: `issue14_pitch_audit_of_the_instruments` (now with checks: every engine within 40 cents of +700 for main
-  pitch, knob and slide, except the ones whose pitch the estimate can't read), and
+- After [TEST, same audit, 2026-10-31 02:35]: every engine within 10 cents of +700 for main pitch, knob and slide
+  (LYNX Synth +701/+701/+701, 3x Osc +700/+700/+701, Sytrus +699/+699/+700, … Transistor Bass +700/+700/+698, BooBass
+  +692/+692/+694); Plucked! main pitch and knob +699, slide +0 (as FL). Ogun, Sakura and Drumpad: the autocorrelation
+  estimate can't read their pitch (Ogun's own held C4 jumps 2 octaves between 0.3 s and 1.0 s; its slide reads +726…+740
+  cents right after the glide); FL Slayer (guitar model) slide +700.
+- Tests: `issue14_pitch_audit_of_the_instruments` (now with checks: within 40 cents of the same note played 7
+  semitones up, or of base + 700, for main pitch, knob and slide, except the engines the estimate can't read), and
   `issue14_plugin_channels_get_the_pitch_knob_main_pitch_and_slides`.
 - Linux: the core tests run natively on Linux (WSL); the JUCE side (PluginHost, Piano roll, Playlist) compiles in the
   Linux build.

+ 14 - 4
tests/Issue14bugsTests.inc

@@ -123,8 +123,10 @@ TEST (issue14_pitch_audit_of_the_instruments)
     if (realFlpDir.empty())
         return;
     const auto print = std::getenv ("LYNX_PITCH_AUDIT") != nullptr;
-    // the pitch of a guitar model / drums can't be read by the autocorrelation estimate (Drumpad doesn't follow the key)
-    const std::set<std::string> unreadable { "FL Slayer", "Fruity Granulizer", "Drumaxx", "Fruit Kick", "BassDrum", "Drumpad" };
+    // the pitch of a guitar / string model and of drums can't be read by the autocorrelation estimate (Sakura: C4 reads as
+    // 870 Hz and G4 lower than C4; Ogun's held C4 reads 2 octaves apart at 0.3 s and 1.0 s, its slide +726…+740 cents at
+    // 0.6…0.65 s with LYNX_PITCH_TRACE; Drumpad doesn't follow the key)
+    const std::set<std::string> unreadable { "FL Slayer", "Fruity Granulizer", "Drumaxx", "Fruit Kick", "BassDrum", "Drumpad", "Sakura", "Ogun" };
     // Plucked! reads Final.Pitch only when a voice starts (REA_rodada65 §1.2: it sizes the delay line): FL can't glide it
     const std::set<std::string> noSlide { "Plucked!" };
     const auto fl = natives142::flAccess();
@@ -160,13 +162,21 @@ TEST (issue14_pitch_audit_of_the_instruments)
         bent.misc.pitchRange = 12;
         bent.sampler.pitch += 7.0f;
         const auto knob = issue14::pitchAt (issue14::renderPattern (bent, { held }, 0.0f, 1.5), 1.0);
-        const auto slid = issue14::pitchAt (issue14::renderPattern (c, { held, slide }, 0.0f, 1.5), 1.0);
+        const auto slidOut = issue14::renderPattern (c, { held, slide }, 0.0f, 1.5);
+        const auto slid = issue14::pitchAt (slidOut, 1.0);
+        if (print && std::getenv ("LYNX_PITCH_TRACE") != nullptr)
+            for (const auto t : { 0.3, 0.45, 0.55, 0.6, 0.65, 0.7, 0.8, 0.9, 1.0 })
+                std::printf ("    %s slide t=%.2f %+.0f cents\n", name.c_str(), t, issue14::cents (base, issue14::pitchAt (slidOut, t)));
         if (print)
             std::printf ("  %-28s %9.1f %+9.0f %+9.0f %+9.0f\n", name.c_str(), base, issue14::cents (base, master), issue14::cents (base, knob),
                          issue14::cents (base, slid));
         if (unreadable.count (name) == 0)
         {
-            const auto same = [ref] (double hz) { return std::abs (issue14::cents (ref, hz)) < 40.0; };
+            // within 40 cents of the key played 7 semitones up, or (an engine whose key doesn't move its pitch, like a
+            // Transistor Bass preset running its own sequence) of the base pitch + 700 cents
+            const auto same = [ref, base] (double hz) {
+                return std::abs (issue14::cents (ref, hz)) < 40.0 || std::abs (issue14::cents (base, hz) - 700.0) < 40.0;
+            };
             if (! same (master) || ! same (knob) || (noSlide.count (name) == 0 && ! same (slid)))
                 std::printf ("  pitch: %s doesn't follow (key +7 %+.0f; master %+.0f, knob %+.0f, slide %+.0f cents)\n", name.c_str(),
                              issue14::cents (base, ref), issue14::cents (base, master), issue14::cents (base, knob), issue14::cents (base, slid));