CHANGELOG V7.7 (2026-06-14)
  [fix] Resolved a display bug in the final summary where the resume counter showed an
        incorrect starting file index (e.g., "10 of 9").
  [imp] Info line now shows full technical metadata: codec name, sample rate
        (kHz), channel count (Nch), bit depth if available (lossless only),
        bitrate, duration last. Examples:
          Encoder: reference libFLAC 1.3.4 │ flac │ 44.1 kHz │ 2ch │ 24 bit │ 1411 kbps │ 00:08:13
          Encoder: LAME3.100 │ mp3 │ 44.1 kHz │ 2ch │ 320 kbps │ 00:04:01
        Bit depth only shown when > 0 (unavailable for lossy formats).
  [fix] Reason string for auCDtect-compromised context rule corrected:
        "auCDtect already flagged anomalies (SKIP/MPEG)" ->
        "auCDtect returned SKIP or MPEG".
  [fix] Critical: rescan loop was infinite. Files processed in the first pass
        were never added to the processed list, so every rescan found the same
        files again. Fixed by recording each file in the processed list at the
        very start of its processing, before any analysis or skip logic.
  [imp] Engine line and info line are now separate:
        Line 1 (DarkGray/DarkMagenta): Full analysis label + Engine type
        Line 2 (DarkCyan): Encoder tag (or "No encoder tag") + kbps + hh:mm:ss
        Eliminates the wrap problem when encoder tags or paths are long.
        Applied also to files rejected by the bitrate pre-filter (< 170 kbps).
        DarkMagenta used for "Full analysis (>= 170 kbps) | Engine: spectrogram (lossy)"
        and for Hi-Res and 48 kHz bypass engine lines and for "New files detected"
        rescan messages. DarkCyan used for the info line.
  [new] Encoder tag extracted from file metadata (format-level or stream-level)
        and shown on the info line. Always shown: either the tag value or
        "No encoder tag". Applies to all formats and all engine paths.
  [imp] Source quality stratification in FAKE reason strings and classification
        thresholds (spectrogram fallback path for standard lossless 44.1/48 kHz):
          <= 13 kHz    : low-quality lossy source (e.g. MP3 <= 128 kbps)
          13-17.2 kHz  : mid-quality lossy source (e.g. MP3 160/192 kbps)
          17.2-20.5 kHz: high-quality compressed source (e.g. MP3 320 kbps / VBR V0)
          20.5-22 kHz  : 44.1 kHz standard source
        Threshold raised from 20000 to 20500 Hz: MP3 320 kbps and VBR V0 can
        reach 20-21.5 kHz.
        Note: for 44.1 kHz files this path is taken only when auCDtect is
        unavailable or returned too few readable segments. When auCDtect works
        normally its own verdict (MPEG/CDDA %) is shown instead. For 48 kHz
        files the spectrogram engine is always used (auCDtect bypassed).
  [new] Resume box now uses Unicode double-border characters (╔ ╠ ╚ ║).
  [fix] Redundant "Standard 48 kHz Lossless detected" log line removed from
        the internal context function - already shown on the Engine line.
  [fix] Rescan after analysis now always shows "Rescan complete: no new files
        found." in dark grey so the user knows the check ran.
  [fix] Resume N-branch: full fresh disk rescan instead of reusing stale file
        list. Files moved to ~Fake in previous session now correctly excluded.
        Message changed to "Rescanning folder..." to reflect actual behavior.
  [fix] When declining resume (answer N), file index counter reset to 0.
  [fix] Resume box [char] * Int multiplication not valid in PowerShell 5.1;
        fixed using [string][char] * Int.
  [chg] Encoder absent now shown as "No encoder tag" instead of being omitted.
  [chg] Rule A2-RMS-SUSPECT reason: "avg rms" -> "average rms", spacing adjusted.

CHANGELOG V7.7 (2026-06-11)
  [new] After the main analysis finishes, the script automatically rescans
        the target folder (including all subfolders) for audio files added
        during the run. Any new files found are analysed immediately with
        the same rules as the main pass. The rescan repeats until no new
        files are found, then orphan folder cleanup runs once as usual.
        No user interaction required - the process is fully automatic.
        Only applies when a folder is being scanned; dragging individual
        files is unaffected.

CHANGELOG V7.7 (2026-06-10)
  [fix] If a file disappears from disk before its turn (drive disconnected,
        file moved or deleted externally), it is now detected immediately
        and recorded as SKIP without retrying or asking the user anything.
        The retry loop and S/X/C prompt are reserved for files that are
        present on disk but cannot be read (genuine I/O errors).

