Skip to content

  • Projects
  • Groups
  • Snippets
  • Help
  • This project
    • Loading...
  • Sign in / Register
T
Tidal
  • Overview
    • Overview
    • Details
    • Activity
    • Cycle Analytics
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
    • Charts
  • Issues 0
    • Issues 0
    • List
    • Board
    • Labels
    • Milestones
  • Merge Requests 0
    • Merge Requests 0
  • CI / CD
    • CI / CD
    • Pipelines
    • Jobs
    • Schedules
    • Charts
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Members
    • Members
  • Collapse sidebar
  • Activity
  • Graph
  • Charts
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
  • PLN
  • Tidal
  • Repository

Switch branch/tag
  • Tidal
  • tools
  • foundry
  • server.py
Find file
BlameHistoryPermalink
  • PLN (Algolia)'s avatar
    feat(foundry): length-preserving zero-crossing snap — exported loops are exact bar multiples · 0759def5
    The B1 zc-snap moved each loop edge independently (±10ms tolerance), so
    exported loop DURATIONS drifted off the bar grid: measured −4.2ms on a
    4-bar (superfreak bass) and −11.4ms on 2-bar loops (hammer kit, both
    edges snapped inward). loopAt absorbs the drift, but the kit contract we
    want is stronger: every exported loop's duration == bars × bar_len.
    
    Fix — _snap_length_preserving(): hold the exact bar-multiple sample
    count RIGID (bar_len_samples from the take's grid BPM) and slide the
    WHOLE window by a single common offset δ ∈ ±ZC_TOL_MS, picking the δ
    that minimizes combined edge amplitude |y[start]|+|y[end]| (tie-break:
    smallest |δ|). Both edges move together ⇒ duration is preserved by
    construction; guarantee |exported_dur − bars·bar_len| < 1ms (measured
    <0.02ms on real stems). Chops (bars=0) keep the per-edge snap.
    
    _snapped_window/_true_seam (verify-rerank, 791a0d78) now mirror the same
    scheme so the finder still measures the exact window export writes —
    export-faithfulness is preserved through the change.
    
    kit_multiples_check() makes the guarantee explicit per forge: after
    export, each file's duration-in-bars at the shared grid BPM is compared
    to the nearest integer multiple; >0.5% deviation warns with numbers.
    export_take_report() bundles export + check; the server /api/export now
    returns the multiples block.
    
    Spot-check on real stems (old per-edge vs new length-preserving snap,
    top-5 finder candidates re-graded on the exact export window):
      superfreak drums: dev +0.4…+3.6ms → ≤0.01ms; grades C→S, A→A, S→A, S→S
      superfreak bass:  dev −1.1…+3.7ms → ≤0.01ms; grades A→S, B→C, S→B, A→A
      hammer drums:     dev −1.8…+1.9ms → ≤0.01ms; all S stay S
      hammer bass:      dev −2.9…+6.9ms → ≤0.01ms; C→B, A→S, D→C, B→C
    Net: duration guarantee achieved; grade moves are the rigid-length
    window exposing true seams (some old windows only looked seamless
    because per-edge snap trimmed the tail). No systematic regression;
    existing superfreak/hammer kit exports untouched (validated, in use).
    
    Tests: +4 (snap length invariance, bar_len_samples, end-to-end exported-
    duration-is-exact-bar-multiple on a synthetic stem, multiples-check
    flags off-grid). 81 passed.
    PLN (Algolia) authored Jul 11, 2026
    0759def5
server.py 11.8 KB
EditWeb IDE
×

Replace server.py

Attach a file by drag & drop or click to upload


Cancel
A new branch will be created in your fork and a new merge request will be started.