Convert books to audiobooks using AI based text to speech (TTS).
Make sure to have Python 3.11 installed and create a virtual environment.
Install the requirements by using:
pip install -r requirements.txt
By default the program will use the sample epub in the sample_data
directory with the default voice. To use a different book or voice update the config.toml
file.
This is the recommended way to use the program. It gives more fine grained control over the process and the option to preview the audiobook.
python tts_audiobook_creator/ui.py
To generate an audiobook for the whole book without the UI use the following command:
python main.py
The following steps are for a detailed installation of the development environment. Note that for every step there are multiple ways to i.e. install python, create an environment or install dependencies. The following steps are just one way to do it.
-
Install
Pyenv
: https://github.com/pyenv/pyenv#installation -
Install
python 3.11.8
:pyenv install 3.11.8
-
Install pyenv-virtualenv: https://github.com/pyenv/pyenv-virtualenv
-
Create a virtual environment:
pyenv virtualenv 3.11.8 tts-audiobook-creator
-
Enable and use the virtual environment:
pyenv local tts-audiobook-creator pyenv activate tts-audiobook-creator
-
Install poetry:
pip install poetry
-
Install the dependencies:
poetry install
graph LR
UI(User Interface) --> BR(Book Reader)
BR --> BP(Book Parser)
BP --> SBF(Standard Book Format)
SBF --> TTF(TTS Text Formatting)
subgraph TTS_Engine Specific
TTF --> TTS(Text-To-Speech Engine)
end
TTS --> AF(Audiofiles)
AF --> ABF(Audiobook Format)
BP --> MDC("Metadata (Cover, etc)")
MDC --> ABF
book = {
"title": "Title",
"author": "Author",
"chapters": [
{
"title": "Chapter Title",
"body": "Chapter Text",
"audio_path": "{Path to audio file}"
}
]
}