Local-first audiobook player for PDF, EPUB, DOCX, and TXT with Kokoro TTS + PyQt6.
Current implementation includes:
- CLI playback (
audiobook.py) - Desktop GUI (
audiobook_gui.py) - Voice/speed/volume controls
- Lookahead audio buffering for smoother playback
- Raw PDF viewer mode with zoom/fit/scroll controls
- Voice Hub for adding/downloading Kokoro voice ids
966 lines | v2.0 | Production-ready implementation guide
The comprehensive planning document covering:
- TTS model research and selection (Kokoro-82M recommended)
- Complete system architecture with threading model
- All 10 text cleaning pipeline stages (with code)
- Error handling and recovery strategies
- Testing strategy (unit, integration, manual QA)
- Platform-specific considerations (Windows/Mac/Linux)
- Quick reference for implementers
Start here: Read sections 1-4 for overview, then jump to Section 17 for implementation checklist.
Summary of v1.0 → v2.0 improvements
Quick overview of what was added in the comprehensive revision:
- 6 new sections
- 3 major expansions
- Production-ready status
Version history and change tracking
Detailed changelog following semantic versioning:
- v2.0.0: Comprehensive revision (current)
- v1.0.0: Original research document
Install project dependencies and NLTK tokenizer data before running:
pip install -r requirements.txt
python -m nltk.downloader punkt punkt_tab- Read pdf_audiobook_plan.md sections 1-3 (Vision, TTS Research, Architecture)
- Review Section 10 (Key Design Decisions)
python audiobook.py path\to\book.pdfThe CLI extracts text, chunks by sentence, synthesizes, and plays audio in the terminal.
# Install PyQt6 first
pip install PyQt6
# Launch GUI with optional PDF
python audiobook_gui.py [path\to\book.pdf]
# Or use the CLI flag
python audiobook.py --gui [path\to\book.pdf]The GUI features:
- Chapter sidebar with navigation
- Synchronized text highlighting
- Playback controls with progress bar
- Voice selector, speed, and volume
- Lookahead synthesis buffering with bounded memory cache
- Raw PDF view toggle (Text <-> PDF)
- PDF controls: Prev/Next page, zoom, fit width/page, Ctrl+wheel zoom
- Voice Hub for downloadable/custom voice ids
- Catppuccin Mocha dark theme
- Read REVISION_SUMMARY.md first
- Check CHANGELOG.md for detailed changes
- Look for ⭐ markers in the main document (new v2.0 content)
| Metric | Value |
|---|---|
| Total lines | 966 |
| Sections | 17 |
| Code examples | ~35 |
| Dependencies | 11 libraries |
| Implementation phases | 4 (0-3) |
| Estimated MVP time | 1-2 days |
| Estimated full app time | 9-15 days |
Phase: All phases implemented ✅ (0-4)
Current app: CLI + PyQt6 Desktop GUI with multi-format support, bookmarks, config, and WAV export
Readiness: Production-ready MVP with tests (65 passing)
- Scanned/image-only PDFs still require OCR to produce playable text.
- Voice availability depends on Kokoro upstream voice ids and network availability for first-time downloads.
- Raw PDF mode is PDF-only; EPUB/DOCX/TXT use text mode.
| Decision | Choice | Rationale |
|---|---|---|
| TTS Model | Kokoro-82M | Best CPU speed/quality ratio (82M params, <300ms latency) |
| Memory Strategy | Sliding window buffer | O(1) memory regardless of doc length |
| Audio Engine | sounddevice | Low latency, cross-platform |
| GUI Framework | PyQt6 | Best text highlighting support |
| PDF Viewer | PyMuPDF-rendered raw pages | Native local rendering with zoom + fit controls |
| Chunk Granularity | Sentence-level | Aligns with Kokoro 510-token limit |
| Section | Focus Area | Status |
|---|---|---|
| 1-2 | Vision & TTS Research | ✅ Complete |
| 3-4 | Architecture & Core Systems | ✅ Complete (v2.0 threading) |
| 5 | Text Cleaning Pipeline | ✅ Complete (v2.0 all stages) |
| 6-7 | UI & File Formats | ✅ Complete |
| 8 | Implementation Phases | ✅ Complete (v2.0 bookmarking) |
| 9-10 | Dependencies & Design | ✅ Complete |
| 11 | Edge Cases & Errors | ✅ Complete (v2.0 recovery) |
| 12 | Performance Targets | ✅ Complete |
| 13 | Testing Strategy | ✅ Complete (v2.0 NEW) |
| 14 | Platform Support | ✅ Complete (v2.0 NEW) |
| 15 | Future Enhancements | ✅ Complete |
| 16 | Starter Code | ✅ Complete |
| 17 | Quick Reference | ✅ Complete (v2.0 NEW) |
- Edit pdf_audiobook_plan.md
- Update CHANGELOG.md with changes
- Bump version number in footer
- Update REVISION_SUMMARY.md if major changes
- Open issue with section number and proposed change
- Tag with
documentationlabel - Reference specific line numbers
For Project Managers: → Sections 1, 8, 12 (Vision, Phases, Performance Targets)
For Architects: → Sections 2-4, 10 (TTS Research, Architecture, Design Decisions)
For Developers: → Sections 17, 16, 4, 5 (Quick Ref, Starter Code, Core Systems, Pipeline)
For QA Engineers: → Sections 11, 13 (Edge Cases, Testing Strategy)
For DevOps: → Sections 9, 14 (Dependencies, Platform Considerations)
This repository now contains both implementation and planning artifacts:
audiobook.pyand tests for core synthesis/playback behaviorui/package for desktop GUI features (viewer, controls, export, config, bookmarks)pdf_audiobook_plan.mdand related docs for architecture and future phases
Planning documents: CC BY 4.0
Recommended implementation license: Apache 2.0 or MIT
(Kokoro-82M is Apache 2.0)
Repository Version: 2.1
Last Updated: 2026-04-05
Status: ✅ CLI + GUI implemented
Primary Author: Research, Planning, and Implementation Team
Start building: Jump to Section 17 - Quick Reference →