From 17341cbd4aed773dfab8ed3581608d318db2890a Mon Sep 17 00:00:00 2001 From: yuanzonghao Date: Mon, 15 Jun 2026 14:03:20 +0800 Subject: [PATCH] feat(play): remove hardcoded 1.2x speech playback speed MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The SPEECH_RATE=1.2 constant was added to speed up the somewhat slow MiMo voicedesign voice. With StepFun preset voices (whose tempo is already appropriate) and no per-provider logic, a global 1.2x is no longer the right default. Remove the constant and all 4 of its uses: - the constant declaration + comment - two `el.playbackRate = SPEECH_RATE` assignments (audio now plays at 1.0) - the typewriter pacing divisor (`/ SPEECH_RATE`) — audio and text both return to original duration, staying in lockstep A future user-facing speech-speed setting (UI control + persisted pref) would be a separate feature with a different shape; no placeholder kept. --- components/PlayCanvas.tsx | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/components/PlayCanvas.tsx b/components/PlayCanvas.tsx index 7ef67e1..030641c 100644 --- a/components/PlayCanvas.tsx +++ b/components/PlayCanvas.tsx @@ -19,9 +19,6 @@ const SHADOW = const DEFAULT_CHAR_MS = 28; const MIN_CHAR_MS = 30; -// Voice playback speed multiplier. >1 speeds up the (somewhat slow) MiMo voice -// while preserving pitch. Typewriter pacing is divided by the same factor. -const SPEECH_RATE = 1.2; // If audio metadata never arrives within this window, give up waiting and // let the typewriter run at default speed. const AUDIO_WAIT_TIMEOUT_MS = 2500; @@ -261,7 +258,6 @@ export function PlayCanvas({ const el = audioRef.current; if (!el) return; el.muted = muted; - el.playbackRate = SPEECH_RATE; if (!muted && audioSrc && el.paused) { el.play().catch(() => { // autoplay blocked — silent until next interaction @@ -272,11 +268,7 @@ export function PlayCanvas({ function handleAudioMetadata() { const el = audioRef.current; if (!el) return; - el.playbackRate = SPEECH_RATE; - // Effective playback time is shorter once sped up — keep the typewriter in sync. - const ms = Number.isFinite(el.duration) - ? (el.duration * 1000) / SPEECH_RATE - : 0; + const ms = Number.isFinite(el.duration) ? el.duration * 1000 : 0; setAudioDurationMs(ms > 0 ? ms : 0); if (!muted) { el.play().catch(() => {