Skip to content

feat(player): independent KEY/TEMPO with real native worker DSP and per-song stage controls - #496

Merged
masarray merged 3 commits into
mainfrom
feature/arson-player-m2-independent-key-tempo-20261109
Nov 9, 2026
Merged

masarray merged 3 commits into
mainfrom
feature/arson-player-m2-independent-key-tempo-20261109

Conversation

@masarray

@masarray masarray commented Nov 9, 2026 •

Copy link
Copy Markdown
Owner

ArSon Player M2 — independent music KEY + TEMPO (native worker DSP)

M1 is already merged: #486, main d46aaa6b18ce94f5908c5db4f33ccba7d69947b4, with exact-SHA Windows FAT and Chromium PASS. This PR is a separate real product milestone, based on that verified main.

User workflow: open original compact ♫ Player drawer in the one approved /preview/ mixer; use tiny KEY −/+ semitone and TEMPO −/+ 5% controls, or Reset. Music playback follows those native commands while microphones, FX, device clock and mixer WIRE/MAIN are untouched. Per-song values survive reopen in atomic player-library.json v2, with safe migration from M1 v1. No Lab/checkbox/second audio engine or UI-only pitch sliders.

Native architecture

  • MIT-licensed Signalsmith Stretch 1.3.2 + Signalsmith Linear, vendored from pinned upstream source SHAs with complete license notices. Offline FFT/time-stretch only in NativePlayerDeck decoder worker, never inside JUCE device callback.
  • Backing stereo PCM first resampled to output device rate, then worker applies independent semitone transpose -6…+6 and tempo 80–120%. Same linked stereo DSP, no microphone processing. Default 0/100 is a direct bit-accurate bypass of FFT.
  • Bounded source and output chunks; once decoder is ready, playback uses existing single SPSC ring into ChannelId MUSIC/FX/WIRE/MAIN. Atomic packed KEY+TEMPO pair prevents torn cross-thread gestures.
  • Flushes spectral tail at end, dynamically estimates output duration, and keeps hardware restart/first-sound safeguards and operator MAIN MUTE.
  • Compact panel added to existing loaded approved GUI CSS/JS, preserving the approved HTML and no WebAudio.

Tests included

  • tests/player_pitch_tempo_test.cpp: sine 440Hz, +3st/80%, -2st/120%, output-duration ratio, opposite-phase stereo coherence, invalid control rejection and neutral bypass.
  • tests/player_native_decode_test.cpp: real JUCE WAV→device resampler→M2 Signalsmith→ring→audio pull, worker readback, fail-closed control ranges, stop/restart and unchanged device rate.
  • tests/approved_preview_mobile_navigation_smoke.py: compact controls at multiple phone widths, public preview never pretends it has an audio backend.
  • Existing M1 SRC ONLY, WIRE, native session, ring and all global mixer CTests must remain green.

Status: implementation commit 4a1550f5f0f088ffd84669823771d5b48cb2d2a7; DRAFT pending exact-SHA selective Chromium and Windows MSVC/CTest verification. Physical ASIO/OBS listening and precise quality on real songs remain PENDING. Do not claim released M2 until tests and user FAT pass.

CI cost discipline: fast Linux checks on PR push; then one ui plus one fat run (fat already includes native). Never auto-merge or deliver an unverified installer.

Selective verification checkpoint

M2.1 audit: live-control response — 7aa88469dfda710df0e1dc1903ac4d5bb0b9d19a

  • Root risk found: the original worker filled ~750 ms of music before observing new KEY/TEMPO commands. This could make stage adjustments appear slow and fully predecode short songs before the user could edit them.
  • Adjusted the worker-only high-water mark to ~250 ms at current device sample rate (with the fixed bounded FIFO capacity unchanged). No ASIO callback, mic FX or output device code changed.
  • Extended actual native WAV decode integration with an 8-second 44.1-kHz stereo track → 48-kHz device-rate PCM. The test requests +3st/80%, -2st/120%, then neutral 0st/100% while playing; asserts no song-generation restart, same physical rate, finite stereo PCM and applied worker ACK; never calls Stop/Play between changes.
  • Previous exact source 4a1550f qualified 71/71 MSVC CTest, exact Chromium full GUI PASS and both Windows artifacts; those artifacts are not the new source. On 7aa88469dfda710df0e1dc1903ac4d5bb0b9d19a, fast native PASS, one Windows FAT requalification run #42632644114 in progress; full Chromium not re-run because approved GUI/CSS/JS unchanged.
  • Physical ASIO backing-track listening, audible transient quality at live KEY/TEMPO switches, OBS/secondary stream and 30-minute soak remain PENDING and must not be described as certified. This PR remains preview-only until the exact-SHA FAT passes.

