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.1.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.1-py3-none-any.whl (8.9 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: audiobook_generator-1.0.1.tar.gz
  • Upload date:
  • Size: 6.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.6.4

File hashes

Hashes for audiobook_generator-1.0.1.tar.gz
Algorithm Hash digest
SHA256 c3b8fe95fa8dfb735f81b91023aaf308168d5b93151ea21399af2d5789c68720
MD5 75a4092f05a973602f0c78e856493e75
BLAKE2b-256 9326065f6336272bc2ea775502eecdd6034aa4a4f073624dae4c75b0b6d93276

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for audiobook_generator-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 26403597292a3c571b2b15d12d6080a1c73a87c4457b14a4c47bb40b6d747195
MD5 29a7d0dacf837e0f15a011a9753fe062
BLAKE2b-256 56d03a0940b614896bdadceef4e409da2652a823e9aba6fb9386662a7d3b8d7c

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