An open API service indexing awesome lists of open source software.

https://github.com/firedev/epub2audiobook

Convert EPUB books to audiobooks using Microsoft Edge TTS. Free, no API key required.
https://github.com/firedev/epub2audiobook

Last synced: 17 days ago
JSON representation

Convert EPUB books to audiobooks using Microsoft Edge TTS. Free, no API key required.

Awesome Lists containing this project

README

          

# epub2audiobook

Convert EPUB books to audiobooks using Microsoft Edge TTS. Free, no API key required.

Designed for Russian-language books but works with any language supported by Edge TTS.

## Install

### macOS

```bash
brew install python ffmpeg
git clone https://github.com/firedev/epub2audiobook.git
cd epub2audiobook
python3 -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt
```

### Linux (Debian/Ubuntu)

```bash
sudo apt install python3 python3-venv ffmpeg
git clone https://github.com/firedev/epub2audiobook.git
cd epub2audiobook
python3 -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt
```

## Usage

```bash
# Russian male voice (default)
python epub2audio.py book.epub

# Russian female voice
python epub2audio.py book.epub --voice ru-RU-SvetlanaNeural

# Custom output directory
python epub2audio.py book.epub --output ./my_audiobook

# Faster speech
python epub2audio.py book.epub --rate "+15%"

# Chapter files only, no combined file
python epub2audio.py book.epub --no-merge
```

## Options

| Flag | Default | Description |
|------|---------|-------------|
| `epub_file` | required | Path to .epub file |
| `--voice` | `ru-RU-DmitryNeural` | Edge TTS voice ID |
| `--output` | `./output` | Output directory |
| `--no-merge` | false | Keep individual chapter files only, don't concatenate into one MP3 |
| `--rate` | `+0%` | Speech rate (`+10%`, `-5%`, etc.) |

## Chapter splitting

Chapters are split using the EPUB's NCX table of contents, which provides anchor-level granularity. A single HTML file containing multiple chapters (common in FB2-converted EPUBs) is split at each TOC anchor point. Section titles from the TOC (story names, part headings) are preserved as separate short chapters. Falls back to spine-based splitting when no TOC is present.

## Output

```
output/
book-name/
01_Chapter_One.mp3
02_Chapter_Two.mp3
...
book-name_complete.mp3 # all chapters merged
```

Re-running is safe — existing chapters and chunks are skipped (0-byte files from failed runs are re-generated). If a network error interrupts conversion, re-run the same command and it picks up from the last successful chunk.

## Voices

Russian voices:
- `ru-RU-DmitryNeural` — male, clear, neutral
- `ru-RU-SvetlanaNeural` — female, clear, neutral

List all available voices:

```bash
edge-tts --list-voices | grep ru-RU
```

Works with any Edge TTS voice. For English: `en-US-GuyNeural`, `en-US-JennyNeural`, etc.

## Requirements

- Python 3.10+
- ffmpeg (for concatenating chapter MP3s)

## License

MIT