Writing

The Audiobook Nobody Was Going to Narrate

I wanted to listen to a book that will never get a narrator, so I built the narrator. Two years ago that meant one robotic audiobook and a pile of fragile scripts. Now I have a fully automated pipeline for audiobook generation.

5 min read

  • AI
  • Claude Code
  • Audiobooks
  • Text-to-Speech

A good amount of my reading is through audiobooks, either in the car or at my kids’ tennis practice. The trouble is that the books I most want to read will never get a narrator.

So I built one. e2a is an autonomous pipeline that turns an EPUB or PDF into a finished audiobook, narrated in the author’s own cloned voice, with a read-along ebook that highlights each sentence as it’s spoken. My only job is approving a 25-second voice clip. It’s narrated 20 to 30 books so far, and the code is at github.com/frictionlesscode/epubtoaudiobooks.

Two years ago I tried this with Rupert Spira’s The Nature of Consciousness, which has never been recorded, using a local text-to-speech model and a few Python scripts. The voice was robotic, it was slow, and the scripts crashed mid-chapter with no retries, so every failure meant restarting by hand, and I never made a second book.

What happens when I drop a book in the folder

  1. DropAn EPUB or PDF goes into an inbox folder on my Windows PC.
  2. CleanIt becomes chapters of speakable text, with page numbers, headers and footnotes stripped out.
  3. Find a voiceIt searches YouTube for a talk by the author and cuts a 25-second clip.
  4. ApproveI listen on a status page and approve the clip, ask for another, or paste a better link. The only human step.
  5. NarrateA cloned voice reads the whole book, fastest overnight.
  6. PackageIt builds an .m4b audiobook with chapters, cover and metadata, plus an EPUB3 with every sentence timed to the audio.
  7. ReadBoth land in my audiobook server, and my phone plays them, highlighting along.
e2a's queue page: a Rupert Spira book waits for voice approval, then narrates chapter by chapter, then installs with read-along
The queue page, sped up. This replays the real run for The Nature of Consciousness: the voice clip waiting for my approval, 23 chapters over about two and a half days, then installed with read-along.

The models and the boring parts

The voice. Coqui XTTS v2 clones the author from that 25-second clip. Books without an approved voice fall back to Kokoro running through sherpa-onnx, a voice I picked by ear from 18 samples. Both run locally on CPU.

Finding the right person. I wanted this fully autonomous, with no human step at all. It kept finding the wrong clips. When I tried “Keith Dowman talk dzogchen,” most of the results were somebody else reading Dowman’s books aloud, which would have cloned the wrong person. So now e2a runs the searches and cuts the clip itself, and I do one small approval before it narrates.

Read-along. Storyteller’s aligner matches every sentence of the text to its moment in the audio at about 80 times realtime, so a four-hour book aligns in just over four minutes. What comes out is an EPUB3 with Media Overlays, a W3C standard that packs the text, the audio and the sync map into one file. Both files go into Audiobookshelf, a free, self-hosted replacement for Audible, and on my phone Absorb, a free Android client for it, plays the EPUB and highlights each sentence as it’s spoken. Mostly I listen. When a passage gets dense, I switch to reading along so the highlight keeps my eyes on the sentence.

Absorb playing The Nature of Consciousness, chapter 2, recorded on my phone. Turn the sound on to hear the cloned voice land on each highlighted sentence.
e2a's scanner page listing seven books with read-along, all Rupert Spira, Keith Dowman and Francis Lucille titles
The scanner page in e2a's local web app. Seven books have read-along so far, and The Nature of Consciousness is one of them.

PDFs. They’re harder than EPUBs. Running headers, page numbers and footnotes all have to go, because hearing “twelve, Being Guru Rinpoche” between paragraphs ruins a book.

Everything my first attempt lacked.

  • One book at a time, and never a half-copied file.
  • Full speed overnight, throttled during the day so my PC stays usable.
  • A reboot mid-book resumes from cached narration.
  • A book that keeps crashing moves to a failed folder instead of blocking the rest.
  • Every run emails me a summary.
  • Books that already have a human narrator are skipped.

Rinpoche is not a typo

Most of what I read is Tibetan Buddhism and Advaita, which means Sanskrit and Tibetan words on every page. The first book through the pipeline, Dowman’s The Flight of the Garuda, mispronounced a lot of them, including Dzogchen, a word in the book’s own subtitle. A model’s guess can change from one chunk to the next, so I wanted a lookup that always gives the same answer. e2a rewrites each word before the voice sees it, using hand-checked lists of 117 Tibetan and 173 Sanskrit terms, plus spelling rules for anything not on them.

Dzogchen becomes zog-chen and Rinpoche becomes rin-poh-shay. Fix a word once and every later book gets it.

What AI actually changed

The voice models got better, but the bigger change is that the boring engineering became cheap. Two years ago I skipped retries, crash recovery and tests because they’d have taken longer than the book itself. This time I described each feature, Claude Code planned it, built it and tested it, and the whole pipeline came together in about six weeks. When doing it properly costs about the same as doing it badly, you stop doing it badly.

Where it’s still rough

  1. It’s slow without a GPU. The cloned voice runs slower than realtime on my i5, and with the daytime throttling a book takes anywhere from 8 hours to two and a half days. The Flight of the Garuda took 44.
  2. It’s personal use only. The clones come from public talks without the authors’ consent, which is why the books never leave my own library.

The Nature of Consciousness went through the new pipeline too. Two years after the robotic version, it finally has a good voice, it’s only for me, and it’s on my phone for the next tennis practice.