FrontPocket

June 4, 2026 · View on GitHub

FrontPocket provides a front-end to Kyutai Labs Pocket TTS, including the ability to read text from the clipboard, from a text file and passed directly on the CLI. Features include the ability to pause, resume, move back and forward in the spoken text and change playback speed.

It is a low-latency, daemon-based text-to-speech system, developed and tested under Linux. FrontPocket loads the TTS model once at startup and streams audio sentence by sentence, so there is minimal delay between sending text and hearing it spoken.

Subsequent sentences are generated in advance and previous sentences are cached allowing instantaneous movement backwards and forwards a few sentences.

frontpocket_server.py is intended to run in the background as a systemd service. You can also run it from the CLI for interactive use — recommended while getting it dialled-in before committing to running it as a service. The server is controlled by the included lightweight CLI client.

You could set hotkeys to run the CLI client passing it parameters to play, pause, change speed, etc. e.g. Ctrl-Shift-S could trigger speaking of the clipboard text.

A Qt6-based toolbar frontpocket_toolbar.py provides a UI to drive the CLI client — play clipboard text, move forward and back, and change voices and speed. Right-click to see the speed and voice selections.

Compact Toolbar: toolbar-only Right click to expand toolbar: toolbar-expanded

Note: Developed and tested under Debian Linux. macOS/Windows should work but has not been tested. Please test and submit a PR for any needed fixes.

Inspiration for this project comes from Kokorodoki, which provides a similar feature set for Kokoro TTS.

Much thanks to the very smart people at Kyutai Labs for their beautiful model and helpful reference code. Their work is where the real magic happens. https://github.com/kyutai-labs/pocket-tts


Features

  • Low latency — model is pre-loaded; audio begins within seconds of sending text
  • Chunk-ahead generation — the next several sentences are generated in the background while the current one plays
  • Lookbehind cache — previously played sentences are cached for instant !back navigation
  • Multiple voices — switch voices on the fly; built-in voices and custom .safetensors embeddings supported
  • Speed control — pitch-preserved speed adjustment via pyrubberband
  • Pause / resume — resume from exactly where you paused, even after changing voice or speed
  • Skip forward / back — move through sentences instantly; previously played sentences are cached
  • Interrupt — inject an urgent TTS message mid-playback, then resume automatically
  • Clipboard-first — default input is the system clipboard; also accepts inline text and text files
  • Auto model reload — detects bad TTS generation and reloads the model automatically
  • systemd ready — runs as a proper systemd user service with automatic restart on failure
  • User-friendly Polish — proper handling of numbers, currencies, hyphens, acronyms. Workarounds for words that the Pocket-TTS model has difficulty with.
  • Multilingual — sentence segmentation supports English, German, French, Spanish, Italian, Russian, Polish, and more. Tested with English. Full multilingual support coming in a future version.
  • UI Toolbar - Because we don't always want to be in the CLI.

How It Works

FrontPocket has three components:

ComponentFileRole
Serverfrontpocket_server.pyLoads the model, listens on a TCP socket, plays audio
Clientfrontpocket_client.pySends text or commands to the server
Toolbarfrontpocket_toolbar.pyProvides a UI to talk to the client

The server and client communicate over a local TCP socket (default port 5562). The client is fire-and-forget — it sends a message and exits immediately.


Installation

See INSTALL.md for full manual setup instructions including systemd service configuration.

Starting in FrontPocket v1.4 frontpocket_installer.sh is provided. This script simplifies installation on Linux environments. Tested on Debian.

Download the script, chmod +x frontpocket_installer.sh, ./frontpocket_installer.sh

The script will download the project and perform the same install steps as the manual install. This needs more testing, especially on non-Debian systems. A log file is created in ~/FrontPocket which may help with troubleshooting and issue reporting.


Client Usage

fp [text] [options]

Input

CommandDescription
fpSpeak clipboard contents (default)
fp "Some text"Speak inline text
fp --file article.txtSpeak contents of a text file

Playback Control

CommandShortDescription
fp --pausePause playback
fp --resumeResume from where you paused
fp --nextSkip to next sentence
fp --backGo back one sentence

Why no --stop? Just use pause and don't resume.

Settings

CommandDescription
fp --voice maryChange voice (takes effect immediately)
fp --speed 1.5Change speed (0.5–3.0, takes effect immediately)

Interrupts & Status

CommandDescription
fp --interruptwith "text"Pause, speak the text, resume
fp --interruptwith alert.txtSame, but read text from a file
fp --statusSpeak current voice, speed, and playback state

Other Options

OptionDescription
--pingCheck server is reachable (exit 0 = up, exit 1 = down)
--list-voicesPrint all voices configured in frontpocket.ini
--versionPrint FrontPocket version and exit
--port PORTConnect to a non-default server port
--host HOSTConnect to a non-default server host
--quietSuppress all client output

Configuration

FrontPocket is configured via frontpocket.ini. The server looks for it next to frontpocket_server.py, then in the current working directory. When installed as a service, a symlink is created from ~/FrontPocket/ to ~/.config/FrontPocket/frontpocket.ini. Perform your changes in ~/.config/FrontPocket/frontpocket.ini.

Key settings

[settings]
default_voice = alba
default_speed = 1.0
port = 5562
lookahead_chunks = 5
language = en
log_level = INFO
interrupt_sound = ~/FrontPocket/sounds/notification.wav

[voices]
alba  = alba
mary = ~/FrontPocket/voices/mary.safetensors

See the fully commented frontpocket.ini for all available options.


Voices

FrontPocket uses pocket_tts for TTS.

Built-in voices are referenced by name in frontpocket.ini:

alba = alba

Custom voices use .safetensors embedding files:

mary = ~/FrontPocket/voices/mary.safetensors

Hugging Face voices can be referenced directly:

expresso = hf://kyutai/tts-voices/expresso/ex01-ex02_default_001_channel2_198s.wav

Commands Reference (Server Protocol)

Text sent to the server without a ! prefix is spoken. Commands are prefixed with !:

CommandAliasDescription
!pause!pPause playback
!resume!rResume playback
!next!nSkip to next chunk
!back!bGo back one chunk
!voice <name>Change voice
!speed <value>Change speed
!interruptwith <text>!iInterrupt with text, then resume
!statusSpeak current voice, speed, and state
!pingNo-op — used to verify server is reachable

Logging

LevelWhat you see
ERRORFatal errors only
INFOChunk generation, playback, commands received (default)
DEBUGEverything above plus chunk text, socket messages, and per-chunk .txt files in debug_dir

Set log_level in frontpocket.ini or override at launch:

python3 frontpocket_server.py --log-level DEBUG

When running as a service, view logs with:

journalctl --user -u frontpocket -f

Dependencies

PackagePurpose
pocket_ttsTTS engine
pysbdSentence boundary detection
pyrubberbandPitch-preserved speed adjustment
sounddeviceAudio playback
numpyAudio array handling
scipyWAV file reading (interrupt sound)
rubberband-cliSystem package required by pyrubberband
pyqt6UI for the toolbar
pyperclipWindows clipboard support (optional)
python3-venvvenv module for python3
emojiIdentify and map emojis in text
num2words21 -> twenty one
pronouncingWord list

License

MIT