TTS icon indicating copy to clipboard operation
TTS copied to clipboard

[Feature request] TTS command line tool: Possibility to convert text file to speech

Open domasofan opened this issue 1 year ago • 9 comments

🚀 Feature Description

It would be nice to be able to convert a text file into speech, not just a small pice of text. Especially when you are a blind person you have a lot of text for example books or articles. Converting just one sentence or a small string of text is pretty difficult.

Solution

Adding above possibility and adding a command line argument to specify a .txt file for conversion.

Thanks.

Alternative Solutions

Additional context

domasofan avatar Mar 05 '23 19:03 domasofan

YES this would be sooooo awesome!!! please push this a little :)

kermitthegreat avatar Mar 10 '23 10:03 kermitthegreat

Hi,

Would be great if soneone could implement that.

TTS is very important for us blind people and a good TTS is pretty difficult to find. So if someone finds a good solution that would be a very welcome thing. We blind use the TTS not just because it is interesting or funny but more for daily use and a lot of text.

Greetings and thanks, Simon

domasofan avatar Mar 16 '23 19:03 domasofan

@domasofan can you help me understand how passing a text file makes a difference for you?

erogol avatar Mar 23 '23 11:03 erogol

Hi @erogol ,

Thanks for replying. Yes sure. I just can speak for me or the blind and visually impaired community though. But this might also be useful for other people who consume text through tts engines. We use text to speech a lot. Which means we have a lot of books, articles and other longer text to be converted into high quality speech. Converting every sentence manually is nearly impossible especially when there is a lot of text to be converted. So text files seem to be the easiest way to do this. Because many other formats like epub books and html files can be easily converted into a text file.

Greetings, Simon

domasofan avatar Mar 26 '23 18:03 domasofan

@domasofan thanks for explaining. Would that be enough to let the user pass a basic txt file? Are there available tools for you to parse out the content you want to read out or would that be also taken care of by the TTS engine? Asking this because the latter option is a lot harder for us to implement and probably out-of-context for this repo too as it is mainly optimized for created TTS models.

erogol avatar Mar 27 '23 06:03 erogol

@erogol That should be enough. I completely understand that more functions would go over the tasks that the tts command line tool has.

domasofan avatar Mar 27 '23 19:03 domasofan

I implemented an epub to TTS reader that given an epub, uses coqui to read the book, which is then saved to mp3. You can check it out here: https://github.com/aedocw/epub2tts .. It only runs on Linux (or windows with WSL), and it is not super user friendly, though the installation is not too difficult (clone the repo and then "pip install .").

What I wrote could easily be extended to accept a plan text file as input rather than an epub - if anyone is interested please just file a feature request bug in the repo.

EDIT TO ADD: This runs great on mac now as well (intel and apple processors), I've updated the instructions.

aedocw avatar Apr 16 '23 23:04 aedocw

@domasofan I'll give it a try next week and implement something simple.

erogol avatar Apr 17 '23 12:04 erogol

@erogol @aedocw thanks both.

domasofan avatar Apr 18 '23 18:04 domasofan

Since this is on the Github tracker, I’m going to assume that a CLI-based solution is acceptable so:

Would cating the file’s contents in the CLI invocation work for you?

tts --text “$(cat path/to/file.txt)”

anulman avatar May 04 '23 08:05 anulman

Hi @anulman,

Yes that would work. Under Windows we might need a workaround though.

Greetings, Simon

domasofan avatar May 07 '23 17:05 domasofan

Hi @anulman,

Yes that would work. Under Windows we might need a workaround though.

Greetings, Simon

One method which work under Windows - install SSH daemon in the Linux PC/VM, use SSH client from Windows - works just fine :)

FrontierDK avatar May 07 '23 18:05 FrontierDK

@domasofan Under Windows could you assign contents to a variable then pass the variable as text input to tts

set /p IN_TTS=<in_file
tts --text %IN_TTS%

mitchind avatar May 30 '23 04:05 mitchind

@FrontierDK: Thanks i guess that might be the best solution. Especially when i think about the big amount of dependencies tts seems to require. I don't know if there is a possibility to get it all to work with a minimal footprint on size.

@mitchind: Thanks. Will try that next time when i have a working setup.

domasofan avatar May 31 '23 18:05 domasofan

I close this one as @anulman s solution handles this.

erogol avatar Jun 05 '23 08:06 erogol