Skip to content

DRAFT Harmonice P1 CPU — sample-exact PSOLA epoch scan and same-runner tail profiling - #515

Closed
masarray wants to merge 5 commits into
experiment/harmonice-p1-latency-audit-20261110from
experiment/harmonice-p1-exact-epoch-walk-20261110
Closed

masarray wants to merge 5 commits into
experiment/harmonice-p1-latency-audit-20261110from
experiment/harmonice-p1-exact-epoch-walk-20261110

Conversation

@masarray

Copy link
Copy Markdown
Owner

P1 CPU milestone, isolated from active routing/ASIO

Stacked on #514 (offline latency) → #509 (Windows 80/80 P0 Harmony fixes) → main. Keep draft, do not merge or change default DSP latency until acoustic and full native gates.

Exact-output optimization

Current PitchSynchronousVoice::findPositiveEpoch() rescans a bounded source window for every scheduled voice grain, using repeated 64-bit time-t and ring-index arithmetic. Adjacent time positions map to adjacent ring slots. After computing the FIRST ring index, advance one ring slot per candidate; preserve every input sample, comparison order, strict greater-than tie rule, absolute source epoch, threshold and scheduling. No different source samples, no resampling interpolation, no tonal/phase policy change.

A compile-time FastEpochWalk=false instantiates the historical reference exclusively for offline A/B. The production template defaults to the cursor path with no runtime mode, mutex, IO, heap allocation, SPSC transaction, driver change or extra FX owner.

Safety and evidence

  • Extend the native PSOLA test to compare exact output samples at 48k/96k/192k and soprano/low-male pitches against historical epoch walk, in addition to callback 64/257 partition parity and shifted pitch measurement.
  • Add same-runner reference-versus-cursor PSOLA-only benchmark for sustained low male 82.4Hz and A3 220Hz, 48/96k, 64-frame callbacks, five voices: p50/p95/p99/p99.9/max, with checksum equivalence. Timer stays outside source PCM synthesis.
  • Hook into existing cheap Harmony fast CI and existing CMake CTest. No separate workflow or expensive build dispatch.
  • CPU figures are synthetic PSOLA-only, not total Harmony/mixer/Windows ASIO/XRUN evidence. Reject if any exact PCM mismatch or repeatable adverse callback-tail behavior.

Release/parallel-thread guardrails

PR #512 modifies native Harmony preparation and FX bypass tests; this PR modifies NONE of those. ChannelHarmonyProcessor, audio callback authority, DeviceSession/WIRE/Player/Compressor/Vocal Throw/editor/.smix untouched. Vocal Throw sound is still a separate blocked workstream. Physical singer/no-XRUN/audio quality remain unverified.

No automatic merge or production release.

Copy link
Copy Markdown
Owner Author

Decision — REJECT candidate (2026-11-10), keep original production scan

Exact head 1d98023e011be4bf54ccf671c975c7a84ff2449b Linux fast run #42753702439 PASS with sample-exact legacy/cursor PCM. Same-runner PSOLA-only 5 voice/64-frame benchmark:

rate / f0 baseline p95 (us) cursor p95 (us) baseline p99.9 (us) cursor p99.9 (us)
48k / 82.41Hz 9.78 10.03 26.18 29.05
48k / 220Hz 9.25 9.28 28.29 17.62
96k / 82.41Hz 10.63 11.14 20.13 17.21
96k / 220Hz 9.51 9.71 17.65 16.97

Optimized candidate was slower at all measured p50/p95, and mixed at p99.9. A synthetic same-runner microbenchmark does not justify adding complexity or altering the production pitch-synchronous implementation. Close without merge. Keep #514 P1 latency study isolated and retain #509 P0 reliability evidence. Do not assume Windows ASIO/no-XRUN qualification.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant