Skip to main content

Uses piper-tts to convert epub files to audiobooks

Project description

PiperBook

Converts an epub to a directory of mp3s using piper-tts.

$ piperbook -s 1.0 -p 0.5 -v "en_US-ryan-high" test.epub author/test
19:55:27	MainThread	Chapters count: 5.
19:55:27	MainThread	Converting chapters 1 to 5.
19:55:35	worker-0	[] Wrote file 1_test_epub.mp3
19:55:39	worker-1	[] Wrote file 2_test_epub.mp3
19:58:12	worker-1  [] Wrote file 3_test_epub.mp3
19:59:27	worker-0	[] Wrote file 4_test_epub.mp3
20:00:54	worker-1	[] Wrote file 5_test_epub.mp3
20:00:56	MainThread	Cleaned up 0 from cache.

Supports voices models as listed on the piper Readme

Usage

usage: piperbook [-h] [--start START] [--end END] [-s SPEED] [-v VOICE] [-p PAUSE] [-c] [-j PROCESSES] epub audiobook-folder

Convert epub file to audiobook directory of mp3s

positional arguments:
  epub                  Epub file
  audiobook-folder      Destination folder for the mp3 files

options:
  -h, --help            show this help message and exit
  --start START         chapter to start from [default: 1]
  --end END             chapter to finish at [default: -1]
  -s SPEED, --speed SPEED
                        speed of the generated audio (lower is faster!) [default: 1.0]
  -v VOICE, --voice VOICE
                        voice to use for the generated audio. To see valid options, see the docs for piper [default: en_US-ryan-high]
  -p PAUSE, --pause PAUSE
                        length of pauses between sentences [default: 0.5]
  -c, --clobber         overwrite existing files [default: False]
  -j PROCESSES, --processes PROCESSES
                        number of piper processes to use. Keep this value low--piper is threaded already. [default: 2]

Installation

Tested on Debian 12.

$ apt install python python-pip ffmpeg
$ pip install piperbook
$ piperbook --help

Bugs

Chapter detection and naming is very imperfect. Patches welcome.

TODO

  • m4b format support.
  • Use piper more intelligently

Credit

Epub chapterising logic stolen from epub_to_audiobook.

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

piperbook-2023.9.24.tar.gz (7.6 kB view details)

Uploaded Source

Built Distribution

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

piperbook-2023.9.24-py3-none-any.whl (6.7 kB view details)

Uploaded Python 3

File details

Details for the file piperbook-2023.9.24.tar.gz.

File metadata

  • Download URL: piperbook-2023.9.24.tar.gz
  • Upload date:
  • Size: 7.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: python-requests/2.31.0

File hashes

Hashes for piperbook-2023.9.24.tar.gz
Algorithm Hash digest
SHA256 deb1680bcc45b4d853d0d5ab78dd1ef1b213c6b6c091d46c48e5376a6ec1120c
MD5 118077b2fe799ed93273dc2e06b73c11
BLAKE2b-256 33b20e87a97ed73ba3e9d170811b323363289baf0312cad59ddc7abeaab0135d

See more details on using hashes here.

File details

Details for the file piperbook-2023.9.24-py3-none-any.whl.

File metadata

  • Download URL: piperbook-2023.9.24-py3-none-any.whl
  • Upload date:
  • Size: 6.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: python-requests/2.31.0

File hashes

Hashes for piperbook-2023.9.24-py3-none-any.whl
Algorithm Hash digest
SHA256 906ff52757222570a89c40feb9f79b46629376c6a36acd108e2e5c5b12f6d9db
MD5 13061b87585522f7032c77142e882fe1
BLAKE2b-256 79f16129ce349d2ab803022c65d2b281e91cb761f0f74b0d41ad87c09c1a62ec

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