Skip to main content

VoxKit

pip CI PyPI Downloads voxkit GitHub repo Coverage Status LICENSE GPLv3

A Python library for managing Piper TTS voice models. Browse, install, and use offline AI voices with a clean API and an interactive terminal UI.

Features

  • Voice catalog — list, search, and filter Piper voices by language or locale
  • Install/uninstall — download voice models to any directory you choose
  • TTS synthesis — synthesize text to WAV files with volume control
  • Interactive TUI — terminal-based voice browser with install, uninstall, and test
  • Configurable — custom data directories, catalog URLs, cache TTL, and TUI keybindings
  • Offline — all synthesis runs locally, no internet needed after voice download

Requirements

  • Python 3.10+
  • Linux (uses aplay for WAV playback, mpg123 for MP3)
  • Piper TTS (installed automatically as dependency)

Installation

pip install voxkit

Quick Start

from voxkit import VoiceManager

# Initialize with your app's storage directory
vm = VoiceManager(data_dir="~/.myapp/voices")

# List available English voices
voices = vm.list_voices("en")
for v in voices:
    print(f"{v['key']}  {v['quality']}  {v['size_mb']:.0f} MB  {'[installed]' if v['installed'] else ''}")

# Install a voice
vm.install("en_US-lessac-medium")

# Synthesize and play text
vm.speak("en_US-lessac-medium", "Hello, world!")

API Reference

VoiceManager

VoiceManager(
    data_dir,             # Directory for models and cache
    catalog_url=None,     # Override Piper catalog URL
    base_url=None,        # Override download base URL
    cache_ttl=86400,      # Catalog cache TTL in seconds (default: 24h)
)

Catalog

vm.list_languages()                # -> ['en', 'pl', 'de', ...]
vm.get_language_name("en")         # -> 'English'
vm.list_voices("en")               # all English variants
vm.list_voices("en_US")            # US English only
vm.get_voice("en_US-lessac-medium") # single voice info or None

The lang parameter accepts both 2-letter codes ("en") to match all regional variants and full locale strings ("en_US") for exact matching.

Install & Manage

vm.install("en_US-lessac-medium", progress_cb=None)
vm.uninstall("en_US-lessac-medium")  # -> True if removed
vm.is_installed("en_US-lessac-medium") # -> bool
vm.get_path("en_US-lessac-medium")   # -> Path or None

The progress_cb receives (filename, block_num, block_size, total_size) during download.

Resolve

# Find best installed voice for a language
path = vm.resolve(lang="en")

# Use a specific voice (auto-downloads if missing)
path = vm.resolve(voice="en_US-lessac-medium")

# Prefer exact locale, fall back to any match
path = vm.resolve(lang="en_US")

TTS Synthesis

# Synthesize to WAV file
wav_path = vm.synthesize("en_US-lessac-medium", "Hello!")
wav_path = vm.synthesize("en_US-lessac-medium", "Hello!", output_path="out.wav")

# Multiple texts with pauses
wav_path = vm.synthesize_multi("en_US-lessac-medium", ["Hello.", "World."], pause_ms=700)

# Synthesize and play immediately
vm.speak("en_US-lessac-medium", "Hello, world!")

# Volume control
vm.set_volume(75)

Voice Loading

# Load a PiperVoice instance for direct use
voice = vm.load_voice("en_US-lessac-medium")

Language Detection

# Detect language from system locale
lang = VoiceManager.detect_language()  # -> 'en_US' or 'pl_PL' etc.

Interactive TUI

# Basic usage — browse English voices
vm.browse(lang="en")

# With configuration
from voxkit import BrowserConfig

config = BrowserConfig(
    lang="pl",
    default_voice="pl_PL-darkman-medium",
    show_size=True,
    test_fn=lambda key: vm.speak(key, "Dzień dobry"),
    on_install=lambda v: print(f"Installed {v['key']}"),
)
vm.browse(config=config)

The TUI supports:

  • Arrow keys — navigate the voice list
  • Enter — test the selected voice (auto-installs if needed)
  • i — install the selected voice
  • u — uninstall the selected voice
  • q / Esc / Ctrl-C — quit

Keybindings are configurable via BrowserConfig.keybindings.

Built-in Progress Bar

VoxKit includes a ready-made terminal progress bar for downloads:

from voxkit.browser import progress_bar

vm.install("en_US-lessac-medium", progress_cb=progress_bar)

Data Types

from voxkit import VoiceInfo, BrowserConfig, ProgressCallback

VoiceInfo

Returned by list_voices() and get_voice() as a dict with keys: key, name, language, quality, region, speakers, size_mb, installed.

BrowserConfig

Field Type Default Description
lang str "en" Language to browse
default_voice str | None None Mark as default in the list
show_size bool True Show download size column
test_fn Callable | None None Custom test function (voice_key) -> None
on_install Callable | None None Hook called after install (voice_info) -> None
on_uninstall Callable | None None Hook called after uninstall (voice_info) -> None
keybindings dict see below Custom key mappings

Default keybindings:

{
    "install": "i",
    "uninstall": "u",
    "test": "\r",
    "quit": ("q", "\x03", "\x1b"),
}

Storage Layout

<data_dir>/
├── models/          # Downloaded .onnx voice models
│   ├── <voice>.onnx
│   └── <voice>.onnx.json
└── cache/
    └── voices.json  # Cached Piper catalog (auto-refreshed)

License

Copyright (c) 2026 Jakub T. Jankiewicz

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

See LICENSE for the full text.

Metadata

Release files for voxkit 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for voxkit 0.1.1
File Size Uploaded Provenance Actions
voxkit-0.1.1.tar.gz 32.4 kB With provenance Details for voxkit-0.1.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for voxkit 0.1.1
File Interpreter ABI Platform Actions
voxkit-0.1.1-py3-none-any.whl Python 3 none any Details for voxkit-0.1.1-py3-none-any.whl

Total release size: 60.2 kB

Release files / voxkit-0.1.1.tar.gz

Download URL voxkit-0.1.1.tar.gz
Size 32.4 kB
Tags Source
SHA-256 checksum
How to use checksums
2ce9b885d4fef2139896012c92597c9c9e303803c53381e1f808c3bfe81e8956
BLAKE2b-256 checksum
How to use checksums
dc2cde9c07019a33fa05decfbecf341b2648bbe537c3e3e7fdb413837b3ea0a2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jun 1, 2026.

Transparency log

Release files / voxkit-0.1.1-py3-none-any.whl

Download URL voxkit-0.1.1-py3-none-any.whl
Size 27.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
f4918c63eb800d07489ddca8a8a42872195f9aa55666fa206831f6f07d574c07
BLAKE2b-256 checksum
How to use checksums
e13ed043ce6644199bdd09fc4877badd1b9e88b99ed6879ad557495f28483db4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jun 1, 2026.

Transparency log

Security for voxkit 0.1.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for voxkit-0.1.1.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jun 1, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page