CHANGELOG V7.7 (2026-06-09)
  [fix] Rule A2-RMS-SUSPECT was silently never firing due to a logic error
        introduced in a previous session. Fixed: the rule now correctly
        catches the case of exactly 1 slot walled <= 16000 Hz where the
        slot has low energy (possible breakdown or near-silence passage).
  [new] New sub-case added to Rule A2-1SLOT-SUSPECT: if exactly 1 non-end
        slot is walled below 16 kHz with normal audio energy (ratio >= 0.35)
        and the track is under 30 min, the result is SUSPECT instead of OK.
        Previously this case fell through to OK with no warning.
        Long mixes (>= 30 min) remain exempt from this sub-case.
  [new] DISK ERROR menu now immediately shows whether the file still exists
        on disk or has disappeared, with tailored advice for each case.
        New [C] option: remount the drive and press C to re-check before
        deciding whether to skip or exit.
  [chg] "Engine: spectrogram (Hi-Res ... auCDtect bypassed)" log line
        colour changed from dark grey to dark cyan.

CHANGELOG V7.7 (2026-06-08 Updated)
  [new] Rule A3 (lossy >= 256 kbps, tracks under 30 min): a single slot
        walled at or below 16 kHz is now sufficient for FAKE when the slot
        also has a low ratio (< 0.35), confirming real audio content was
        present. 16 kHz is the hard ceiling of MP3 at 192 kbps or below;
        a wall there at high bitrate is unambiguous evidence of a low-
        bitrate source. A low ratio rules out silence or breakdown.
        Long mixes (>= 30 min) remain exempt.
        Case fixed: mp3 160 Ozone 12.mp3 (320 kbps transcode from 160 kbps,
        1 slot walled at ~13 kHz, ratio 0.275) now correctly returns FAKE.

CHANGELOG V7.7 (2026-06-08)
  [new] When auCDtect already flagged anomalies on a lossless file (skipped
        segments or an ambiguous MPEG result) and the spectrogram then finds
        even 1 slot walled below 16.5 kHz, the combined evidence is enough
        for FAKE. The normal requirement of 2+ walled slots does not apply
        because auCDtect's own signal acts as independent corroboration.
        Case fixed: mp3 160 Ozone 12.flac (1 of 3 auCDtect segments
        readable, 1 slot walled at ~13 kHz) now correctly returns FAKE.

CHANGELOG V7.7 (2026-06-07 Night)
  [new] Standard 48 kHz lossless files (WAV/FLAC/AIFF) are no longer sent
        to auCDtect, which gives unreliable results at this sample rate.
        They are analysed directly via spectrogram with the correct frequency
        thresholds for 48 kHz. A safety guard flags any routing error.
  [new] Single-slot tolerance raised universally: all rules that previously
        flagged FAKE or SUSPECT on a single anomalous slot now require at
        least 2 slots. A single breakdown, filtered passage or atmospheric
        section cannot condemn a file on its own. Applies to all formats,
        all durations, including Hi-Res.

CHANGELOG V7.7 (2026-06-07)
  [fix] Auto-resume after [R] relaunch now uses a flag file instead of
        command-line arguments, which was unreliable in compiled .exe form.
        The flag is written before relaunch and deleted on the next startup,
        skipping the resume prompt automatically.
  [fix] The resume confirmation box now appears after the file list is built,
        so the "Files done" counter shows the correct X/Y values.
  [fix] Log message for previously processed files no longer uses the word
        "reconciled" - replaced with plain language throughout.

CHANGELOG V7.7 (2026-06-05)
  [new] Rule A2-RMS-SUSPECT (lossy >= 256 kbps, all durations): when exactly
        1 slot is walled below 16 kHz, if that slot has significantly lower
        energy than the rest of the track (rms < 50% of average) and at least
        2 other slots are clean above 19 kHz, the verdict is downgraded to
        SUSPECT. A breakdown or near-silence passage can cause a local HF
        collapse that is not evidence of a bitrate ceiling.
        2 or more walled slots are never exempt regardless of energy level.

CHANGELOG V7.7 (2026-06-04)
  [new] Rule B2 (long mixes >= 30 min, >= 256 kbps): if exactly 2 slots are
        walled below 17.5 kHz and both are also below 16.5 kHz, the result
        is FAKE. Two independent sections with a hard low-bitrate ceiling
        cannot be explained by a single quiet passage or one compressed track.

