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.2.tar.gz (6.6 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.2-py3-none-any.whl (8.9 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: audiobook_generator-1.0.2.tar.gz
  • Upload date:
  • Size: 6.6 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.2.tar.gz
Algorithm Hash digest
SHA256 3982b5413327bef2fdae5302f56a97d5b2baf428a7c81d2706184d563a7367a5
MD5 32770895469ca3f24b39eea6b74ef23a
BLAKE2b-256 138c3887fc08d8e3dc88e0bbe5e3a7dae58b363e90280d59d6200042834ad037

See more details on using hashes here.

Provenance

The following attestation bundles were made for audiobook_generator-1.0.2.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.2-py3-none-any.whl.

File metadata

File hashes

Hashes for audiobook_generator-1.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 a2bd0dd1bd3b199bd98ad3bd1848abd3bb8b5902f5aff2c95c40c64d624b2c26
MD5 14714083046be136802b93e2fa07ee28
BLAKE2b-256 40ddce52081522b03bca934c233c2a34a0e14ae0ebe6b461fa72b135f0f68000

See more details on using hashes here.

Provenance

The following attestation bundles were made for audiobook_generator-1.0.2-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