Skip to main content

AI Audiobook Generator - Convert books to narrated audiobooks

Project description

Audiobooker

AI Audiobook Generator - Convert EPUB/TXT books into professionally narrated audiobooks using multi-voice synthesis.

Features

  • Multi-voice synthesis: Assign unique voices to each character
  • Dialogue detection: Automatically identifies quoted dialogue vs narration
  • Review-before-render: Human-editable review format for correcting attributions
  • Chapter management: Preserves book structure with chapter markers
  • Flexible casting: Manual voice assignment with emotion control
  • M4B output: Professional audiobook format with chapter navigation
  • Project persistence: Save/resume rendering sessions

Installation

# Clone and install
git clone https://github.com/mcp-tool-shop/audiobooker
cd audiobooker
pip install -e .

# Required: voice-soundboard for TTS
pip install -e ../voice-soundboard

# Required: FFmpeg for audio assembly
# Windows: winget install ffmpeg
# Mac: brew install ffmpeg
# Linux: apt install ffmpeg

Quick Start

# 1. Create project from EPUB
audiobooker new mybook.epub

# 2. Assign voices to characters
audiobooker cast narrator bm_george --emotion calm
audiobooker cast Alice af_bella --emotion warm
audiobooker cast Bob am_michael --emotion grumpy

# 3. Compile and review
audiobooker compile
audiobooker review-export     # Creates mybook_review.txt

# 4. Edit the review file to fix attributions, then import
audiobooker review-import mybook_review.txt

# 5. Render
audiobooker render

Review Workflow (v0.2.0)

The review workflow lets you inspect and correct the compiled script before rendering:

# Export to review format
audiobooker review-export

# Edit the file (example: mybook_review.txt)
# === Chapter 1 ===
#
# @narrator
# The door creaked open.
#
# @Unknown              <-- Change this to @Marcus
# "Hello?" he whispered.
#
# @Sarah (worried)      <-- Emotions are preserved
# "Is anyone there?"

# Import corrections
audiobooker review-import mybook_review.txt

# Render with corrected attributions
audiobooker render

Review file format:

  • === Chapter Title === - Chapter markers
  • @Speaker or @Speaker (emotion) - Speaker tags
  • # comment - Comments (ignored on import)
  • Delete blocks to remove unwanted utterances
  • Change @Unknown to @ActualName to fix attribution

Python API

from audiobooker import AudiobookProject

# Create from EPUB
project = AudiobookProject.from_epub("mybook.epub")

# Cast voices
project.cast("narrator", "bm_george", emotion="calm")
project.cast("Alice", "af_bella", emotion="warm")

# Compile (detect dialogue, attribute speakers)
project.compile()

# Review workflow
review_path = project.export_for_review()
# ... edit the file ...
project.import_reviewed(review_path)

# Render to M4B
project.render("mybook.m4b")

# Save project for later
project.save("mybook.audiobooker")

Casting Table

The casting table maps characters to voices:

# Cast with emotion
project.cast("Gandalf", "bm_george", emotion="wise", description="Ancient wizard")

# Cast dialogue character
project.cast("Frodo", "am_adam", emotion="nervous")

# Unknown speakers fall back to narrator
project.casting.unknown_character_behavior = "narrator"

Inline Overrides

Override voice/emotion for specific passages in your source text:

[Alice|angry] "How dare you!"

[Bob|whisper] "Shh, they'll hear us."

[narrator] The tension was palpable.

Dialogue Detection

Audiobooker uses heuristics to detect dialogue:

  1. Text in "double quotes" (or smart quotes) -> dialogue
  2. Attribution patterns: "said Alice", "Bob whispered" -> speaker detection
  3. Everything else -> narrator

For best results, ensure your source text has properly formatted dialogue.

CLI Commands

Command Description
audiobooker new <file> Create project from EPUB/TXT
audiobooker cast <char> <voice> Assign voice to character
audiobooker compile Compile chapters to utterances
audiobooker review-export Export script for human review
audiobooker review-import <file> Import edited review file
audiobooker render Render audiobook
audiobooker info Show project information
audiobooker voices List available voices
audiobooker chapters List chapters
audiobooker speakers List detected speakers

Project File Format

Projects are saved as JSON (.audiobooker):

{
  "schema_version": 1,
  "title": "My Book",
  "author": "Author Name",
  "chapters": [...],
  "casting": {
    "characters": {
      "narrator": {"voice": "bm_george", "emotion": "calm"},
      "alice": {"voice": "af_bella", "emotion": "warm"}
    }
  }
}

Requirements

  • Python 3.10+ (3.11 recommended for voice-soundboard compatibility)
  • voice-soundboard - TTS engine
  • FFmpeg - Audio assembly
  • ebooklib - EPUB parsing

Architecture

audiobooker/
├── parser/          # EPUB, TXT parsing
├── casting/         # Dialogue detection, voice assignment
├── renderer/        # Audio synthesis
├── review.py        # Review format export/import
└── cli.py           # Command-line interface

Flow:

Source File -> Parser -> Chapters -> Dialogue Detection ->
Utterances -> Review/Edit -> TTS (voice-soundboard) ->
Chapter Audio -> FFmpeg -> M4B with Chapters

Roadmap

  • v0.1.0 - Core pipeline (parse, cast, compile, render)
  • v0.2.0 - Review-before-render workflow
  • v0.3.0 - BookNLP integration for speaker suggestions
  • v0.4.0 - Voice suggestion based on character traits
  • v0.5.0 - Emotion inference from context

License

MIT

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

audiobooker_ai-0.2.1.tar.gz (41.8 kB view details)

Uploaded Source

Built Distribution

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

audiobooker_ai-0.2.1-py3-none-any.whl (34.6 kB view details)

Uploaded Python 3

File details

Details for the file audiobooker_ai-0.2.1.tar.gz.

File metadata

  • Download URL: audiobooker_ai-0.2.1.tar.gz
  • Upload date:
  • Size: 41.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.0

File hashes

Hashes for audiobooker_ai-0.2.1.tar.gz
Algorithm Hash digest
SHA256 f9a67955148f8c4fef0f7baaa1a45ae2d5a28a143f5499d793765fcaf3301209
MD5 242ed8fca03530c802e2fc98f60015bb
BLAKE2b-256 6d6543b1c0c4a8e98d8baad1d3a81f714a2a6923605797f7eb49e6e22912cc1b

See more details on using hashes here.

File details

Details for the file audiobooker_ai-0.2.1-py3-none-any.whl.

File metadata

  • Download URL: audiobooker_ai-0.2.1-py3-none-any.whl
  • Upload date:
  • Size: 34.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.0

File hashes

Hashes for audiobooker_ai-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 f0d32efd08b409c3d47e148e6e99e4131a57331e5f592823b46f2cbb08cd2e19
MD5 2024dca8021e3e1b102635be11faf410
BLAKE2b-256 7a0ae4ea9e7c675938effe9feba1a4ac5cbeabbc246bc6872affe8ece65129d3

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