holzschu / Carnets

Carnets is a stand-alone Jupyter notebook server and client. Edit your notebooks on the go, even where there is no network.
https://holzschu.github.io/Carnets_Jupyter/
BSD 3-Clause "New" or "Revised" License
568 stars 34 forks source link

pyttsx3 or other TTS #58

Open ericECmorlaix opened 4 years ago

ericECmorlaix commented 4 years ago

Hello It would be fun to have pyttsx3 or any other usefull way for TTS... Thanks

holzschu commented 4 years ago

I've added it to the list. In the meantime, the shell command "say" is available and seems to work in my tests. Try !say Hello world.

holzschu commented 4 years ago

You can change the voice with !say -v, for example !say -v Thomas Bonjour, monde for a french speaking voice (or !say -v Amélie Bonjour, monde).

holzschu commented 4 years ago

So, pyttsx3 depends on Mac-specific libraries; porting it to iOS would require too much work.

nlg35 commented 4 years ago

Hello Eric

You can also pass your python variables to shell like this :

a = "Hello" !say $a b = "You" !say $b

Another solution is to use the module gTTS (Google Text To Speech), but it saves the audio into a file (mp3). %pip install gTTS

from gtts import gTTS tts = gTTS('bonjour', lang='fr') tts.save('hello.mp3')

from IPython.display import Audio Audio('hello.mp3', autoplay=True)

But autoplay=True doesn't work for me. Is there a solution to play it directly ... in python or in shell ?

NLG