Skip to content

Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS

docs([issue-1026]): log issue #1026 to changelog

Adam Eivyf7b7cea9d4ad
diff --git a/.changelog/NEXT.md b/.changelog/NEXT.md
index 68b357790e..37c9fcf31d 100644
--- a/.changelog/NEXT.md
+++ b/.changelog/NEXT.md
@@ -1,3 +1,4 @@
## Added
- **Songs: a live vocal tuner while you record** — the song recorder now shows the note you're singing and how flat or sharp it is, in real time, right next to the metronome. Hit a take and the tuner reads the same microphone you're recording into (it never opens a second mic), displaying the detected note and a green/yellow/red cents needle that swings flat ↔ sharp and centers when you're in tune. When you're not recording, a **Tune** button opens a standalone tuning mode that listens to the mic without recording or saving anything — handy for warming up or finding a starting pitch. Mobile-friendly, and the mic and analysis shut down cleanly the moment you stop or leave the page. Built on the in-house pitch-detection core — no third-party audio library. (#1023)
+- **[issue-1026] Songs: sing a melody and turn it into sheet music** — the score editor has a new **Sing to score** panel. Press Sing, get a one-bar count-in so you know where the downbeat is, sing your phrase, then press Stop — PortOS listens to the melody, picks out the notes, snaps their timing to the song's tempo, and writes them out as notation. The detected notes preview on a real staff before you commit, and you can append them to the end of your score or drop them in place of whatever you've selected in the editor. Notes are spelled to match the song's key (flats in a flat key), and it all runs on the built-in pitch detection — no extra audio library.
diff --git a/client/src/hooks/useSingToScore.js b/client/src/hooks/useSingToScore.js
index b0632d2947..cb320a437b 100644
--- a/client/src/hooks/useSingToScore.js
+++ b/client/src/hooks/useSingToScore.js
@@ -31,6 +31,10 @@ const FRAME_INTERVAL_MS = 30;
// Count-in length before capture begins (bars). One bar is the conventional lead.
const COUNT_IN_BARS = 1;
+// Monotonic-ish wall clock for frame timestamps; `performance.now()` is more
+// precise but may be absent in some test/SSR contexts, so fall back to Date.
+const nowMs = () => (typeof performance !== 'undefined' ? performance.now() : Date.now());
+
/**
* @param {object} opts
* @param {number|string} [opts.tempo] — song BPM (defaults to 120 when absent).
@@ -114,7 +118,7 @@ export default function useSingToScore({ tempo, score = '', musicKey = 'C' } = {
intervalMs: FRAME_INTERVAL_MS,
onUpdate: (u) => {
if (!capturingRef.current) return;
- const tMs = (typeof performance !== 'undefined' ? performance.now() : Date.now()) - captureStartRef.current;
+ const tMs = nowMs() - captureStartRef.current;
trackRef.current.push({ tMs, hz: u.hz, clarity: u.clarity });
},
});
@@ -131,7 +135,7 @@ export default function useSingToScore({ tempo, score = '', musicKey = 'C' } = {
},
onCountInComplete: () => {
if (!mountedRef.current) return;
- captureStartRef.current = typeof performance !== 'undefined' ? performance.now() : Date.now();
+ captureStartRef.current = nowMs();
capturingRef.current = true;
setPhase(SING_RECORDING);
},