ebook2audiobook (E2A)

repository·main·Indexed 12 days ago

https://github.com/drewthomasson/ebook2audiobook

A tool to convert eBooks into high-quality audiobooks using advanced Text-to-Speech (TTS) engines. It features automatic chapter detection, voice cloning, and a pipeline that uses BookNLP for entity and character analysis to generate SML-tagged text. Includes components for SML Book Dialog Extraction and Universal_TTS_Finetune for training and fine-tuning Coqui and Piper TTS models.

Tokens
45.9K
Snippets
116
Records
208
Agent score
91%

What's inside ebook2audiobook

  1. Overview of ebook2audiobook (E2A) features

    main

    ebook2audiobook (E2A) is a CPU/GPU converter that transforms eBooks into audiobooks complete with chapters and metadata using advanced Text-to-Speech (TTS) engines.

    Key Features:

    • TTS Engines Supported: XTTSv2, Bark, Fairseq, VITS, Tacotron2, Tortoise, GlowTTS, YourTTS.
    • File Formats Supported:
      • eBooks: .epub, .mobi, .azw3, .fb2, .lrf, .rb, .snb, .tcr, .pdf, .txt, .rtf, .doc, .docx, .html, .odt, .azw, .chm, .lit, .pdb, .cbr, .cbz, .prc, .pml.
      • Images (via OCR): .tiff, .tif, .png, .jpg, .jpeg, .bmp, .zip.
      • Note: .epub and .mobi provide the best results for automatic chapter detection.
    • Audio Output Formats: aac, flac, mp3, m4b, m4a, mp4, mov, ogg, wav, webm (mono or stereo).
    • Capabilities:
      • Voice cloning using your own audio files.
      • Support for 1158+ languages.
      • OCR scanning for image-based text pages.
      • SML tag support for fine-grained control over pauses and speech transitions.
      • Custom model support (XTTSv2, VITS, FAIRSEQ, PIPER, etc.).
  2. Overview of ebook2audiobook (E2A)

    main

    ebook2audiobook (E2A) is a CPU/GPU-based converter that transforms eBooks into audiobooks with chapters and metadata using advanced Text-to-Speech (TTS) engines. It supports voice cloning and over 1,158 languages.

    Key Features:

    • TTS Engines: Supports XTTSv2, Bark, Fairseq, VITS, Tacotron2, Tortoise, GlowTTS, and YourTTS.
    • Input Formats: Converts .epub, .mobi, .azw3, .fb2, .lrf, .rb, .snb, .tcr, .pdf, .txt, .rtf, .doc, .docx, .html, .odt, .azw, and various image formats (via OCR) like .png, .jpg, .jpeg.
    • Output Formats: Generates audiobooks in aac, flac, mp3, m4b, m4a, mp4, mov, ogg, wav, or webm.
    • Advanced Control: Supports SML tags for fine-grained control over pauses, stops, and voice changes.
    • Voice Cloning: Optional feature to use your own voice files for narration.

    Important Legal Notice: This tool is intended exclusively for use with DRM-free, legally obtained eBooks.

  3. Use cloned voices for zero-shot cloning

    main

    You can upload any voice audio to use as a reference for cloning. The ideal duration for a reference clip is between 1 and 5 million [units/samples, likely implying a specific length context provided in the full docs].

    E2A automatically cleans the voice from background noise or music. The built-in cloned voice list is primarily in English; for other languages, you may need to contact the developers to have them officially added to the preset list.

  4. Available SML tags for text control

    main

    You can use SML (Speech Markup Language) tags within your text to control pauses and voice switching during conversion:

    • [break]: Inserts silence with a random duration between 0.3–0.6 sec.
    • [pause]: Inserts silence with a random duration between 1.0–1.6 sec.
    • [pause:N]: Inserts a fixed pause of N seconds (e.g., [pause:3] for a 3-second pause).
    • [voice:/path/to/voice/file]...[/voice]: Switches the voice from the default or selected voice to the file specified in the path.
    [pause:3]
    [voice:/path/to/voice/file]This text uses a different voice.[/voice]
  5. How to handle early stopping and export checkpoints

    main

    If you interrupt a training run using Ctrl+C, the training will stop, but the model will not be automatically packaged into a ready/ directory.

    To use an interrupted model:

    1. Monitor Quality: Run training with --sample-epoch-interval <N> to generate periodic audio samples in <run_dir>/epoch_samples/ so you can decide when to stop.
    2. Stop: Press Ctrl+C when satisfied.
    3. Export: Run the export_checkpoint.py script on your training run directory. This converts the checkpoint (e.g., to ONNX for Piper or optimized .pth for Coqui/XTTS) and creates a ready/ folder containing model.onnx and artifacts.json.
    # Export a manually interrupted training run
    python export_checkpoint.py /path/to/your/training_run/<timestamp>
  6. Use SML tags for audio control

    main

    You can insert SML (Speech Markup Language) tags into your eBook text to control pauses and voice switching during synthesis.

    Available Tags

    • [break]: Inserts a random silence between 0.3–0.6 sec.
    • [pause]: Inserts a random silence between 1.0–1.6 sec.
    • [pause:N]: Inserts a fixed pause of N seconds (e.g., [pause:3] for 3 seconds).
    • [voice:/path/to/voice/file]...[/voice]: Switches the voice from the default or selected voice to the one specified in the path for the enclosed text.

    Tip: For more advanced automation of SML insertion, see the E2A-SML repository.

    [pause:3]
    [voice:/path/to/voice/file]This text will be spoken with a different voice.[/voice]
  7. Use cloned voices for zero-shot TTS

    main

    You can use any voice recording in a supported audio format to clone a voice for text-to-speech. For best results, provide a recording between 1 and 5 minutes long. E2A includes built-in noise reduction that can clean up recordings even if they have background noise or music.

    Note: The built-in list of cloned voices is primarily in English. For other languages, you may need to provide your own reference audio clip, especially when using custom XTTSv2 models.

  8. Available SML tags for speech control

    main

    You can insert SML (Speech Markup Language) tags into your text to control the pacing and voice of the generated audio:

    • [break]: Inserts silence with a random duration between 0.3–0.6 sec.
    • [pause]: Inserts silence with a random duration between 1.0–1.6 sec.
    • [pause:N]: Inserts a fixed pause of N seconds (e.g., [pause:3]).
    • [voice:/path/to/voice/file]...[/voice]: Switches the voice from the default/selected voice to the one specified in the path for the enclosed text.
  9. Supported TTS engines and features

    main

    E2A supports a wide variety of TTS engines and processing capabilities:

    Supported TTS Engines:

    • XTTSv2, Bark, Fairseq, VITS, Tacotron2, Tortoise, GlowTTS, YourTTS

    Key Features:

    • Multi-format conversion: Supports .epub, .mobi, .azw3, .fb2, .lrf, .rb, .snb, .tcr, .pdf, .txt, .rtf, .doc, .docx, .html, .odt, .azw, .tiff, .tif, .png, .jpg, .jpeg, .bmp, .zip.
    • Text Box: Convert short snippets of text directly to audio.
    • OCR Scanning: Processes files containing text as images.
    • Voice Cloning: Optional feature using your own voice files.
    • SML-tags: Provides precise control over interruptions, pauses, and voice changes.
    • Custom Models: Support for custom trained models (XTTSv2, VITS, FAIRSEQ, PIPER, etc.).
  10. Use custom voice samples for TTS

    main

    You can upload any voice sample to be used for text-to-speech.

    • Recommended duration: 1 to 5 minutes.
    • Noise handling: E2A will automatically clean the audio, even if there is background noise or music.
    • Note for XTTSv2: When using a specific XTTSv2 model, a reference audio clip is mandatory.
  11. Clone custom voices for TTS

    main

    You can replace any voice sound using any supported audio format. The ideal duration for a reference clip is between 1 and 5 million (likely intended as 1 to 5 seconds or a specific sample length, though the text specifies '1 až 5 miliónov'). E2A automatically cleans the voice from background noise or music.

    Note: The built-in list of cloned voices is primarily in English. To request official addition of voices in other languages, contact the developers.

  12. Clone voices for custom TTS

    main

    You can upload audio clips to clone voices for use in supported audio formats.

    • Ideal Duration: 1 to 5 minutes.
    • Audio Quality: E2A automatically cleans up voices, even if the recording has loud background noise or music.
    • Language Support: The built-in list of cloned voices is primarily English. To request official support for other languages, contact the developers.
    • Requirement: For custom XTTSv2 models, a reference audio clip of the voice is mandatory.