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 hashes)

Uploaded Source

Built Distribution

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

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page