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
  • bridge
  • midistream.py
Find file
BlameHistoryPermalink
  • PLN (Algolia)'s avatar
    rig: absent is not broken, and a deep queue is just latency · b503502f
    Two gate/monitor fixes found while clearing gig-up blockers the night before a
    gig.
    
    ABSENT IS NOT BROKEN. check-audio-graph hard-FAILED the moment Ardour's Master
    was on the internal codec, which made the whole pre-gig gate NO-GO while PLN was
    rehearsing on the laptop jack with the UMC in a bag. PLN: "no umc atm playing on
    the jack now. we need to be tolerant to various setups." He is right, and the
    repo already knows the rule — section 3 of this same script downgrades to warn
    when the interface is absent, and rig.py opens with "REPORT ABSENT AS ABSENT".
    Section 2 just never got the memo.
    
    Severity now depends on whether the UMC EXISTS. No UMC on the bus: warn, say
    plainly that the last hop cannot be proven until the interface is plugged in,
    and tell him to re-run at the venue. UMC present and Master still on the codec:
    that is the real regression this check was written for — Ardour restores its own
    saved ports and does NOT follow the PipeWire default sink, so it will happily
    ignore an interface sitting right there. Result: OK (3 warnings) instead of a
    NO-GO on a legitimate setup.
    
    A DEEP QUEUE IS NOT A BUFFER, IT IS A DELAY. PLN: "when i move faders up/down
    quickly, [it] lags by 500ms+, almost 1s, behind ahah".
    
    Chased this to the wrong end twice, worth recording. First guess was fork+exec
    per LED write — measured it: 2.8 ms p50, 8 ms p99, and --bench shows the
    coalescer at p99 18 ms with ZERO overrun, so the LED path was never the problem.
    Faders have no LEDs at all (row D), so a fader sweep does no LED writes; and the
    Pulsar HUD has no MIDI tap, so it cannot lag on MIDI either. Second guess was
    aseqdump block-buffering its stdout into a pipe (the exact bug this repo
    documents for Python) — disproved with an isolated aseqdump client fed by
    aseqsend: median 40 ms inter-arrival at a 25/s send rate, last event landing
    BEFORE the last send. It flushes per event.
    
    The real seam is the Bridge's SSE fan-out: `queue.Queue(maxsize=512)`. A fader
    sweep is ~400 CC/s, so 512 deep is 1.3 s of backlog — and once it fills it STAYS
    full, because drop-oldest holds the buffer AT capacity. Every event the browser
    renders is then 512 events stale, permanently. The drop policy was already right;
    the DEPTH was the latency. 512 was picked as "generous" and is really a latency
    budget nobody priced.
    
    Now 64 (~160 ms at that rate) — jitter absorption rather than a queue. Paired
    with the browser-side coalescing from 72937cc7, the consumer drains far faster
    than it fills, so it should rarely be reached.
    
    Verified: 79/79 bridge tests, check-audio-graph OK on the jack.
    PLN (Algolia) authored Aug 21, 2026
    b503502f
midistream.py 6.05 KB
EditWeb IDE
×

Replace midistream.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.