DrewThomasson / ebook2audiobookSTYLETTS2

This simple program makes use of Calibre to convert a ebook into chapters and styletts2 to turn that into a audiobook with voice cloning capabilities

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

ebook_to_audiobook_styletts

This program uses Calibre for converting eBooks into chapters and StyleTTS2 to transform these chapters into an audiobook.

It features text-to-speech technology with an optional voice cloning capability if a voice file is provided.

Demo

chapter_0.mp4

Supported ebook File Types:

.epub, .pdf, .mobi, .txt, .html, .rtf, .chm, .lit, .pdb, .fb2, .odt, .cbr, .cbz, .prc, .lrf, .pml, .snb, .cbc, .rb, and .tcr, (Best results are from using epub or mobi for auto chapter detection)

outputs as a m4b with all book metadata and chapters, example output file in an audiobook player app

Example_of_output_in_audiobook_program

Features

  • Converts eBooks to text format using Calibre's ebook-convert tool.
  • Splits the eBook into chapters for easier processing.
  • Utilizes StyleTTS2 for converting each chapter into an audio file.
  • Offers an optional voice cloning feature when provided with a voice file.

Requirements

  • Python 3.10
  • styletts2 Python package
  • Calibre (for eBook conversion)
  • FFmpeg (for audiobook file creation)
  • Optional: Voice file for voice cloning
  • 4gb ram

Installation Instructions for Dependencies

  • Install Python 3.x from Python.org.
  • Calibre:
    • Ubuntu: sudo apt-get install -y calibre
    • macOS: brew install calibre
    • Windows(Powershell in Administrator mode): choco install calibre
  • FFmpeg:
    • Ubuntu: sudo apt-get install -y ffmpeg
    • macOS: brew install ffmpeg
    • Windows(Powershell in Administrator mode)s: choco install ffmpeg
  • Python packages:
    pip install styletts2 pydub nltk beautifulsoup4 ebooklib tqdm

Usage

Navigate to the script's directory in the terminal and use one of the following commands:

Without Voice Cloning:

python styletts_to_ebook.py <path_to_ebook_file>

Replace <path_to_ebook_file> with the path to your eBook file.

With Voice Cloning:

python styletts_to_ebook.py <path_to_ebook_file> <path_to_voice_file>

Replace <path_to_ebook_file> with the path to your eBook file.

Replace <path_to_voice_file> with the path to the voice file for cloning.

About

This simple program makes use of Calibre to convert a ebook into chapters and styletts2 to turn that into a audiobook with voice cloning capabilities

License:MIT License


Languages

Language:Python 92.9%Language:Batchfile 7.1%