News for hackers. Stuff that matters.
Re:Text to speech in Python by BugsJustFindMe on Sunday June 25, 2017 @03:54AM (#14629080)
The more accurate title for this is "Python interface to Google's cloud TTS service".

Which means it won't work offline or when Google inevitably shuts down the API.

Re:Text to speech in Python by microcolonel on Sunday June 25, 2017 @05:14AM (#14629266)
Yeah, I'm getting a bit of fatigue from all of this "brand new voice assistant!" and "amazing text to speech and speech recognition!" crap which just turns out to be the same wrapper script around Google's APIs that everyone wrote in five minutes when the APIs opened up.
Re:Text to speech in Python by visarga on Sunday June 25, 2017 @09:41AM (#14629926)
I'm wondering why the Linux TTS offering is so dismal, and why the voices used by Apple, Google and MS are so old. We have seen amazing demos with WaveNet from DeepMind a year ago. Where are the new amazing voices?
Re:Text to speech in Python by woodson on Sunday June 25, 2017 @01:45PM (#14631192)
Because WaveNet is very impractical in production (per sample prediction). Tacotron may be a better fit (https://google.github.io/tacotron).
Re:Text to speech in Python by visarga on Sunday June 25, 2017 @09:40AM (#14629914)
Not only that, but you don't get word level timestamps when rendering a phrase. If you want to track speech word by word, it's not possible.
Re:Text to speech in Python by app4soft on Sunday June 25, 2017 @06:05AM (#14629367)
Yeah. Its remember me similar script written for PyS60 for use Symbian 9.x in-built TTS
Re:Text to speech in Python by d0mine on Saturday June 24, 2017 @08:50PM (#14628103)
In Pythonista for iOS:

  import speech

  speech.say('Hola mundo', 'es_ES')
In reverse, to record a sound for three seconds:

  import sound

  r = sound.Recorder('audio.m4a')
  r.record(3)  # seconds
To recognize it as text:

  text = speech.recognize('audio.m4a', 'en')[0][0]  # sent to Apple servers
Re:Text to speech in Python by haikuginger on Saturday June 24, 2017 @07:39PM (#14627933)
sudo pip install? Really?

You almost never want to use the system Python. Use pyenv[0] to install the version of Python you want, and then create a new virtual environment for each project.

[0]https://github.com/pyenv/pyenv

Re:Text to speech in Python by mythrwy on Saturday June 24, 2017 @10:19PM (#14628296)
That is addressed right before `sudo pip install`.

FTA: "Install using pyenv, pipenv or virtualenv.

If you are feeling brave, install with pip:"

Re:Text to speech in Python by e12e on Sunday June 25, 2017 @12:00AM (#14628558)
I can't think of a situation where plain "pip install" doesn't work that the correct fix is to use sudo.

I strongly think that if you're going to give advice on how to install, then you'd be better off suggesting:

  python3 -m venv speech-venv
  ./speech-venv/bin/pip install ...
  # or activate and use "pip install"
Re:Text to speech in Python by cdubzzz on Saturday June 24, 2017 @07:42PM (#14627941)
Re:Text to speech in Python by jgalt212 on Sunday June 25, 2017 @07:41AM (#14629605)
you need sudo for PyCryto or you need to su root b/c when it compiles on linux it needs to write to tmp directories that normal users cannot.
Re:Text to speech in Python by brittohalloran on Saturday June 24, 2017 @08:42PM (#14628079)
What are your thoughts on conda instead of virtualenv?
Re:Text to speech in Python by mythrwy on Saturday June 24, 2017 @10:31PM (#14628325)
Not the person you asked, but I personally don't care for conda.

I'd rather use standard Python packaging and virtual environments. Conda had a few "funnies", like adding lines to .bashrc interfering with system Python when I tried to use it later (easily fixed and not really a big deal, I just didn't care for it).

A client had some scripts that used it, and from that perspective I guess it saved a little time installing everything but not much. Not enough to have another Python version floating around in my opinion. Easy enough to just use regular Python.

Re:Text to speech in Python by acbart on Saturday June 24, 2017 @09:13PM (#14628163)
So what is the state of the art in turning text into speech files in Python? Especially in terms of free options? Everything I find on google seems to be a year or two out of date.
Re:Text to speech in Python by pebers on Sunday June 25, 2017 @06:38AM (#14629463)
I'm disappointed - this isn't actually text-to-speech in Python, it's text-to-speech in C++ (or Objective-C in one case) with a Python wrapper over the top.

An actual Python TTS engine would have been cool as an introduction to how the algorithms work without needing to learn C++. The performance would always be lacking but that'd not really matter for an introduction.

Re:Text to speech in Python by vram22 on Sunday June 25, 2017 @10:07AM (#14630029)
I had seen this library a while ago and blogged about it:

PyTTSx: cross-platform Python speech synthesis wrapper

https://jugad2.blogspot.in/2013/01/pyttsx-cross-platform-pyt...

Speech synthesis in Python with pyttsx:

https://jugad2.blogspot.in/2014/03/speech-synthesis-in-pytho...

The synthesized voice announcing a train arrival is cool (link in 2nd post above).

Re:Text to speech in Python by revicon on Sunday June 25, 2017 @12:21AM (#14628621)
Anyone have an opinion on the best option these days to do the reverse (speech to text)? Building an open source version of Alexa sounds like a fun project.
Re:Text to speech in Python by grw_ on Saturday June 24, 2017 @08:00PM (#14627978)
BadPrototypeError: Objective-C expects 1 arguments, Python argument has 3 arguments for <unbound selector setProperty of NSSpeechDriver at 0x10d9e4e00>
Re:Text to speech in Python by coolswan on Saturday June 24, 2017 @09:04PM (#14628136)
Got that too. But if you're on Mac, you can play around with text to speech using os.

  import os
  os.system("say 'hello world'")
Re:Text to speech in Python by khedoros1 on Sunday June 25, 2017 @01:32AM (#14628789)
Or anywhere you can install the GNUstep toolkit.
Re:Text to speech in Python by jonbarker on Saturday June 24, 2017 @08:29PM (#14628041)
Try virtualenv instead of sudo pip install. Then you can keep track of your requirements.txt, which is helpful for teamwork on multiple machines.