# How to Convert an EPUB to an M4B Audiobook in a Cloned Voice (No GPU, Open Source)

> Source: <https://dev.to/miragea-voice/how-to-convert-an-epub-to-an-m4b-audiobook-in-a-cloned-voice-no-gpu-open-source-25pk>
> Published: 2026-11-13 02:06:38+00:00

If you have searched for "EPUB to audiobook" you have probably met tools that want PyTorch, a few gigabytes of model weights and a GPU. This tutorial does the same job from a plain command line: **miragea-audiobook** reads an EPUB, Markdown or text file, narrates it through the Miragea API in a voice cloned from a short sample, and gives you one chaptered `.m4b`.

`brew install ffmpeg` or `apt install ffmpeg`)

```
pipx install miragea-audiobook
export MIRAGEA_API_KEY=...
miragea-audiobook chapters book.epub
miragea-audiobook plan book.epub
```

EPUB chapters come from the spine and each file's first heading. Covers and copyright stubs under 20 words are skipped. For Markdown, each `##` heading is a chapter; for plain text, lines starting with "Chapter", "Part", "Prologue" and similar.

```
miragea-audiobook make book.epub \
  --voice 'https://example.com/my-voice.wav|Exact words spoken in that sample.' --split
```

The text is cut into whole-sentence chunks (900 characters by default), voiced in parallel, and cached by request hash. If something fails halfway, run the same command again: finished chunks are reused and not billed twice.

`the-salt-road.m4b` with chapter markers, a `.cue` sheet, a `.chapters.txt` list ready for YouTube descriptions, a JSON manifest and one MP3 per chapter. Here is the real waveform of the demo book, with the markers at the chapter starts:

Listen to the real demo: [https://codeberg.org/miragea-voice/miragea-audiobook/raw/branch/main/examples/demo/the-salt-road.m4b](https://codeberg.org/miragea-voice/miragea-audiobook/raw/branch/main/examples/demo/the-salt-road.m4b)

I ran chapter 1 back through speech recognition and it matched the source text word for word.

`--preview` first on a big book: it builds the whole file offline with placeholder tones so you can check chapters and timing for free.`--chapters 1-3` voices just a few chapters while you audition a voice.
Source (MIT): [https://codeberg.org/miragea-voice/miragea-audiobook](https://codeberg.org/miragea-voice/miragea-audiobook). Package: [https://pypi.org/project/miragea-audiobook/](https://pypi.org/project/miragea-audiobook/)
