Skip to content

Latest commit

 

History

History

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 

README.md

Audiobook Generator

Convert any text file into a narrated audiobook. Splits long text into chapters, generates audio for each, and combines them into a single file.

Features

  • Read text from a file or stdin
  • Automatically split into chapters by paragraph breaks or custom markers
  • Generate audio with a consistent narrator voice
  • Combine all chapters into a single WAV file
  • Individual chapter files saved for easy navigation

Requirements

Base dependencies are installed via the root requirements.txt. See the main README for setup. Add SMALLEST_API_KEY to your .env.

Usage

From a text file:

uv run generate.py story.txt

With custom options:

uv run generate.py story.txt --voice magnus --speed 0.9 --chapter-marker "---"

From inline text (for quick testing):

uv run generate.py --text "Once upon a time, in a land far away, there lived a curious inventor."

Configuration

Parameter Description Default
--voice Narrator voice sophia
--speed Narration speed (0.5–2.0) 1.0
--model TTS model lightning-v3.1
--chapter-marker Text that separates chapters ---
--max-chunk Max characters per API call 500
--text Inline text instead of file

Output

audiobook_output/
├── audiobook.wav        # Full audiobook
├── chapter_01.wav       # Individual chapters
├── chapter_02.wav
└── ...

Tips

  • For best results, use clear paragraph breaks in your text
  • The --chapter-marker flag lets you control exactly where chapters split
  • Long paragraphs are automatically chunked (max 500 chars) for reliable synthesis
  • Use --speed 0.9 for a more relaxed narration pace

API Reference

Next Steps