Skip to main content

Convert EPUB e-books into high-quality audiobooks using Azure Text-to-Speech technology

Project description

EPUB to Speech

English | 中文

Convert EPUB e-books into high-quality audiobooks using Azure Text-to-Speech technology.

Features

  • 📚 EPUB Support: Compatible with EPUB 2 and EPUB 3 formats
  • 🎙️ High-Quality TTS: Uses Azure Cognitive Services Speech for natural voice synthesis
  • 🌍 Multi-Language Support: Supports various languages and voices via Azure TTS
  • 📱 M4B Output: Generates standard M4B audiobook format with chapter navigation
  • 🔧 CLI Interface: Easy-to-use command-line tool with progress tracking

Basic Usage

Convert an EPUB file to audiobook:

epub2speech input.epub output.m4b --voice zh-CN-XiaoxiaoNeural --azure-key YOUR_KEY --azure-region YOUR_REGION

Installation

Prerequisites

  • Python 3.11 or higher
  • FFmpeg (for audio processing)
  • Azure Speech Service credentials

Install Dependencies

# Install Python dependencies
pip install poetry
poetry install

# Install FFmpeg
# macOS: brew install ffmpeg
# Ubuntu/Debian: sudo apt install ffmpeg
# Windows: Download from https://ffmpeg.org/download.html

Azure Speech Service Setup

  1. Create an Azure account at https://azure.microsoft.com
  2. Create a Speech Service resource in Azure Portal
  3. Get your subscription key and region from the Azure dashboard

Quick Start

Environment Variables

Set your Azure credentials as environment variables:

export AZURE_SPEECH_KEY="your-subscription-key"
export AZURE_SPEECH_REGION="your-region"

epub2speech input.epub output.m4b --voice zh-CN-XiaoxiaoNeural

Advanced Options

# Limit to first 5 chapters
epub2speech input.epub output.m4b --voice en-US-AriaNeural --max-chapters 5

# Use custom workspace directory
epub2speech input.epub output.m4b --voice zh-CN-YunxiNeural --workspace /tmp/my-workspace

# Quiet mode (no progress output)
epub2speech input.epub output.m4b --voice ja-JP-NanamiNeural --quiet

Available Voices

For a complete list, see Azure Neural Voices.

How It Works

  1. EPUB Parsing: Extracts text content and metadata from EPUB files
  2. Chapter Detection: Identifies chapters using EPUB navigation data
  3. Text Processing: Cleans and segments text for optimal speech synthesis
  4. Audio Generation: Converts text to speech using Azure TTS
  5. M4B Creation: Combines audio files with chapter metadata into M4B format

Development

Running Tests

python test.py

Run specific test modules:

python test.py --test test_epub_picker
python test.py --test test_tts

Contributing

Contributions are welcome! Please feel free to submit issues or pull requests.

License

This project is licensed under the MIT License - see the LICENSE file for details.

Acknowledgments

Support

For issues and questions:

  1. Check existing GitHub issues
  2. Create a new issue with detailed information
  3. Include EPUB file samples if relevant (ensure no copyright restrictions)”,“file_path”:

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

epub2speech-0.0.1.tar.gz (14.2 kB view details)

Uploaded Source

Built Distribution

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

epub2speech-0.0.1-py3-none-any.whl (16.4 kB view details)

Uploaded Python 3

File details

Details for the file epub2speech-0.0.1.tar.gz.

File metadata

  • Download URL: epub2speech-0.0.1.tar.gz
  • Upload date:
  • Size: 14.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.1.3 CPython/3.13.4 Darwin/25.0.0

File hashes

Hashes for epub2speech-0.0.1.tar.gz
Algorithm Hash digest
SHA256 ae166f82742956abd80a04af5bebb4eb53a286b97a4142a0ae0744851d927250
MD5 a0008f51c08da564b10fc29943839497
BLAKE2b-256 17ed4408abeaf3da5cd0b7fcba10163378756f81b05c779d2fddf7a705521af8

See more details on using hashes here.

File details

Details for the file epub2speech-0.0.1-py3-none-any.whl.

File metadata

  • Download URL: epub2speech-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 16.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.1.3 CPython/3.13.4 Darwin/25.0.0

File hashes

Hashes for epub2speech-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 bf4c01b41cc596ed2f070b04d1cd9cd632dfab9a8239b579d942c361426c6928
MD5 aeac252bb9b78919489974c661fbb250
BLAKE2b-256 1551f7f00e7622bf986d101c0430d3e68b09576f20cce526ae594c7a0c911711

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