feat(play): remove hardcoded 1.2x speech playback speed

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.
This commit is contained in:
yuanzonghao
2026-06-15 14:03:20 +08:00
parent 375f401c8f
commit 17341cbd4a
+1 -9
View File
@@ -19,9 +19,6 @@ const SHADOW =
const DEFAULT_CHAR_MS = 28; const DEFAULT_CHAR_MS = 28;
const MIN_CHAR_MS = 30; 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 // If audio metadata never arrives within this window, give up waiting and
// let the typewriter run at default speed. // let the typewriter run at default speed.
const AUDIO_WAIT_TIMEOUT_MS = 2500; const AUDIO_WAIT_TIMEOUT_MS = 2500;
@@ -261,7 +258,6 @@ export function PlayCanvas({
const el = audioRef.current; const el = audioRef.current;
if (!el) return; if (!el) return;
el.muted = muted; el.muted = muted;
el.playbackRate = SPEECH_RATE;
if (!muted && audioSrc && el.paused) { if (!muted && audioSrc && el.paused) {
el.play().catch(() => { el.play().catch(() => {
// autoplay blocked — silent until next interaction // autoplay blocked — silent until next interaction
@@ -272,11 +268,7 @@ export function PlayCanvas({
function handleAudioMetadata() { function handleAudioMetadata() {
const el = audioRef.current; const el = audioRef.current;
if (!el) return; if (!el) return;
el.playbackRate = SPEECH_RATE; const ms = Number.isFinite(el.duration) ? el.duration * 1000 : 0;
// 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;
setAudioDurationMs(ms > 0 ? ms : 0); setAudioDurationMs(ms > 0 ? ms : 0);
if (!muted) { if (!muted) {
el.play().catch(() => { el.play().catch(() => {