diff --git a/.github/workflows/pip-install.yaml b/.github/workflows/pip-install.yaml index 4027cbd..5e204a7 100644 --- a/.github/workflows/pip-install.yaml +++ b/.github/workflows/pip-install.yaml @@ -2,7 +2,7 @@ name: GitHub Action for installing and testing the package on Python 3.11 run-name: pip install and run on: [ push, pull_request ] jobs: - build: + install-and-run: runs-on: ubuntu-latest steps: - name: Set up Python 3.11 diff --git a/README.md b/README.md index 8bb6d6e..6df2133 100644 --- a/README.md +++ b/README.md @@ -1,44 +1,63 @@ -# Audiblez: Create audiobooks from e-books +# Audiblez: Generate audiobooks from e-books -Audiblez converts .epub into .mp3 using high-quality and lightweight Kokoro-82M text-to-speech models. +Audiblez generates `.m4b` audiobooks from regular `.epub` e-books, +using Kokoro's high-quality speech synthesis. +[Kokoro v0.19](https://huggingface.co/hexgrad/Kokoro-82M) is a recently published text-to-speech model with just 82M params and very natural sounding output. +It's released under Apache licence and it was trained on < 100 hours of audio. +It currently supports American, British English, French, Korean, Japanese and Mandarin, and a bunch of very good voices. -# How to install +An example of the quality: -``` -pip install audiblez # via Python PIP + -brew install audiblez # On MacOSX via homebrew +On my M2 MacBook Pro, **it takes about 2 hours to convert to mp3 the Selfish Gene by Richard Dawkins**, which is about 100,000 words (or 600,000 characters), +at a rate of about 80 characters per second. -apt get install audiblez # On Ubuntu/Debian +## How to install and run + +If you have python3 on your computer, you can install it with pip. +Then you also need to download the onnx and voices files in the same folder, which are about ~360MB: + +```bash +pip install audiblez +wget https://github.com/thewh1teagle/kokoro-onnx/releases/download/model-files/kokoro-v0_19.onnx +wget https://github.com/thewh1teagle/kokoro-onnx/releases/download/model-files/voices.json ``` +Then to convert an epub file into an audiobook, just run: -# From sources - -``` -# Get the model -wget +```bash +audiblez book.epub -l en-gb -v af_sky ``` +It will first create a bunch of `book_chapter_1.wav`, `book_chapter_2.wav`, etc. files in the same directory, +and at the end it will produce a `book.m4b` file with the whole book you can listen with VLC or any + audiobook player. +It will only produce the `.m4b` file if you have `ffmpeg` installed on your machine. -# How to run +## Supported Languages -`audiblez book.epub book.mp3` +- πŸ‡ΊπŸ‡Έ en-US +- πŸ‡¬πŸ‡§ en-GB +- πŸ‡«πŸ‡· fr-FR +- πŸ‡―πŸ‡΅ ja-JP +- πŸ‡°πŸ‡· ko-KR +- πŸ‡¨πŸ‡³ zh-CN -# Change language +## Supported Voices -use `-l` to specify language, eg: +You can try them here: [https://huggingface.co/spaces/hexgrad/Kokoro-TTS](https://huggingface.co/spaces/hexgrad/Kokoro-TTS) -`audiblez -l en-gb book.epub book.mp3` - -Kokoro supports these languages: - -``` -en-us -en-gb -fr-fr -``` - -# Change voice +- af +- af_bella +- af_nicole +- af_sarah +- af_sky +- am_adam +- am_michael +- bf_emma +- bf_isabella +- bm_george +- bm_lewis diff --git a/audiblez.py b/audiblez.py index b59ba2c..aff525b 100755 --- a/audiblez.py +++ b/audiblez.py @@ -1,8 +1,7 @@ #!/usr/bin/env python3 -# audiblez - A program to convert e-books into audiobooks using high-quality -# Kokoro-82M text-to-speech model. -# Distributed under the MIT License for educational purposes. -# by Claudio Santini (2025) - https://claudio.uk +# audiblez - A program to convert e-books into audiobooks using +# Kokoro-82M model for high-quality text-to-speech synthesis. +# by Claudio Santini 2025 - https://claudio.uk import argparse import sys diff --git a/pyproject.toml b/pyproject.toml index 6cbc72d..af084e7 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -3,7 +3,7 @@ name = "audiblez" version = "0.1.0" description = "" authors = [ - {name = "Claudio Santini",email = "hireclaudio@gmail.com"} + { name = "Claudio Santini", email = "hireclaudio@gmail.com" } ] readme = "README.md" requires-python = ">=3.11,<3.13" @@ -81,3 +81,11 @@ dependencies = [ [build-system] requires = ["poetry-core>=2.0.0,<3.0.0"] build-backend = "poetry.core.masonry.api" + +[project.urls] +Homepage = "https://claudio.uk/posts/epub-to-audiobook.html" +Documentation = "https://github.com/santinic/audiblez" +Repository = "https://github.com/santinic/audiblez" + +[project.scripts] +audiblez = "audiblez.cli:main" \ No newline at end of file