Skip to content

Read messages aloud through a local speech server - #9

Open
zorenkonte wants to merge 4 commits into
mainfrom
feature/speech-server
Open

zorenkonte wants to merge 4 commits into
mainfrom
feature/speech-server

Conversation

@zorenkonte

@zorenkonte zorenkonte commented Sep 21, 2026 •

Copy link
Copy Markdown
Owner

Summary

speak: true used the TV's built-in text-to-speech engine, which sounds robotic on many sets. The TV can now fetch natural-sounding audio from a speech server on the LAN (Piper by default) and play that instead, falling back to the TV voice when the server does not answer. The API is unchanged; the voice source is a TV setting.

Changes

  • Settings: new speechServer preference, empty by default.
  • sound/SpeechServer: normalizes the setting. host:port posts JSON {"text": ...} to /synthesize (Piper's HTTP API); a URL containing {text} is fetched with GET and the text URL-encoded; an explicit path is posted to as is. Eight JVM tests.
  • sound/SpeechFetcher: downloads the audio off the main thread with an 8 s timeout and a 5 MB cap into the cache dir, deleting the previous file.
  • sound/SpeechPlayer: fetch and play through the existing UrlSoundPlayer, or speak with the device engine when no server is set or the fetch fails. Reports which source spoke. SoundPlayer now uses it in place of Speaker.
  • Sound tab: a Speech server row that opens the TV's on-screen keyboard in a dialog with Save, Clear and Cancel, and a Test voice row that speaks a sample sentence and reports "through the server", "TV's own voice" or "server unreachable, using the TV's own voice".
  • SettingsPane and HomeScreen accept an initialSection so a preview can open on a tab; new SoundTabPreview.
  • Docs: new Natural voice guide (installing Piper, systemd unit, pointing the TV at it, the request contract, the {text} template, fallback behavior), TV settings reference, Notification behavior, README bullet.

Testing

  • ./gradlew testDebugUnitTest lintDebug assembleDebug passes, 74 tests.
  • ./gradlew updateDebugScreenshotTest renders the new Sound tab preview: no overflow, both new rows fit.
  • cd docs && npm run build passes with no dead links.
  • Not tested on a device from this session. To verify on the CHiQ: start Piper on a PC with --host 0.0.0.0, enter PC_IP:5000 under Sound, press Test voice, then send a notification with speak: true. Stop Piper and send again to hear the fallback.

Checklist

  • cd tv && ./gradlew testDebugUnitTest assembleDebug passes
  • cd client && npm run lint && npm run build passes (client unchanged)
  • No comments added to source files
  • README updated when behavior, the API or setup changed
  • Each commit is one logical change and builds on its own

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant