Skip to main content

Generate audiobooks (mp3 files per chapter) from ebooks (currently only supports the epub format).

Project description

audiobook-generator - Generate audiobooks (epub) from ebooks (one mp3 per chapter)

Flow

graph TD;
    A[Input file] --> B["Convert to text and chapterize (Optionally extract out the cover image)"];
    B --> C[Transform to audio files];

Usage

Prerequisites

  • Python 3.10+ (This program was tested on 3.12)
  • (Optional) Install espeak-ng (On Debian/Ubuntu, run apt install -y espeak-ng)
  • (Development only) uv

For End Users

  • You DON'T need to clone this repository, but simply install it via pip (Virtual environment highly recommended, if you use pipx instead, virtual environments are automatically created for you.)
    • pip install audiobook-generator
  • Convert your epub file to audiobooks via the command
    • abg <epub path> <audio output directory>
  • If you want to see all the command line switches, just run abg -h

For Development

  • This program uses uv for dependency management and execution in development, install it first if you haven't done so.
  • To run the program from its source:
    • Clone this repository and cd inside.
    • (Do it ONCE only at the first time) Run uv sync to create the virtual environment in the .env directory and download all the dependencies.
    • Then run the following command
      • uv run -m audiobook_generator.main ...

CPU or GPU?

The selection to run the model on CPU or GPU is automatic, meaning:

  • On Windows/WSL/Linux, If you have Nvidia graphic card with the driver properly installed, the model will be loaded to GPU (cuda) and executed, otherwise, the CPU is used (which is slower compared to GPU)
  • On Mac, you need to set the environment variable PYTORCH_ENABLE_MPS_FALLBACK=1 for it to run on GPU (because at the time of writing, the MPS support in PyTorchis is not complete and it won't work without the CPU fallback), otherwise it will run on CPU.

Tip

You can use the following epub for testing: https://github.com/daisy/epub-accessibility-tests/releases/download/fundamental-2.0/Fundamental-Accessibility-Tests-Basic-Functionality-v2.0.0.epub

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

audiobook_generator-1.0.3.tar.gz (6.7 kB view details)

Uploaded Source

Built Distribution

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

audiobook_generator-1.0.3-py3-none-any.whl (8.9 kB view details)

Uploaded Python 3

File details

Details for the file audiobook_generator-1.0.3.tar.gz.

File metadata

  • Download URL: audiobook_generator-1.0.3.tar.gz
  • Upload date:
  • Size: 6.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for audiobook_generator-1.0.3.tar.gz
Algorithm Hash digest
SHA256 2476925a8d8fe41efb17b621f9745569258d02fc2f3d6fe20d18516032a2c904
MD5 a8ecf9da5f3e44ef84352d22574dc7c5
BLAKE2b-256 02bdb078d111923246966527a2222c1ac0ce32eca591744f77bf3bd5bffe11ee

See more details on using hashes here.

Provenance

The following attestation bundles were made for audiobook_generator-1.0.3.tar.gz:

Publisher: python-publish.yml on houtianze/audiobook-generator

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

File details

Details for the file audiobook_generator-1.0.3-py3-none-any.whl.

File metadata

File hashes

Hashes for audiobook_generator-1.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 d76a0a0ba4ac3f6e0a4003c4797ef1f165a59047b556fbfd20959513b7f8f554
MD5 7261ad03c38b471da57f7355c7045270
BLAKE2b-256 d42424b74b32aeccc1f0d055b787174ee939866e4a8a7b2ed128b6fcb8f2c978

See more details on using hashes here.

Provenance

The following attestation bundles were made for audiobook_generator-1.0.3-py3-none-any.whl:

Publisher: python-publish.yml on houtianze/audiobook-generator

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