text-to-audiobook
v0.1.0
Published
CLI tool to convert text files to audiobooks with chapter detection and cover art support
Maintainers
Readme
text‑to‑audiobook
The first open‑source package that turns any EPUB into an audiobook that’s actually pleasant to listen to.
Features
- Sounds like a human: Accurate pronunciation and smooth delivery thanks to OpenAI's
gpt-4o-mini-tts. - Instant playback: Listen chapter‑by‑chapter right away; no need to wait for the whole book to be created.
- Universal format: Drop the finished file into Apple Books or any other audiobook player.
- Price transparency: See the estimated cost upfront and confirm before a cent is spent.
- Seamless restarts: Pause anytime and resume later without re‑processing completed chapters.
- Cleaner chapters: Automatically trims forewords, indexes, and other filler you’d rather skip.
Installation
Prerequisites
Install text-to-audiobook
npm install -g text-to-audiobookQuickstart
Set your OpenAI API key as an environment variable:
export OPENAI_API_KEY="sk‑..."Convert your EPUB file to an audiobook:
text-to-audiobook WarAndPeace.epubDuring the run you’ll see a cost breakdown like:
Cost estimate (gpt-4o-mini-tts: text @ $0.60/M • audio @ $12/M)
────────────────────────────────────────────────────────────
Already spent ≈ $1.3275
Remaining cost ≈ $0.9824
────────────────────────────────────────────────────────────
Total cost ≈ $2.3099
Proceed with the remaining cost? [y/N]Answer Y to begin the conversion. A progress bar will track each chapter, and an .m4b file will appear in your directory as soon as the first chapter finishes. Open the .m4b file in any audiobook player whenever you’re ready.
Contributing
PRs are welcome! For major changes, open an issue to discuss what you’d like to add or change.
License
This project is licensed under the MIT License.
