Skip to main content

MkDocs plugin for generating and serving Piper text-to-speech page audio

Project description

mkdocs-piper-tts

An MkDocs plugin that generates Piper text-to-speech audio for pages and adds an HTML audio control through the piper_tts_button template helper.

Install

pip install mkdocs-piper-tts

For CUDA synthesis, install the CUDA extra on a compatible CUDA 12 system:

pip install 'mkdocs-piper-tts[cuda]'

For TensorRT synthesis support, install:

pip install 'mkdocs-piper-tts[tensorrt]'

The plugin invokes ffmpeg to encode MP3 files, so ffmpeg must be available on PATH when generating audio.

Piper Version Policy

This package intentionally pins piper-tts==1.2.0. That release is MIT licensed and is compatible with this package's MIT license. Do not upgrade Piper without first reviewing the license of the target release and its runtime dependencies.

Configure

Store Piper .onnx models and their JSON configuration files outside the published documentation source, then enable the plugin in mkdocs.yml:

plugins:
  - piper-tts:
      model_dir: models/piper-tts
      asset_dir: assets/piper-tts
      audio_dir: audio
      use_cuda: true
      batch_size: 2
      languages:
        en:
          model: en_US-amy-medium.onnx
          label: Listen
        de:
          model: de_DE-thorsten-medium.onnx
          label: Vorlesen

Set lang in a page's front matter. The plugin caches generated MP3 files and sidecar metadata under <docs_dir>/<asset_dir>/<audio_dir>. Cached files are reused when both page source and plugin code are unchanged.

Set generate_audio: false for cache-only builds. In this mode, missing or stale audio fails the build instead of initializing Piper; use it in CI after restoring a verified audio cache artifact.

Render the control in an MkDocs template with:

{{ piper_tts_button(page) }}

Releases

Tags named v* build and publish a wheel and source distribution with PyPI trusted publishing. For each release, update the version in pyproject.toml, commit it, and push a matching tag such as v0.2.0. PyPI versions are immutable, so never reuse a published version or tag.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mkdocs_piper_tts-0.1.1.tar.gz (14.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

mkdocs_piper_tts-0.1.1-py3-none-any.whl (13.5 kB view details)

Uploaded Python 3

File details

Details for the file mkdocs_piper_tts-0.1.1.tar.gz.

File metadata

  • Download URL: mkdocs_piper_tts-0.1.1.tar.gz
  • Upload date:
  • Size: 14.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for mkdocs_piper_tts-0.1.1.tar.gz
Algorithm Hash digest
SHA256 74ae59200678a584924e7fea2465d341ef1827e9b5c5ecfda484710a8f8c8012
MD5 c832674f924c8066a080e8b1589eb215
BLAKE2b-256 97b251189b4ea5da9df33256bb70851d3152c5ef9ad9864e69efea5c58aa7304

See more details on using hashes here.

Provenance

The following attestation bundles were made for mkdocs_piper_tts-0.1.1.tar.gz:

Publisher: publish-pypi.yml on risajef/mkdocs-piper-tts

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file mkdocs_piper_tts-0.1.1-py3-none-any.whl.

File metadata

File hashes

Hashes for mkdocs_piper_tts-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 8c03f6dbd6945311923d76209a9494e494f43ec737c07da6c4e8c21f5b598ed7
MD5 ae211f3876114a7e9528f5afbe0fb201
BLAKE2b-256 147ca63beec00e83af106a5b86495ed8e57c032a2ad8d417b181cff857116a28

See more details on using hashes here.

Provenance

The following attestation bundles were made for mkdocs_piper_tts-0.1.1-py3-none-any.whl:

Publisher: publish-pypi.yml on risajef/mkdocs-piper-tts

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page