Phase 9 of the rebrand cascade. Sweep covers everything the Phase 8
frontend pass deliberately skipped: docs/, root markdown, scripts,
Cargo.toml descriptions, code comments that survived earlier
word-boundary sed, plus a handful of identifiers caught on the final
verify pass.
transcription-app changes:
- README.md, HANDOVER.md, KNOWN-ISSUES.md, run.sh — magnotia/Magnotia
-> lumotia/Lumotia.
- docs/ — sweep across all subdirs except docs/handovers/ (preserved
as immutable audit trail). Includes architecture-map references
to magnotia_core::*, magnotia_storage::*, etc. now pointing at
lumotia_*; dev-setup.md tracing output examples (lumotia_startup
target); brief/ + superpowers/ + issues/ + whisper-ecosystem/ +
audit/.
- Cargo.toml descriptions on 9 crates (core, audio, cloud-providers,
hotkey, llm, mcp, plus referenced others).
- crates/core/src/{error,hardware,recommendation,paths}.rs +
crates/audio/src/wav.rs + crates/llm/src/model_manager.rs +
crates/cloud-providers/src/keystore.rs + crates/mcp/src/lib.rs —
doc comments and a model-manager user-agent string.
- Caught on final pass: BroadcastChannel("magnotia_task_sync") -> ...
("lumotia_task_sync"); magnotia_locale i18n localStorage key
renamed + migration shim added; CSS keyframe names
magnotiaPulse / magnotiaBar / magnotiaFade renamed in the design-
system kit; magnotia_viewer_item / magnotia_viewer_mode handoff
keys renamed in HistoryPage + viewer/+page.svelte; src/assets/
wordmark.svg text.
- src-tauri/src/lib.rs comment cleanup ("magnotia era" was sed'd
to "lumotia era" earlier — restored).
Preserved (intentional):
- crates/core/src/paths.rs — keeps "magnotia" / "Magnotia" / ".magnotia"
legacy detection strings in legacy_and_target_paths() so the
migration shim can still find user data from the magnotia era.
- src/lib/stores/{page,focusTimer}.svelte.ts + src/lib/i18n/index.ts
— migration call sites reference the legacy magnotia keys
deliberately.
- docs/handovers/ — historical audit trail.
cargo build --workspace passes. npm run check: 0 errors / 0 warnings
(3958 files). cargo test --workspace: 339 pass / 0 fail.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
5.8 KiB
name, type, slice, last_verified
| name | type | slice | last_verified |
|---|---|---|---|
| Static assets and pcm-processor.js worklet | architecture-map-page | 05-core-storage-hotkey-build | 2026/05/09 |
Static assets and pcm-processor.js worklet
Where you are: Architecture map → Core, Storage, Hotkey, Build → Static assets and
pcm-processor.jsworklet
Plain English summary. The static/ folder ships verbatim with the app. Most files are obvious assets (favicon, fonts, a single texture). The interesting one is pcm-processor.js, an AudioWorkletProcessor that downsamples microphone audio to the 16 kHz mono PCM that whisper.cpp / Parakeet expect. It runs in the browser's audio worklet thread, not the main JS thread.
At a glance
- Folder:
static/at the repo root. - Files:
favicon.png,svelte.svg,tauri.svg,vite.svg,pcm-processor.js,fonts/,textures/. - Total: ~250 KB (mostly the woff2 font files).
- Consumers: Vite copies the directory into the build output; the SvelteKit static adapter serves the result; the in-browser webview hosted by Tauri loads from there.
pcm-processor.js — the audio worklet
class PcmProcessor extends AudioWorkletProcessor {
constructor() {
super();
this.buffer = [];
this.ratio = sampleRate / 16000;
this.needsResample = Math.abs(this.ratio - 1.0) > 0.01;
this.resamplePos = 0;
}
process(inputs) {
const input = inputs[0];
if (!input || input.length === 0) return true;
const samples = input[0]; // mono channel
if (!samples) return true;
if (this.needsResample) {
// Simple downsampling to 16kHz
for (let i = 0; i < samples.length; i++) {
this.resamplePos += 1;
if (this.resamplePos >= this.ratio) {
this.buffer.push(samples[i]);
this.resamplePos -= this.ratio;
}
}
} else {
for (let i = 0; i < samples.length; i++) {
this.buffer.push(samples[i]);
}
}
// Send every ~0.5 seconds at 16 kHz = 8000 samples
if (this.buffer.length >= 8000) {
this.port.postMessage({ type: "pcm", samples: this.buffer });
this.buffer = [];
}
return true;
}
}
registerProcessor("pcm-processor", PcmProcessor);
What it does
- Picks up the device-native sample rate (e.g. 48 kHz) from the
sampleRateglobal available inside anAudioWorkletGlobalScope. - Computes a downsampling ratio against 16 kHz. If the device is already 16 kHz (rare), passes samples through.
- The downsampler is dropwise: it accumulates a fractional position and emits a sample whenever the position crosses an integer step. No anti-aliasing filter. Acceptable for speech; subtly hurts on music or fast transients but Lumotia is a speech app.
- Buffers up to 8 000 samples (≈ 0.5 s at 16 kHz).
- Posts
{ type: "pcm", samples: [...] }to the AudioWorklet's port. The main thread bridges this onward to the Rust live-session command.
Why this lives in static/ not src/
Audio worklets must be loaded via audioContext.audioWorklet.addModule(url) and resolved as a URL, not as a JS module imported into the bundle. SvelteKit's static adapter serves static/pcm-processor.js at /pcm-processor.js, which the worklet loader can fetch.
If we moved this into src/, Vite would bundle it and break the worklet load.
Cross-link
The 16 kHz target rate is also the value of lumotia_core::constants::WHISPER_SAMPLE_RATE. The worklet hard-codes the literal 16000 rather than importing the Rust constant because audio worklets cannot import from the bundle. A coordinated change requires editing both places. See core-constants.md for the Rust side.
The 8 000-sample emit threshold is also the value of lumotia_core::constants::MIN_CHUNK_SAMPLES. Same hard-coding issue.
Fonts
static/fonts/:
atkinson-hyperlegible-next.woff2— primary text font; designed for accessibility and dyslexia.instrument-serif-italic.woff2— display italic.jetbrains-mono.woff2— monospace, used in code blocks and the diagnostic-report bundle.lexend-variable.woff2— UI alternative.opendyslexic.woff2— accessibility font, opt-in via preferences.
Loaded via @font-face in src/app.css (slice 1). Local-first; no Google Fonts CDN.
Textures
static/textures/grain.png — the subtle film-grain overlay used on the home page hero. Slice 1 territory.
Watch-outs
pcm-processor.jsliterally hard-codes16000and8000. Two magic numbers that must move in lock-step with the Rust constants. If Lumotia ever supports a different speech-model sample rate, this file is one of the touch points. Worth a build-time substitution mechanism (Vite plugin) to inject the constants from a single source.- The downsampler does no anti-aliasing. A device sampling at 48 kHz has frequency content above 8 kHz that should be filtered out before decimation. The current dropwise downsampler aliases that content into the 0-8 kHz band. Whisper handles the artefacts well in practice but a one-pole lowpass would be a cheap accuracy gain. Tracked verbally; no doc yet.
- Bypasses Vite optimisation. Files in
static/are not minified or fingerprinted. Acceptable for a worklet (load is once per session); cache invalidation is a non-issue because Tauri loads from local disk. - Browser permission gate. AudioWorklets require a
MediaStreamand run inside the audio context. Tauri's webview honoursgetUserMediaso the mic permission UI just works on Linux / Windows / macOS.
See also
- Frontend build config —
static/is served by the static adapter. - Constants module —
WHISPER_SAMPLE_RATE,MIN_CHUNK_SAMPLES. - Slice 3 audio + transcription — Rust side of the worklet bridge.