Convert EPUB files to audiobooks using audiblez and Modal's cloud GPU.
- Install uv
- Set up Modal authentication:
uvx modal setup
Run the conversion script with your EPUB file:
./audiobook.py path/to/your/book.epub
The script will:
- Upload your EPUB to Modal's cloud storage
- Convert it to audio using
audiblez
- Compress the audio files into a single M4B audiobook
- Download the generated book as
audiobook.m4b
- Clean up the cloud storage
It should take less than 15 minutes and about $0.15 in Modal fees (see "Usage and billing" in Modal settings):
# Download "Hamlet":
wget https://www.gutenberg.org/cache/epub/27761/pg27761.epub
time ./audiobook.py --epub ./pg27761.epub
# lots of output skipped...
real 14m33.014s
ls -lh audiobook.m4b
-rw-r--r-- 1 *** staff 119M Aug 4 14:17 audiobook.m4b
IMPORTANT: when the script exits due to an error, dangling data may be left in the
epub_to_audiobook
volume. Go to Modal storage to delete it.
You can:
- change GPU type from
T4
to another available GPU - increase the timeouts to process a longer book
- change narrating voice, language and speed - see audiblez help