Skip to main content

Convert Ebooks to Audiobooks with [custom] voice samples

Project description

Kenkui

Kenkui is basically a fancy wrapper for Kyutai's pocket-tts, with support for ebook parsing. It is multithreaded, and runs faster than any other tool I've used, so I figured I'd start a project to make it easier to use.

Features

  • Freaky fast audiobook generation
  • No GPU needed, 100% cpu
  • Super High Quality Text-to-Speech
  • State of the Art Tools
  • Multithreaded
  • Custom voices
  • Chapter selection
  • Batch processing
  • Automatic cover embedding from EPUB to M4B
  • Fix existing audiobooks (salvage chapters, add missing ones, fix metadata)

Requirements

  • python 3.7+
  • pip, pipx, or uv
  • ffmpeg
  • mutagen (installed automatically)

Quick Start

Dependencies:

uv tool install kenkui
kenkui <your ebook name>.epub

You can also install using pip or pipx!

pip install kenkui

pipx install kenkui

Usage

You can pass a file or directory into kenkui, and it will search directories recursively for .epub files and convert them to m4b files.

Basic Examples

# Convert a single book
kenkui book.epub

# Convert entire library directory
kenkui library/

# Specify output directory
kenkui book.epub -o output/

# Use specific voice
kenkui book.epub --voice alba

Voice Selection

Use --voice to specify the voice you want to use.

  • accepts:
    • the eight default voices of pocket-tts (alba, marius, javert, jean, fantine, cosette, eponine, azelma)
    • .wav files locally on computer (kenkui ships with quite a few extra)
    • voices from Hugging Face (hf://user/repo/voice.wav)

Use --list-voices to see all available voices.

Chapter Selection

Use --select-chapters to interactively choose which chapters to convert.

Fix Audiobooks

Use --fix-audiobook to fix existing M4B files:

# Scan audiobook for missing chapters and fix metadata
kenkui --fix-audiobook book.epub book.m4b

# With verbose output
kenkui --fix-audiobook book.epub book.m4b --verbose

What --fix-audiobook does:

  1. Scans for missing chapters - Compares EPUB table of contents with M4B chapters
  2. Salvages existing audio - Extracts matching chapters from existing M4B (no regeneration needed)
  3. Generates missing chapters - Asks to generate any chapters not found in M4B
  4. Rebuilds audiobook - Stitches all audio in proper EPUB chapter order
  5. Embeds cover - Extracts cover from EPUB and embeds into fixed M4B
  6. Creates new file - Outputs book_fixed.m4b (original preserved as backup)

Custom voices

In order to use your own custom voice, make sure to record a 5-10 second clip of the person speaking, with minimal background noise or crosstalk. We highly recommend using some sort of tool to clean the audio.

Examples

# Basic conversion
kenkui book.epub

# With voice selection
kenkui library/ --select-books --voice alba
kenkui book.epub --select-chapters --voice ~/Downloads/voice.wav

# With output directory and workers
kenkui book.epub -o output/ -w 4

# Fix an existing audiobook
kenkui --fix-audiobook book.epub book.m4b --verbose

Notes

At this time we do not plan on supporting mp3, not because it's hard, but because m4b is a wonderful format. There is also currently not support for ebook formats other than epub. I'm sure it'll get added in the future.

For similar reasons, currently only pocket-tts is supported as the tts provider. It's the smallest, fastest, and most feature complete at the moment.

Special Thanks

Thank you to the Guttenberg Project for providing some books included in kenkui!

Changelog

v0.4.0

  • Automatic cover embedding - Covers from EPUB are now automatically embedded into M4B output
  • Fix audiobooks - New --fix-audiobook command for:
    • Detecting missing chapters via fuzzy title matching
    • Salvaging existing audio from M4B files
    • Generating only missing chapters
    • Fixing metadata and embedding covers
  • Fuzzy chapter matching - Smart matching between EPUB and M4B chapter titles
  • Chapter salvage - Reuse existing audio instead of regenerating when possible

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

kenkui-0.5.0.tar.gz (83.4 MB view details)

Uploaded Source

Built Distribution

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

kenkui-0.5.0-py3-none-any.whl (83.4 MB view details)

Uploaded Python 3

File details

Details for the file kenkui-0.5.0.tar.gz.

File metadata

  • Download URL: kenkui-0.5.0.tar.gz
  • Upload date:
  • Size: 83.4 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.28 {"installer":{"name":"uv","version":"0.9.28","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for kenkui-0.5.0.tar.gz
Algorithm Hash digest
SHA256 c1ff303ab5bc0453463959c2a9be07da9ee385f12b34c42c41fdf544cdcdf107
MD5 b854ec5fc9b16e6d11283eb174aee81a
BLAKE2b-256 581c29f55e2bc79a2348d68ac24b5f885e05711902e0e0016fc3dd1c33e19f23

See more details on using hashes here.

File details

Details for the file kenkui-0.5.0-py3-none-any.whl.

File metadata

  • Download URL: kenkui-0.5.0-py3-none-any.whl
  • Upload date:
  • Size: 83.4 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.28 {"installer":{"name":"uv","version":"0.9.28","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for kenkui-0.5.0-py3-none-any.whl
Algorithm Hash digest
SHA256 7c10e6d600c356b3254e9ef26c11fecc40242ed1775e0681105ff203e61ec313
MD5 092380a6e29fef5dbe4d0e1f7b0a72b1
BLAKE2b-256 2ceda230680f346db5b08adf29d7ba04ed09f6169466cf8d4e2ea87578ad9756

See more details on using hashes here.

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