aedocw / epub2tts-edge

epub2tts-edge uses Microsoft Edge cloud-based TTS to create a full featured audiobook m4b from an epub or text file
GNU General Public License v3.0
95 stars 14 forks source link

A graphical UI perhaps #6

Open sejbk opened 6 months ago

sejbk commented 6 months ago

Thanks for creating the nice little tool.

As part of a little quest to learn to code Python I came across your package and used that as a basis for an UI app built with ttkbootstrap. Still have a little issue with generating a m4b file with good sound quality but as an interim solution I'm just creating MP3 files and that sounds good.

I'm certainly not a great Python programmer but let me know if you wish for me to share the code with you.

image
aedocw commented 6 months ago

This looks amazing! I'd love to incorporate this some way, or else feel free to put it up on github and I can point folks to your repo if they want a version with UI.

I am definitely not a great python programmer, haha! I haven't had time to look at this lately, but I think the fix for the audio is going to be in using pydub better than I'm using it now. Like pull in each mp3 as an object, combine them with the blank audio for each paragraph break, and do a single export per chapter as flac files. Then at the end, probably find some flags for ffmpeg to no try to do any compression on the file. Hopefully I'll have time in the next few weeks to do that.

aedocw commented 6 months ago

@sejbk Hello, any chance you've had an opportunity to think about this? I love the UI you made, it looks really great, would be really fun to try adding it :)

sejbk commented 6 months ago

Hi,

Here you go - haven't had time to put more effort into this but feel free to use whatever part of the code you think might be useful.

The idea is that it works in smaller steps compared to the command line tool.

Note, it will assume that there is a file called artwork.jpg in the same folder as the input file that will be used for the graphics.

  1. Convert EPUB to TXT
  2. Now you can do whatever changes you wish to do in the TXT file
  3. Convert TXT to JSON
  4. Now you can edit the album name etc if you wish and the JSON file have the structure of the chapters and sentences.
  5. Convert JSON to MP3 Each chapter will be created as a MP3 file with ID3 tags set with title, album, artist, track number, total tracks and artwork etc.
  6. (Not yet complete) create M4B out of the MP3 files.

Known issues / TODOs

Have fun!

UI_project.zip

sejbk commented 6 months ago

I have noticed that for large volumes of text the EDGE service seemingly randomly returns a small number of the spoken sentences with another voice and or language, no idea why that is.

aedocw commented 6 months ago

Awesome, thank you for sharing this!