User authorizes20ms total MIDI latency, ahead-of-time CoreMIDI submission, slower worker, simple drops on backlog; no catch-up/rescheduling scheme. Isolate MIDI scheduling from IO worker: retain IO100us idle polling, prior single-start48k512/zero-input audio build and normalDSP/UI/WB topology.
Plan:
Raw root:/private/tmp/smartgrid-midi-scheduled-trial-20260911. Baseline single-start binary6194cc7925c25f4b269eca878dc90741aff2e47cbc8a4bbab982ad1d5de9f646. Real-time scheduling change and message batching are part of this intervention; it does not independently isolate polling from deadline policy. Audio thread gets no new wakeup/semaphore operation. Stop messages retain their event timestamp+20ms ordering; already-scheduled clocks have only this short horizon and are not individually edited. Late messages are dropped as explicitly authorized.
Preflight attempt1 (22:07:25–22:07:40 PDT): build/sign/install passed; patch/config preserved. Worker roughly500 iterations per second, queue full/late/invalid0, queued SysEx submissions633. Actual CoreMIDI counters remained scheduled0/immediate1, so measurement was correctly blocked. Stopped app22:09:20 for passive cooling. Added missing-output and native endpoint-disconnection counters; do not infer active bus traffic from the older sysex_submitted counter. First binary f5768a42548915969c12cda62753cb6b3dc713d4390717e23ea45c4d19ba1fca archived under rawroot/preflight-attempt1. Native audio backend hash still identical to single-start baseline. No recorded trial yet.
Preflight attempt2 (22:13:12–22:13:28): reproduced native_scheduled0/native_immediate1 with missing-output0 and native endpoint-disconnection count2. This confirms stale JUCE connections, not absent app output objects. Stopped22:14:42. Added connection-liveness exposure to app-local JUCE MIDI output header and one-second message-thread reconnection of disconnected outputs by configured name. Reuses the existing output wrapper address, swaps native connection/session/group metadata under the existing sender lock; no new audio-thread signalling or retry queue. No repeated handshake or audio reinitialization. Input reconnection is not changed in this trial. This is an additional intervention required for verified MIDI-active playback. Prior sysex_submitted counts measure handoff to JUCE, not actual native submission; this finding limits those counts’ evidentiary value and needs a separate follow-up audit (it does not retroactively prove every earlier run disconnected).
Measured trial started22:19:31.938 PDT, intended end22:34:31.938 (900seconds); K-Mix recording began22:19:06.976, channels3/4 stereo48k24bit. Signal verified around-43.16dBFS. Detached controllerPID84519, recorder wrapper84462/sox84465. Controller automatically stops recording, retrieves native/lifecycle/app prefixes and system archive; app remains running.30minute heartbeat analyze-scheduled-midi-ipad-trial will analyze and remove itself. No new experiment queued.
Final binary cc8739cce6b7bb0178bdb86b0584abe29355afbf9ab07f127f5d8682c01fd151, signature/build passed. Patch/config unchanged. Thermal preflight last200callbacks allnominal, actual48k512, inputs0/outputs4, single-start lifecycle gate passed14events. Output reconnected once22:18:33; native disconnection counter remained2 thereafter. This counter aggregates connection types; it does not by itself establish whether both input and output are dead. Scheduled native packets2294/immediate1978 (native API packet/list calls, not necessarily one per logical SysEx), lead17,283–26,885.6us, expired/full/invalid/native late/error counters0, worker diagnostic interval iterations499–508. Future-event timestamps explain lead beyond20ms: latency is20ms after the event timestamp, not after the worker wake. CoreMIDI lead is measured immediately before API entry and does not measure physical wire delivery jitter. The additional output reconnect means this intervention includes restoration of real MIDI traffic, so results cannot isolate polling rate alone.
Measured22:19:31.938–22:34:31.948 PDT (900.011seconds). Recording and all diagnostic prefixes/archive completed successfully. User requested app stop during analysis: verified process31189 exited22:54:13.426; passive cooling, no thermal override. No new test queued.
| Measure | Previous single-start trial | Scheduled MIDI + reconnect trial |
|---|---|---|
| Duration | 15minutes | 15minutes |
| Thermal during measurement | All nominal | All nominal (83,891callbacks) |
| MAYA0x82 transaction errors | 22 | 32 |
| HAL IO restarts | 20 | 32 |
| Native callback gaps >20ms | 20 | 32 |
| Long analog dropouts | 20 | 32 |
| Repeating near-flat burst | None detected | 15.78seconds |
| Strict short candidates outside burst | 24 | 32 |
| Native callback processing overruns | 0 | 0 |
All32 transaction errors match32HAL restarts,32native gaps (162.19–178.33ms), and32analog dropouts (166.54–180.94ms). Alignment uses ordered events and a fitted analog end-edge offset; residuals -16.95 to+10.11ms. This does not establish microsecond causal ordering. Native callback processing3.787/4.142/4.544/4.711ms (min/median/p99/max) versus10.667ms budget. All measured callbacks48k/512; no lock/callback/return-status faults, diagnostic losses, or app AudioUnit/session reinitialization events during measurement.
The separate repeating burst is approximately22:23:36.008–22:23:51.788.1,264 strict short plateaus cluster there, plus32 isolated candidates elsewhere. Visual inspection confirms abrupt bilateral flattening. Early spacing is about10.667ms, exactly512/48000; missing portions grow from roughly1.75ms median to over4ms, with maximum individual detected width7.48ms and roughly43percent flat fraction in the worst one-second bin, then recover. Later pattern becomes more complex; do not report a constant period throughout. Across the burst,1,478native callbacks continued, intervals10.504–11.542ms, processing3.903–4.633ms, zero native faults, zero USB transaction/restart logs, and zero late-MIDI diagnostic increments. Thus the periodic symptom does not require the long-gap/restart mechanism; a shared underlying timing failure remains possible. No outgoing PCM was captured in this run; earlier pristine internal recording/pure-tone findings remain evidence and are not contradicted.
Actual native MIDI submissions remained active after one startup WRLD.BLDR reconnect; no further connection-removal count increase. Between first/last in-window one-second snapshots,134,440scheduled and124,579immediate native packet/list calls;0CoreMIDI API errors,0queue overflow,0invalid routes,0late rejection at final API boundary. Worker448,443iterations/899seconds (~499/s), around20times fewer wakeups than the old100us loop. Therefore the old MIDI polling rate is not necessary for either symptom under this workload. This is not a clean rate-effect comparison because output reconnection restored verified traffic, while older handoff counters do not establish bus delivery. IO worker still uses100us polling.
The new late-drop policy rejected10,582basic MIDI messages. All positive one-second increments are close to gap recovery (roughlywithin3seconds; timestamps rounded). This is consistent with SampleTimer::StartFrame slowly rebasing timestamps by1percent per callback: after~160ms missing audio time, the estimate remains more than20ms behind for about2.2seconds. Worker continues~500iterations/s, and queued overflow stays0. Strongly suggests stale producer timestamps after recovery rather than a backed-up worker. It is a separate recovery defect exposed by the new scheduling policy; these late drops do not precede the first audio failure or occur during the periodic burst. No new fix was applied during analysis.
Raw results: /private/tmp/smartgrid-midi-scheduled-trial-20260911/result.json; burst details burst-analysis.json; reviewed plots analog-analysis/burst-detail.png, short-review.png, overview.png. The32long correlations are recorded individually in result.json. Threshold counts are detector-specific; representative samples and burst windows were visually reviewed, not every one of1,296short detections. Slower scheduled MIDI has not fixed either audio symptom. A single run with32versus20events does not establish worsening from this change.