CHANGELOG V7.7 (2026-06-03)
  [new] Dominant soft ceiling logic: if more than half of the non-end slots
        show a soft frequency ceiling below the expected Nyquist, the result
        is FAKE (was SUSPECT). A tie (exactly half) remains SUSPECT.
  [new] Lossless wall count rules: introduced a separate wall threshold at
        19.5 kHz for lossless files (independent of the 18.5 kHz wall flag
        used for lossy). Genuine lossless content should never show a ceiling
        at 19.5 kHz. Rules mirror the existing lossy duration structure:
        short tracks flag on 1 walled slot; medium and long tracks require
        2 or more. Applied in both the auCDtect secondary check and the
        spectrogram fallback path.

CHANGELOG V7.7 (2026-06-02)
  [new] Rule A2-SUSPECT (lossy >= 256 kbps, 7-30 min): when exactly 1 slot
        is walled in the 15-16 kHz range but all other slots (at least 3)
        are clean above 19 kHz, the result is SUSPECT instead of FAKE. A
        single marginal slot on a quiet passage is ambiguous at high bitrate.
        FAKE still fires when 2 or more slots are walled, or when the single
        walled slot is below 15 kHz, or when fewer than 3 other slots clear
        19 kHz.
  [fix] auCDtect fallback: when 2 or more of the 3 analysis segments are
        skipped, the result was previously an unreliable single-segment
        verdict. The engine now falls back to spectrogram analysis instead.
  [fix] auCDtect fallback: frequency thresholds for FAKE and SUSPECT were
        hardcoded for 44.1 kHz. On 48 kHz files this caused incorrect
        verdicts. Thresholds are now computed relative to the actual Nyquist
        of the file (44.1 kHz or 48 kHz).
  [fix] auCDtect fallback classifier was using only the best-segment cutoff
        (3 lines of logic). It now applies the full wall-vote analysis
        (majority wall, slot counts, minority wall, abrupt end) matching the
        behaviour of the main spectrogram engine.

CHANGELOG V7.7 (2026-05-31)
  [new] Hi-Res lossless (96/192 kHz): auCDtect bypassed; analysed directly
        via spectrogram. Frequency cutoff thresholds established empirically:
        below 22.8 kHz indicates a 44.1 kHz source; 22.8-28 kHz indicates a
        48 kHz source; above 28 kHz is genuine Hi-Res content.
  [new] Session resume: analysis state is saved after every file. If the
        script is interrupted, the next run offers to continue from where
        it stopped, with exact file count and no duplicate work.
  [new] FFmpeg update check: performed only once when FFmpeg is in the
        system PATH (user manages FFmpeg externally).
  [fix] RMS-based slot selection was completely non-functional since v7.4
        due to a log level mismatch: FFmpeg emits energy data at info level
        but the script was capturing only error level. All slots were always
        landing on the fixed centre position. Fixed.
  [imp] Slot scan window now scales with track duration: wider search on
        longer tracks to better catch AI spectral enhancers that leave
        narrow unprocessed gaps on quiet passages.

CHANGELOG V7.6 (2026-05-25)
  [fix] RMS-based slot selection non-functional (same fix later included
        in v7.7 base).
  [imp] Adaptive slot scan window (same improvement later included in
        v7.7 base).

CHANGELOG V7.5 (2026-05-23)
  [fix] Secondary spectrogram check (auCDtect SUSPECT + full-band best
        segment): wall votes computed by the analysis were being discarded
        instead of used for classification. Files with majority wall and
        full-band best segment were incorrectly returning OK.
  [fix] When fewer than 2 auCDtect segments are readable the result is
        now downgraded from FAKE to SUSPECT.
  [fix] Bitrate-unreadable lossless files now show a meaningful log
        message instead of the misleading "bitrate >= 170 kbps".
  [new] Rule A2 (>= 256 kbps, tracks under 30 min): a single slot walled
        below 16 kHz triggers FAKE. At high bitrate this is unambiguous
        evidence of a 128/160 kbps source. Long mixes exempt.

