mirror of
https://github.com/Pasta-Devs/Marinara-Engine.git
synced 2026-12-03 19:00:50 +07:00
[PR #1141] [CLOSED] fix(tts): apply playback rate client-side for local OAI-compatible servers #4943
Labels
No labels
android
bug
bugfix
ci
client
code freeze pause
container
dependencies
docs
documentation
duplicate
enhancement
feature
feature
feature
feature-creep
fixed-in-refactor
fixed-in-staging
good first issue
help wanted
in-pr
in-pr
needs-codeowner-decision
normal-scope
old-codebase
old-codebase
pull-request
qol
question
refactor
regression
revisit later
roadmap
scope-risk
scope-risk
server
server
shared
soup
upstream
windows
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Pasta-Devs/Marinara-Engine#4943
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/Pasta-Devs/Marinara-Engine/pull/1141
Author: @etherious1804
Created: 5/24/2026
Status: ❌ Closed
Base:
staging← Head:fix/tts-speed-client-side-fallback📝 Commits (1)
0954666fix(tts): apply playback rate client-side for local OAI-compatible servers📊 Changes
5 files changed (+59 additions, -6 deletions)
View changed files
📝
packages/client/src/components/chat/ChatArea.tsx(+9 -2)📝
packages/client/src/components/chat/ChatMessage.tsx(+10 -3)📝
packages/client/src/components/panels/settings/TTSConfigCard.tsx(+2 -0)📝
packages/client/src/lib/tts-dialogue.ts(+26 -0)📝
packages/client/src/lib/tts-service.ts(+12 -1)📄 Description
Linked issue
Closes #1140
Why this change
The TTS settings panel exposes a Speed slider that's supposed to control playback rate, but for local OpenAI-compatible TTS servers (mlx-audio, openedai-speech, etc.) the
speedparameter in/v1/audio/speechis an OpenAI extension that most local implementations silently ignore. The user moves the slider and nothing changes — the synthesized audio comes back at exactly the same rate every time. Cloud OpenAI honors the parameter; local servers don't.We can fix this universally without re-synthesis by applying
playbackRateon the HTMLAudioElement client-side. Pitch is preserved by default. The slider becomes uniformly effective across every provider, with no extra server round-trip.What changed
Shared types
packages/shared/src/types/tts.ts: no new type fields; existingspeedonTTSConfigis unchanged. The value continues to be sent to providers that respect it server-side.Client — client-side playback rate
packages/client/src/lib/tts-dialogue.ts: new exportedclientSidePlaybackRate(config)helper that returns the configured speed (or 1 when undefined/unset). Single source of truth for the "speed-as-playbackRate" interpretation.packages/client/src/lib/tts-service.ts:speakSequenceaccepts aplaybackRateoption and applies it to eachHTMLAudioElement(audio.playbackRate = rate) immediately after constructing the element, beforeplay().packages/client/src/components/chat/ChatArea.tsxandpackages/client/src/components/chat/ChatMessage.tsx: passclientSidePlaybackRate(ttsConfig)into the existingspeakSequencecall sites (autoplay and per-message manual speak).packages/client/src/components/panels/settings/TTSConfigCard.tsx: existing Speed slider is untouched UI-wise — it simply works now.The change is intentionally minimal: no surgery in the request builders, no provider-specific branches. The
speedrequest param continues to be sent (for providers that honor it — pitch may also be adjusted server-side), and the client-sideplaybackRatelayer is purely additive.Validation
pnpm checkpasses locallyContainer (Docker / Podman) built and ran without issue
Ran the app, clicked through the changes manually
Checked edge cases (light + dark mode, mobile viewport, empty states, error paths)
Above manual verification completed (describe below)
Read and followed
CONTRIBUTING.mdManual verification notes
What was verified on the branch:
pnpm check.clientSidePlaybackRateexport is consumed at three call sites: autoplay-after-stream (ChatArea.tsx), per-message manual speak (ChatMessage.tsx), and the streaming-TTS hook (use-streaming-tts.tsin #1142).speakSequencereads the option, assignsaudio.playbackRate = ratebeforeaudio.play(). Standard HTMLAudioElement behavior — pitch preserved, no extra fetch round-trip.To verify in browser:
Docs and release impact
UI evidence (if applicable)
No UI changes — only the existing Speed slider becomes effective.
🤖 Generated with Claude Code
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.