M2.2 — singer-ready queued-song presets (30de4b8)

  • Audited workflow defect: when CURRENT A played and NEXT B was selected, +/- KEY or TEMPO previously edited CURRENT A and its DSP. This is undesirable during live singing.
  • Fixed in policy and native dispatcher: SetlistPolicy::pitchTempoTarget distinguishes selected next song from the active native deck. A queued B adjustment updates only B's versioned, crash-safe saved preset; it cannot retune CURRENT A. Switching to B later installs B's controls before decode; selecting CURRENT A applies changes to A's live worker.
  • GUI: edit target follows selected setlist row; compact KEY/TEMPO controls clearly associate with NEXT through accessible context/hover description. One approved GUI, no second DSP callback.
  • Native fixture: selected next, active current, invalid selection and no-current cases; no half-applied pitch changes. PR push Fast UI + Windows Native PASS.
  • Full Chromium: run #42634903690 dispatched for the changed GUI; status to confirm.
  • FAT resource discipline: earlier source 7aa88469 run #42632644114 is already building Windows. Do not trigger an overlapping FAT. The NEW source 30de4b81e697eeea0c2548e7fb7757ddd650e33d requires one additional exact-SHA Windows qualification after the former run completes; prior artifacts do NOT qualify this commit.
  • Physical ASIO/OBS listening: PENDING; M2 remains DRAFT, not a general release.

Exact-SHA M2 final qualification — 30de4b8

  • Current PR HEAD 30de4b81e697eeea0c2548e7fb7757ddd650e33d — source contains M2.1 live change and M2.2 NEXT song preset isolation.
  • Native fast checks PR #496 checks: PASS.
  • Full Chromium at exact HEAD: run #42634903690 PASS.
  • Previous Windows FAT #42632644114 PASS 71/71 CTest and two complete Preview artifacts, but belongs to earlier 7aa88469 source.
  • NEW Windows FAT run #42655144752 dispatched for 30de4b81e697eeea0c2548e7fb7757ddd650e33d once; job is IN PROGRESS. It replaces (not duplicates) a native MSVC lane. No merge until exact source has completed SUCCESS and installer/FAT artifact integrity is verified.
  • Other team's first-launch P0 first-launch: genuine SOURCE NONE ChannelId mixer, zero-capture output-only FX workspace #491 remains a separate unmerged PR. Scope-overlapping files: src/Main.cpp, src/LiveAudioEngine.h, CMakeLists.txt; no blind overwrite.
  • ASIO hardware microphone/music listening, change-transient perception, output recovery and OBS loop remain PENDING; CI is not hardware FAT.

masarray commented Nov 9, 2026

Copy link
Copy Markdown
Owner Author

/arsonmix-ci ui 4a1550f

masarray commented Nov 9, 2026

Copy link
Copy Markdown
Owner Author

/arsonmix-ci fat 4a1550f

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Nov 9, 2026 •

Copy link
Copy Markdown

Deploying arsonmix with  Cloudflare Pages  Cloudflare Pages

Latest commit: 30de4b8
Status: ✅  Deploy successful!
Preview URL: https://59d61fad.arsonmix.pages.dev
Branch Preview URL: https://feature-arson-player-m2-inde.arsonmix.pages.dev

View logs

masarray commented Nov 9, 2026

Copy link
Copy Markdown
Owner Author

/arsonmix-ci fat 7aa8846

masarray commented Nov 9, 2026

Copy link
Copy Markdown
Owner Author

/arsonmix-ci ui 30de4b8

masarray commented Nov 9, 2026

Copy link
Copy Markdown
Owner Author

/arsonmix-ci fat 30de4b8

@masarray
masarray marked this pull request as ready for review November 9, 2026 16:47
@masarray
masarray merged commit 9bd81a1 into main Nov 9, 2026
13 checks passed
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 9, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-09T16:49:27.083658Z 30de4b8 Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 30de4b81e6

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +70 to +75
if(!active()) {
if(nInput!=nOut)return false;
std::copy_n(in[0],nOut,out[0]);
std::copy_n(in[1],nOut,out[1]);
} else {
stretch_.process(in,nInput,out,nOut);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Synchronize DSP history when entering or leaving neutral bypass

When a performer resets KEY/TEMPO to 0/100 during playback, this branch stops advancing the stretcher but leaves its buffered audio intact. Applying another non-neutral setting later resumes that old history rather than the current song position, replaying earlier audio; entering DSP from an initially neutral song also starts with an unprimed buffer. A standalone reproduction using this processor produced substantial old-tone output after processing one second of silence through neutral bypass. Keep the DSP history synchronized or explicitly re-prime it and handle the latency transition when switching paths.

Useful? React with 👍 / 👎.

Comment on lines +362 to +367
const int tail=pitch.outputLatency();
if(tail>0 && tail<deviceHz*2) {
juce::AudioBuffer<float> ending(2,tail);
float* const ends[]={ending.getWritePointer(0),
ending.getWritePointer(1)};
pitch.flush(ends,tail);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Include analysis latency when draining the song ending

For non-neutral playback, the stretcher is fed from its initial empty state without an outputSeek pre-roll, so pending audio includes both input analysis latency and output synthesis latency. Draining only outputLatency() truncates the ending before setting EOF. At 48 kHz the configured library reports 2,400 input-latency frames and 4,320 output-latency frames; a reproduction at 80% tempo with audio confined to the last 512 source frames yielded energy of only 0.67 with this drain, versus 51.90 when the additional 3,000 tempo-adjusted input-latency frames were drained. Account for the full processing delay, or prime and compensate it explicitly, so backing tracks retain their final notes.

Useful? React with 👍 / 👎.

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