CHANGELOG V7.4 (2026-05-23)
  [fix] Full-band lossless files at exactly Nyquist were incorrectly
        classified SUSPECT due to a >= vs > comparison error. Fixed.
  [fix] Wall reason string now shows the correct frequency range for
        the typical 160 kbps upscale case.
  [new] Single-wall FAKE rule restored: any slot walled below 17.2 kHz
        on a >= 256 kbps file is FAKE (unambiguous low-bitrate ceiling).
  [imp] RMS-based slot refinement restored for all 4 non-final slots.
  [fix] Rule A: now checks only the best (highest-cutoff) slot, not any
        slot. A single compressed track inside a long mix no longer
        triggers FAKE on the whole file.
  [fix] Abrupt-end detection result now correctly propagated in the
        secondary spectrogram check.

CHANGELOG V7.3 (2026-05-22)
  [new] High-bitrate anti-upscale rule (>= 256 kbps): 2 or more slots
        below 17.5 kHz on a normal track (< 30 min) returns FAKE; long
        mixes require 3 or more slots.
  [fix] Clipboard paste in the file selection window now handles files
        copied directly from Explorer (Ctrl+C).
  [fix] Selection window layout fixes: anchoring, size, font clipping.
  [fix] Enter key flow in the selection window made explicit: first Enter
        adds the typed path, second Enter starts the analysis.
  [fix] Disk-error retry with user prompt: instead of silently skipping a
        file on the first probe failure, the script retries up to 5 times
        with a 5-second pause, then asks the user whether to skip (S) or
        exit and retry on the next resume (X).

CHANGELOG V7.1 (2026-05-18)
  [fix] Application icon now correctly displayed on the selection window.
  [new] Selection window redesigned with a full info panel replacing the
        console output on first launch.
  [fix] PNG segment write failures and hardware I/O errors now retry up
        to 3-5 times before skipping, instead of skipping immediately.
  [fix] Resume now restarts from the last fully completed file; a file
        interrupted mid-analysis is always re-analysed on the next run.
  [imp] Fourth analysis slot is now guaranteed even on short tracks.
  [imp] OK reason string shows wall vote, average cutoff and thresholds.
  [imp] FAKE/SUSPECT reason strings include the actual cutoff Hz of each
        walled slot for easier manual verification.

CHANGELOG V6.7
  [imp] Improved detection of lossy upscales masked as high-bitrate audio
        (e.g. 128/192 kbps re-encoded to 320 kbps). Added targeted rules
        for files at >= 256 kbps.

CHANGELOG V6.6
  [fix] When dragging multiple folders, only the first was being scanned.
        All dragged folders are now processed in a single run.
  [imp] Paste paths from clipboard added to the selection window.

CHANGELOG V6.5
  [imp] Multi-folder drag: each folder is processed independently with
        its own ~Report and ~Fake output.
  [fix] FFmpeg path detection no longer attempts an admin-level upgrade
        when FFmpeg is already in the system PATH.
  [fix] FFmpeg version check made more reliable with a GitHub fallback
        and corrected timeout handling.

CHANGELOG V6.4
  [new] Required tools (auCDtect, FFmpeg) are downloaded automatically
        if not found locally. FFmpeg can also be installed manually via:
        winget install --id Gyan.FFmpeg

CHANGELOG V6.3
  [fix] Empty-folder detection: subdirectory parents already removed are
        no longer logged again as removed.
  [fix] "Likely a fluke" message suppressed when the best segment itself
        is walled below 16.5 kHz.
  [fix] Minority-wall safety net: when the best segment masks lower
        walled slots, the file now returns SUSPECT instead of OK.
  [fix] Running from inside a ZIP now exits with a readable error message.
  [imp] Minimum track duration lowered from 60 s to 30 s.
  [imp] Abrupt-end detection skipped for files over 30 min.
  [imp] Abrupt-end drop threshold raised to reduce false alarms.
  [imp] -ExcludePaths parameter: skip specific subfolders by name.

CHANGELOG V6.2
  [fix] Resume counter now shows the correct current/total file index.

CHANGELOG V6.1.2
  [imp] Automatic download info shown before the start confirmation.

CHANGELOG V6.1.1
  [fix] ~Report folder is recreated automatically if it disappears
        during a very long scan.
  [fix] Extra folder guards added before CSV and HTML export.

CHANGELOG V6.1
  [new] Resume: analysis state saved after every file. On next launch,
        if an interrupted session is found for the same folder, the user
        can continue from the last completed file.

CHANGELOG V6.0
  [fix] Save-ResumeState: parameter type mismatch under PowerShell 5.1
        fixed.
  [fix] Report serialisation corrected for PowerShell 5.1 compatibility.
