From 4f5a1bc42af95c8aeef46860afbcd0cda893f6cd Mon Sep 17 00:00:00 2001
From: nottbradd <191980334+nottbradd@users.noreply.github.com>
Date: Mon, 16 Nov 2026 20:34:47 +1100
Subject: [PATCH 1/6] Add silent cursor startup and calibrate interaction audio
---
INTERACTION.md | 6 +-
VALIDATION.md | 38 ++-
docs/STARTUP_AUDIO.md | 61 ++++
docs/USER_GUIDE.md | 2 +
package-lock.json | 4 +-
package.json | 2 +-
scripts/audio-audition.mjs | 32 ++
scripts/audio-validation.mjs | 395 ++++++++++++++++++++----
scripts/record-startup.mjs | 208 +++++++++++++
scripts/startup-fixture.tsx | 33 ++
scripts/startup-validation.mjs | 382 +++++++++++++++++++++++
scripts/swarm-release.mjs | 172 +++++++++++
src-tauri/Cargo.lock | 2 +-
src-tauri/Cargo.toml | 2 +-
src-tauri/src/lib.rs | 3 +
src-tauri/src/startup.rs | 59 ++++
src-tauri/tauri.conf.json | 2 +-
src/App.tsx | 32 +-
src/components/EditorPanel.tsx | 4 +-
src/components/Graph.tsx | 131 ++++----
src/components/Preferences.tsx | 14 +
src/components/Sidebar.tsx | 20 +-
src/hooks/useWorkspace.ts | 8 +-
src/interaction/audio.ts | 84 ++++-
src/interaction/events.ts | 9 +-
src/interaction/interaction.test.ts | 6 +-
src/interaction/note.ts | 6 +-
src/interaction/preferences.ts | 11 +-
src/interaction/signals.ts | 3 +-
src/interaction/soundLevels.ts | 12 +
src/startup/controller.ts | 457 ++++++++++++++++++++++++++++
src/startup/geometry.test.ts | 33 ++
src/startup/geometry.ts | 134 ++++++++
src/startup/overlay.tsx | 71 +++++
src/startup/startup.css | 107 +++++++
src/startup/useStartup.ts | 15 +
36 files changed, 2375 insertions(+), 185 deletions(-)
create mode 100644 docs/STARTUP_AUDIO.md
create mode 100644 scripts/audio-audition.mjs
create mode 100644 scripts/record-startup.mjs
create mode 100644 scripts/startup-fixture.tsx
create mode 100644 scripts/startup-validation.mjs
create mode 100644 scripts/swarm-release.mjs
create mode 100644 src-tauri/src/startup.rs
create mode 100644 src/interaction/soundLevels.ts
create mode 100644 src/startup/controller.ts
create mode 100644 src/startup/geometry.test.ts
create mode 100644 src/startup/geometry.ts
create mode 100644 src/startup/overlay.tsx
create mode 100644 src/startup/startup.css
create mode 100644 src/startup/useStartup.ts
diff --git a/INTERACTION.md b/INTERACTION.md
index f971692..9a64a33 100644
--- a/INTERACTION.md
+++ b/INTERACTION.md
@@ -30,9 +30,11 @@ Rust's canonical extraction pass supplies every recognised occurrence and its UT
## Audio lifecycle and preferences
+Version 0.7 adds the independent, silent cursor startup controller and calibrates the complete sound output path. See [startup integration, marker inventory, gain staging and measurements](docs/STARTUP_AUDIO.md). The process-lifetime Rust claim prevents frontend reloads from replaying the intro; readiness, effective motion and first-interaction cleanup are separate from graph navigation.
+
Feedback accepts successful typed interactions with semantic role, bounded focus level and canonical identity. It lazily creates one AudioContext after a trusted gesture. Performance timestamps map to the audio clock; events over 80 ms stale are dropped. Native focus and document focus independently gate audio. Typing, hover and startup never sound.
-NoteSynth creates original additive sine voices; note.ts centralizes the consonant pitch family and identity mapping. Subnetworks use C4/D4/E4/G4 with a 300 ms warm body; topics use C5/D5/E5/G5 with a 235 ms body; concepts use C6/D6/E6 with a 170 ms lighter body. Repetition varies detune within ±1.5 cents, attack 2.5–4 ms and level by at most 4%, without changing the fundamental pitch choice. Higher registers have lower gain. Back/close use short quiet envelopes; only three especially quiet neighbour arrivals are scheduled from shared signal timestamps.
+NoteSynth creates original additive sine voices; note.ts centralizes the consonant pitch family and identity mapping. Subnetworks use C4/D4/E4/G4 with a 300 ms warm body; topics use C5/D5/E5/G5 with a 235 ms body; concepts use C6/D6/E6 with a 170 ms lighter body. Repetition varies detune within ±1.5 cents, attack 2.5–4 ms and level by at most 4%, without changing the fundamental pitch choice. Higher registers have lower gain. A cached, original band-passed noise contact ends after its 3.5 ms envelope without ending the tone. Back/close use short quiet envelopes; only three subordinate neighbour arrivals are scheduled from shared signal timestamps.
VoiceBudget reserves real intervals, caps overlap at six and applies a 60 ms identical-contact gate. Direct actions may evict low-priority arrivals. Every oscillator, gain, filter and panner disconnects after completion or cancellation. Native blur cancels queued audio, with no replay on refocus. A compressor feeds a soft limiter and conservative master. OfflineAudioContext renders the real production graph for clipping/polyphony/cancellation tests; actual application captures tap the live output without a microphone.
@@ -73,4 +75,4 @@ Quiz marking, card publication and scheduling are local Rust operations. The sch
## Current release verification
-scripts/depth-desktop.mjs inspects the real development WebView with temporary synthetic files, real Rust commands and development-only instrumentation. It tests direct Canvas navigation, exact Back framing/layout, dirty edits, interrupted note loads, Reduced mode, deleted focus, small windows, 90 additional backlinks, duplicate subject UUIDs and idle rendering. No provider requests or production test globals are used. scripts/audio-validation.mjs renders all three real synthesized registers at 69% and 100% volume. Installed-app capture and release results are documented in VALIDATION.md.
+scripts/depth-desktop.mjs inspects the real development WebView with temporary synthetic files, real Rust commands and development-only instrumentation. It tests direct Canvas navigation, exact Back framing/layout, dirty edits, interrupted note loads, Reduced mode, deleted focus, small windows, 90 additional backlinks, duplicate subject UUIDs and idle rendering. No provider requests or production test globals are used. scripts/audio-validation.mjs renders all three real synthesized registers at 35%, 69%, 70%, 100% and zero volume, including mute, arrival balance and source/node cleanup. scripts/startup-validation.mjs covers the shared startup controller's lifecycle; scripts/record-startup.mjs records fresh installed launches, and scripts/swarm-release.mjs verifies the packaged settings, nested navigation and live sound. Installed-app capture and release results are documented in VALIDATION.md.
diff --git a/VALIDATION.md b/VALIDATION.md
index af3239b..158d0d5 100644
--- a/VALIDATION.md
+++ b/VALIDATION.md
@@ -1,4 +1,38 @@
-# Synapse 0.6.0 validation
+# Synapse validation
+
+## 0.7.0 — 16 November 2026
+
+The installed production build adds the silent cursor-swarm startup and calibrates the original static chimes. All new desktop checks used temporary synthetic vaults. There were no live OpenAI requests, hosted-policy edits, repository visibility changes or new dependencies. The original vault selection, Personal AI selection, consent state, device settings and exact saved preference record (Full animations and 69% volume) were restored. The installed app was restarted normally without a debugging port.
+
+| Check | Result |
+| -------------------------------------------------------- | ----------------------------------------------------- |
+| TypeScript typecheck and ESLint | Passed |
+| Frontend tests | 75 passed |
+| Rust tests | 47 passed; one explicit live-provider test ignored |
+| Rust formatting and Clippy, all targets, warnings denied | Passed |
+| Hosted gateway | 22 local D1 tests passed with a mocked provider |
+| Startup lifecycle in Chromium | 27 cases passed |
+| Production audio graph | 150 OfflineAudioContext cases passed |
+| Production build and NSIS installation | Passed; installed payload hash verified |
+| Installed startup, nested navigation, settings and sound | Passed; real WebView footage and live output captured |
+
+Startup coverage includes Full, Reduced, Follow Windows, the independent checkbox, slow restoration and fonts, pointer/keyboard/touch/wheel/focus interruption, resize, DPR, late fonts/layout, modal/editor precedence, unmount, real React Strict Mode, background/hidden launch, native focus without a DOM focus event, once-per-launch, unavailable storage, induced failure and the CSS safety reveal. First-interaction handlers observed zero hidden regions and zero overlays without event prevention or replay. The fallback test deliberately stopped JavaScript cleanup and verified compositor visibility; a blocked renderer cannot execute a JavaScript deadline.
+
+The fresh installed launch with a restored vault selected 12 actual UI targets and completed in **1054.9 ms** from its accepted first foreground frame. The genuine no-vault welcome selected three eligible targets and completed in **1054.8 ms**. Both created zero AudioContexts, removed all hidden attributes/overlays and declined a replay after frontend reload. Actual native focus was established by the owner's Alt+Tab. The clips preserve original compositor timing, with a short hold of the final unchanged frame; no motion frames are interpolated. The GIF is a smaller 25 fps review copy. The measured times include preparation and remain below the 1200 ms deadline.
+
+The full audio matrix covers subnetwork/topic/concept at 35%, 69%, 70%, 100% and zero volume, including selection, individual arrival, three neighbours, dense overlap, cancellation before and during playback, mute, stale events, disposal and gating. The reference floors at 70% remain −20 dBFS peak for selection and −40 dBFS for individual arrivals. Individual arrivals stay below 70% of corresponding selection peaks and three simultaneous neighbours below 120%. The highest sample peak across all cases was **0.235457**, below the 0.241 bound. Samples were finite, silent cases were zero, tails cleared, reservations/voices ended, every instrumented node connection was released on disposal and one contact-noise buffer was cached per context. The contact's completion did not truncate the tonal body.
+
+[Startup integration, marker inventory and before/after audio measurements](docs/STARTUP_AUDIO.md) document the production path, active-window RMS, decay and spectrum. The static/glide comparison is matched by active-window RMS, within 0.000001 dB for the reference files. The owner rated the static cues **“Clear and comfortable.”** Static pitch remains the production default; the 12 ms / 25-cent glide exists only in the audition renderer. Speaker frequency response was not measured.
+
+Installed regression checks covered overview → subnetwork → topic → linked concepts and Back, saved volume, startup checkbox persistence, explicit Full overriding emulated OS reduction, Follow Windows respecting it, and reload without startup replay. Every settled Back canvas at the established 1600×1000 test viewport matched exactly. An additional native 1440×900 comparison differed at 36 of 1,296,000 pixels by at most one 8-bit channel step; this is a recorded rendering tolerance, not an exact-image pass at that viewport. No renderer errors occurred.
+
+The 12.82-second sound video uses the real app's output at 69% volume and 660 delivered compositor frames plus a final held-frame timestamp. All eight primary cues are present in the source and muxed audio. Their threshold onsets are 24–86 ms after the harness's pre-click markers; those markers precede Playwright's click dispatch, so this is not an input-latency measurement. Encoding preserves frame timestamps within 0.819 ms; source and muxed cue onsets match at the 5 ms analysis resolution. Actual capture cadence during the transitions was approximately 82–96 fps on this host, not a hardware-independent guarantee.
+
+The unsigned NSIS installer SHA-256 is `caaacb2d5b60e077265c384ec45372762b2da18b4cc0e1f669a4b13ed6f80f8d`. Its installed executable SHA-256 is `0e8c7f33bbcc177a58254a374794860a77963a88a5439c3a3bd6754868d3f548`, matching the extracted installer payload. GPL v3, copyright and complete third-party notices are installed. This update is built and installed locally; it does not publish a new GitHub release.
+
+Local evidence is excluded from Git: `.local/startup-0.7.0/browser-report.json`, `.local/sound-0.7.0/{before,after}/mix-report.json`, the matched comparison WAVs, `.local/release-0.7.0/{startup-cold,startup-welcome}/report.json`, installed regression/restoration reports, media validation and the actual MP4/GIF/WAV files. The tested host is Windows 11 Pro 10.0.26300. Windows 10 and physical multi-monitor DPI switching remain untested; DPR and OS motion changes were exercised through controlled browser emulation. The installer remains unsigned.
+
+## 0.6.0 — previous release
Validation uses temporary synthetic vaults. No new live provider generation is performed for this release. The existing hosted service and Calendar remain unchanged.
@@ -11,7 +45,7 @@ Validation uses temporary synthetic vaults. No new live provider generation is p
| Hosted gateway | 22 local D1 tests passed with a mocked OpenAI provider |
| Production audio | 54 OfflineAudioContext cases passed across three registers at 69% and maximum volume |
| Development desktop | Real Rust/WebView checks passed; details below |
-| Production build, NSIS installation and installed recording | Passed; publication awaits the history cleanup decision |
+| Production build, NSIS installation and installed recording | Passed; history cleanup and clean public release subsequently completed |
Desktop coverage includes overview/subnetwork/topic entry via the real Canvas, canonical linked notes, unchanged review scope, exact Back camera/layout/selection/drawer width/editor mode, close preserving scope, dirty-note cancel/discard, rapid retargeting, Reduced mode without packets, empty/deleted notes, 900×600 uncovered positioning, idle suspension, 90 real new backlinks and duplicate Physics subjects under distinct Neurons. No renderer errors occurred in the completed run.
diff --git a/docs/STARTUP_AUDIO.md b/docs/STARTUP_AUDIO.md
new file mode 100644
index 0000000..3d2de83
--- /dev/null
+++ b/docs/STARTUP_AUDIO.md
@@ -0,0 +1,61 @@
+# Startup and sound — 0.7.0
+
+The startup is a silent, disposable presentation layer. It never unlocks audio, changes a note, invokes AI, moves a graph node or takes native focus. `useWorkspace.initialReady` distinguishes restoration from a genuine welcome screen; a slow restore continues normally after the intro gives up.
+
+## Integration and timing
+
+`src/startup/geometry.ts` batches viewport bounds and font reads, filters targets and segments Unicode graphemes. `overlay.tsx` renders six existing Lucide cursors and creates text through `textContent`. `controller.ts` owns one elapsed-time RAF, observers, cancellation and cleanup. `useStartup.ts` connects readiness, modal state and the existing effective motion preference. The optional graph marker covers the actual Canvas surface, with a construction rectangle clipped to its usable area; no DOM graph reconstruction or extra graph engine is involved.
+
+The shared clock starts on the first eligible foreground frame. Preparation is capped at 230 ms, gathering takes 120 ms, construction finishes at 950 ms and exit at 1050 ms. A 1200 ms timer is the final deadline. Preparation, including overlay construction, is charged to that budget. CSS independently reveals affected regions within at most 1180 ms and hides the overlay by 1150 ms if the controller stops running. As with any browser timer, JavaScript cannot execute during a blocked renderer; the compositor fallback limits visual concealment independently.
+
+Capturing pointer, keyboard, touch, wheel or meaningful focus events synchronously removes concealment without cancelling the event. Modal/editor precedence, unmount, backgrounding, resize, DPR, late fonts, actual application layout shifts and errors use the same cleanup path. Only the intro's attribute is restored; existing styles remain owned by the application. The overlay is `aria-hidden`, has no focus targets and uses `pointer-events: none`.
+
+`src-tauri/src/startup.rs` creates a UUID and atomic one-use claim for the native process. Hidden/minimised/unfocused windows cannot consume a claim. Guarded session storage and a singleton provide additional frontend protection, including unavailable storage, HMR and Strict Mode. React 19's pre-animation mount probe can reattach without resetting the original clock or making another claim. Full animations override the OS reduction preference; Reduced and the new Startup animation checkbox skip the effect without replaying it later in the same launch.
+
+## Marker inventory
+
+Snapshot selection aims for 12 targets, never more than 15. It rejects hidden, offscreen, zero-size, sensitive and actively edited regions and overlapping ancestor/descendant targets.
+
+| Location | Markers |
+| --------------- | ----------------------------------------------------------------------------------------------------------------------------------------- |
+| Sidebar | Brand, collapse control, vault heading, search, new note, navigation, organization actions, footer; compact rail replaces expanded groups |
+| Graph | One Canvas surface (`graph`), overview heading (`text`), scope count and graph controls (`box`) |
+| Welcome | Mark, Synapse heading (`text`), Open vault and Preferences buttons |
+| Existing drawer | Header and toolbar chrome only; editor/note bodies are never reconstructed |
+
+Only short interface headings use the text effect. User topic titles use a box. The semantic heading stays intact beneath an inaccessible decorative copy.
+
+## Production gain policy
+
+The signal path is event level × material level × register gain × quiet-cue policy, followed by a tone envelope/filter or the short contact envelope/filter, then common stereo pan → compressor → soft limiter → master × saved user volume.
+
+- Primary selection event: 0.8; selection material: 1.
+- Arrival event: 0.35; arrival material: 0.8. The former extra 0.6 quiet attenuation is removed for arrivals. Dismissal/error cues retain their softer policy. Only three neighbours are scheduled; follow relays retain their 0.07 event level. Existing 60 ms identity gates, 80 ms stale rejection, six-voice budget and cancellation remain.
+- Register gains: 0.39 / 0.38 / 0.36, with existing bounded 4% variation. Body durations remain 300 / 235 / 170 ms. Arrival bodies are capped at 100 ms. Static identity-derived pitches and ±1.5-cent repetition variation remain.
+- Low-register partials: fundamental 1, second 0.3, third 0.15, fourth 0.012. Upper registers keep their restrained original partials.
+- Original deterministic noise: one cached 8 ms buffer per context, band-pass centre 3200 Hz, Q 0.8, relative contact gain 0.12, 0.4 ms attack and zero by 3.5 ms. It shares voice level, panning and every output control. Only the tonal source ends the complete voice; ending the contact cannot disconnect the body.
+- Compressor: −16 dB threshold, 4 dB knee, 3:1 ratio, 1 ms attack, 45 ms release. Tanh ceiling 0.32, master 0.75. The maximum-volume output bound remains 0.241 sample amplitude. Zero/mute immediately sets the output to zero and cancels active sources.
+- New profiles default to 70%. Existing valid settings, including 69%, low values and zero, are read unchanged and are not rewritten on load. The schema remains v1; a missing `startupAnimation` means enabled.
+
+## Measurements and audition
+
+The reference node is `preferences-preview`, using actual shared production event levels, centre pan, 48 kHz stereo OfflineAudioContext and the complete output bus. Both columns use 70% so the comparison does not conflate the new-profile default with synthesis changes.
+
+| Cue | Before peak / active RMS, dBFS | After peak / active RMS, dBFS | After 20 dB decay |
+| --------------------------------- | ------------------------------ | ----------------------------- | ----------------- |
+| Subnetwork select | −20.36 / −30.15 | −17.98 / −28.02 | 170 ms |
+| Topic select | −22.13 / −32.39 | −19.07 / −28.91 | 125 ms |
+| Concept select | −25.00 / −35.55 | −19.47 / −29.49 | 95 ms |
+| Concept arrival (production role) | −53.03 / −61.77 | −26.18 / −34.78 | 90 ms |
+
+Active RMS uses the contiguous non-silent window above 1e−6, measured in one of the identical centre-pan channels. Decay uses 5 ms peak blocks. FFT bands are 0–500 / 500–2000 / 2000–6000 / 6000–24000 Hz. The subnetwork's 500–2000 Hz energy rises from 0.405% to 8.47%, while 91.52% remains below 500 Hz. The report includes all bands for every reference cue. These digital measurements are not a laptop-speaker frequency-response measurement.
+
+Accepted fixed-reference floors are −20 dBFS peak for selection and −40 dBFS for individual arrivals at 70%; low user volume is deliberately exempt. Individual arrivals must stay below 70% of the corresponding selection peak, and a worst-case three-neighbour overlap below 120%. Floors were preserved when initial tuning failed. The owner listened to the matched comparison on 16 November 2026 and rated the static cues **“Clear and comfortable.”**
+
+The audition-only 25-cent rise reaches normal pitch in 12 ms. It is injected by the test renderer and matched to each static cue's active RMS; there is no production glide setting or second musical note. `scripts/audio-audition.mjs` assembles static-then-glide pairs in subnetwork/topic/concept order, plus same-volume before/after selection/arrival examples.
+
+## Reproduce
+
+Run `node scripts/startup-validation.mjs` for browser lifecycle tests, including real React Strict Mode. `node scripts/audio-validation.mjs` renders production audio and writes metrics/WAV files; `--baseline` is for measuring the prior mix before editing, not for bypassing release checks. Then run `node scripts/audio-audition.mjs`.
+
+Installed capture uses `scripts/record-startup.mjs` against a fresh process and a disposable vault. By default it starts the app hidden, begins compositor capture, and invokes the existing single-instance foreground path. `--visible` launches normally; `--existing` attaches to an already prepared fresh process. Windows must actually grant foreground focus before the effect can run. The completed recordings used the owner's Alt+Tab because the automation helper could not establish native foreground focus. The script records actual packaged UI, source timestamps, native version/focus, silence, cleanup and a same-process reload with no replay. A rejected foreground claim does not start the accepted timeline; footage uses the completed measurement's start time. Preparation requires a backup of device preferences and vault selection; restore them after testing. The debug port is a temporary testing environment variable and is never enabled by the installer. Native footage and machine-readable evidence remain under ignored `.local/`.
diff --git a/docs/USER_GUIDE.md b/docs/USER_GUIDE.md
index 65ee0f4..3be3f6d 100644
--- a/docs/USER_GUIDE.md
+++ b/docs/USER_GUIDE.md
@@ -80,6 +80,8 @@ One critically damped controller moves the drawer, camera and logarithmic zoom t
Preferences contains persistent Animations, Sound and Volume. Animations defaults to **Follow Windows**: disabling Windows animation effects makes camera and panel changes immediate. Choose **Full** for smooth Synapse motion independently of Windows, or **Reduced** for immediate movement and no connection currents. The setting applies consistently to the camera, panels, titles and CSS transitions, and takes effect immediately.
+**Startup animation** controls a silent, roughly one-second cursor rebuild on the first foreground presentation of each app launch. Reduced animations skip it. Your first click or key immediately reveals the live interface and performs its normal action. Slow restoration, resizing or other interruptions safely skip the effect. It never reruns just because you change vaults or reopen the tray window. New profiles start at 70% sound volume; existing saved volume is preserved.
+
One lazy Web Audio instrument uses original additive synthesis. Subnetwork entries use C4–G4, topics C5–G5, and linked concepts C6–E6, with stable node-derived pitches and bounded attack, detune and level variation. Higher voices are shorter and quieter; deeper exploration stays in that highest register. Back/close and neighbour arrivals are restrained. Six-voice limits, compression/limiting, repeated-event suppression and native-focus cancellation remain in place. Typing, hover, startup and indexing stay silent. No recorded notification or external sound file is bundled.
See [interaction architecture](../INTERACTION.md) and [executed validation](../VALIDATION.md) for timing, lifecycle and test boundaries.
diff --git a/package-lock.json b/package-lock.json
index 8ba107a..bcfc117 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -1,12 +1,12 @@
{
"name": "synapse",
- "version": "0.6.0",
+ "version": "0.7.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "synapse",
- "version": "0.6.0",
+ "version": "0.7.0",
"dependencies": {
"@codemirror/autocomplete": "^6",
"@codemirror/commands": "^6",
diff --git a/package.json b/package.json
index 06610f6..511a332 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "synapse",
- "version": "0.6.0",
+ "version": "0.7.0",
"private": true,
"type": "module",
"scripts": {
diff --git a/scripts/audio-audition.mjs b/scripts/audio-audition.mjs
new file mode 100644
index 0000000..3f05e57
--- /dev/null
+++ b/scripts/audio-audition.mjs
@@ -0,0 +1,32 @@
+import { readFile, writeFile } from "node:fs/promises";
+const root = ".local/sound-0.7.0";
+async function join(name, paths) {
+ const waves = await Promise.all(
+ paths.map((p) => readFile(`${root}/${p}.wav`)),
+ );
+ const data = Buffer.concat(waves.map((b) => b.subarray(44)));
+ const header = Buffer.from(waves[0].subarray(0, 44));
+ header.writeUInt32LE(data.length + 36, 4);
+ header.writeUInt32LE(data.length, 40);
+ await writeFile(`${root}/${name}.wav`, Buffer.concat([header, data]));
+}
+const roles = ["subnetwork", "topic", "concept"];
+await join(
+ "static-then-glide",
+ roles.flatMap((role) => [
+ `after/${role}-select`,
+ `after/${role}-glide-matched`,
+ ]),
+);
+await join(
+ "before-then-after",
+ roles.flatMap((role) => [
+ `before/${role}-select`,
+ `after/${role}-select`,
+ `before/${role}-arrival`,
+ `after/${role}-arrival`,
+ ]),
+);
+console.log(
+ "Wrote matched static/glide pairs and same-volume before/after cues.",
+);
diff --git a/scripts/audio-validation.mjs b/scripts/audio-validation.mjs
index 1c06f3a..c54e3c3 100644
--- a/scripts/audio-validation.mjs
+++ b/scripts/audio-validation.mjs
@@ -1,65 +1,197 @@
-// Render the production voice graph in real Chromium Web Audio. No audio mocks.
-// These numerical renders are separate from the installed-app audition.
+// Real Chromium OfflineAudioContext, production event levels and complete bus.
+// --baseline records the previous mix without applying the new audibility floors.
+// Synthetic reference renders; the native app audition is recorded separately.
import { chromium } from "@playwright/test";
import { createServer } from "vite";
import { mkdir, writeFile } from "node:fs/promises";
import assert from "node:assert/strict";
-const out = ".local/sound-0.6.0";
+const baseline = process.argv.includes("--baseline");
+const out = `.local/sound-0.7.0/${baseline ? "before" : "after"}`;
await mkdir(out, { recursive: true });
const server = await createServer({
- server: { host: "127.0.0.1", port: 1430 },
+ server: { host: "127.0.0.1", port: 1430, strictPort: true },
});
await server.listen();
const browser = await chromium.launch({ channel: "msedge", headless: true });
+function wav(channels, rate = 48000) {
+ const n = channels[0].length,
+ b = Buffer.alloc(44 + n * channels.length * 2);
+ b.write("RIFF");
+ b.writeUInt32LE(b.length - 8, 4);
+ b.write("WAVEfmt ", 8);
+ b.writeUInt32LE(16, 16);
+ b.writeUInt16LE(1, 20);
+ b.writeUInt16LE(channels.length, 22);
+ b.writeUInt32LE(rate, 24);
+ b.writeUInt32LE(rate * channels.length * 2, 28);
+ b.writeUInt16LE(channels.length * 2, 32);
+ b.writeUInt16LE(16, 34);
+ b.write("data", 36);
+ b.writeUInt32LE(b.length - 44, 40);
+ for (let i = 0; i < n; i++)
+ for (let c = 0; c < channels.length; c++)
+ b.writeInt16LE(
+ Math.round(Math.max(-1, Math.min(1, channels[c][i])) * 32767),
+ 44 + (i * channels.length + c) * 2,
+ );
+ return b;
+}
try {
const page = await browser.newPage();
- await page.route("**/audio-check", (route) =>
- route.fulfill({
+ await page.route("**/audio-check", (r) =>
+ r.fulfill({
contentType: "text/html",
- body: "