Skip to content
emmilcoPublic

About

Convert scholarly books into audiobook-quality m4b files — audited extraction, local LLM cleanup, voice-cloned TTS. Apple Silicon, fully local.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

legomenon

Legomenon converts books — scanned PDFs, digital PDFs, EPUB, HTML — into m4b audiobooks with chapter markers, using local neural TTS with voice cloning. Everything runs on your own Apple Silicon machine; nothing leaves it. It was built for scholarly books, whose typography — footnotes, block quotes, editorial apparatus, imperfect scans — defeats simpler tools, and was hardened on several dozen philosophy texts: Rorty, Brandom, Gadamer, Berlin, Adorno and Horkheimer.

The standard

The pipeline is judged against a practiced human reader: someone who knows the material, reading the book aloud. That standard has two parts.

Fidelity — what is said. Everything the author wrote and nothing else, translated from page to voice as a reader would translate it. Page numbers, running headers, and footnote markers go unspoken; abbreviations are expanded, citations handled naturally, notation pronounced rather than spelled. Nothing is skipped, nothing paraphrased, nothing invented.

Delivery — how it sounds. A measured, intelligent reading whose emphasis and pausing follow the argument. The ideal is audio indistinguishable from a human reader; the acceptance bar is that a difficult argument can be followed without effort.

Delivery failures are audible. Fidelity failures are silent, and most of the pipeline exists to prevent them.

Design

Most text-to-speech pipelines couple a text extractor to a TTS loop and trust both. Legomenon treats silent content loss as the central failure and verifies every stage that could cause it:

  • Structural extraction. A layout detector and a bidirectional conservation net convert PDF pages into classified records — body, heading, footnote, figure text — so block quotes are not misread as headings and footnotes are not spoken mid-sentence.
  • Cleanup under a conservation contract. A local LLM (Gemma 4 26B) prepares each record for speech by emitting edit operations that are applied mechanically. Unedited words survive by construction; malformed output flags the record instead of shipping altered text.
  • An audit gate. Dozens of checks run before any text is accepted: every dropped record must be accounted for, every kept record must conserve its source words, and judgment-model verifiers flag cross-page fusions and misclassifications. On failure the pipeline halts and presents the problem rather than guessing.
  • A source↔audio integrity gate (PDF books). An independent VLM re-reads each source page and aligns it against the text to be spoken. Rendering is blocked until every divergence is dispositioned.
  • Rendering with defect detection. Per-sentence rendering (Higgs Audio v3, cloned from ~30 seconds of reference audio), automatic repair of dropped sentence onsets, duration-based validation, and m4b assembly with chapter markers.

The legomenon pipeline — twelve stages, two hard gates, from page to voice

What you need

  • Apple Silicon Mac with 48 GB+ unified memory (the cleanup LLM is ~15 GB, the integrity-gate VLM ~34 GB, the TTS model ~4–9 GB — they run serially, not together).
  • Disk for model weights (~60 GB across the model set) and patience for the unattended GPU stages: a 100k-word book is roughly 7 hours of rendering plus, for PDF sources, a comparable integrity-transcription pass.
  • A voice. No reference voice ships with the repo — you record ~30 seconds yourself or bring a permissively-licensed recording. See VOICE_SETUP.md; the tools/check_ref.py helper screens and installs it.
  • ffmpeg, Tesseract, Python 3.12, uv.

Getting started

  1. INSTALL.md — environments, models, configuration.
  2. VOICE_SETUP.md — set up your reference voice.
  3. USER_GUIDE.md — the full pipeline, stage by stage, including the worked example (William James, Pragmatism, fetched from Project Gutenberg).

The pipeline runs by hand or under an AI agent. The USER_GUIDE is a complete by-hand recipe; the repo also ships an AGENTS.md operator guide (with a CLAUDE.md loader for Claude Code) that turns an AI coding agent into a competent pipeline operator — running stages, reading halts, and handling the judgment-heavy triage under your direction.

Licensing

  • Code: MIT (see LICENSE).
  • Models: their own licenses. In particular the default TTS renderer, Higgs Audio v3, is released for research/non-commercial use — audio produced with the default renderer is for personal, non-commercial listening. The extraction and cleanup stages are renderer-agnostic if you swap in a differently-licensed TTS backend.
  • Books: you are responsible for having the right to convert the books you feed it. The worked example uses a public-domain text.

About

Convert scholarly books into audiobook-quality m4b files — audited extraction, local LLM cleanup, voice-cloned TTS. Apple Silicon, fully local.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages