aedocw / epub2tts

Turn an epub or text file into an audiobook
Apache License 2.0
426 stars 43 forks source link

Add a little pause between paragraphs #232

Closed aedocw closed 2 months ago

aedocw commented 3 months ago

When creating audiobooks, the way text is extracted from the epub just squashes each chapter together, ignoring paragraph breaks. Books definitely sound better if there's a little pause between each paragraph.

There are probably way better ways of approaching this, but the code has become kind of an embarrassing nightmare at this point, so I'm just going to yolo this...

If you add --parapause when exporting to text, it will add a %P% between each paragraph in the text file that is output. ONLY with --engine edge, if %P% is detected, a 1.2 second pause will be prepended to the wav file for that sentence. It seems to work pretty nicely, but I do not plan to merge this quite yet. But it's working pretty nicely for me so far :)

aedocw commented 2 months ago

Rather than inserting %P% for paragraph breaks, epub2tts should just recognize empty lines. Then when exporting, it should insert an empty line between each paragraph. In addition, when reading directly from epub files it should recognize the paragraph breaks the same way and insert an additional brief pause between each paragraph.

aedocw commented 2 months ago

This has been incorporated into https://github.com/aedocw/epub2tts-edge/ instead.