hadware / voxpopuli

Python wrapper for Espeak and Mbrola, for simple local TTS
MIT License
28 stars 16 forks source link

to_phonemes() only parses the first word in a sentence [Windows] #8

Closed klvbdmh closed 7 years ago

klvbdmh commented 7 years ago

Code that reproduces the issue

Straight from the unit tests:

from voxpopuli import Voice

voice = Voice(lang="en")
print(voice.to_phonems("Salut les amis").phonemes_str)

Expected behavior

'Salut les amis'
salylezami__

Observed behavior

'Salut les amis'
saly__

Comments

Another espeak parsing issue that happens only on Windows. A phrase with spaces has to be enclosed in double quotes. So instead of

"C:\Program Files (x86)\eSpeak\command_line\espeak" -s 160 -p 50 --pho -q -v mb-fr1 'Salut les amis'

it has to be

"C:\Program Files (x86)\eSpeak\command_line\espeak" -s 160 -p 50 --pho -q -v mb-fr1 "Salut les amis"

hadware commented 7 years ago

Oh. This kind of problem again. For now I use quote from shlex's quote which works perfectly on Unix systems. Maybe you should try to find a shell-escaping function that works well on windows. I found this: http://stackoverflow.com/questions/967443/python-module-to-shellquote-unshellquote , but maybe you'll find something better.

As a side question: why using python on windows? (I'm genuinely asking)

klvbdmh commented 7 years ago

Replacing text with '"%s"' % text in phoneme_synth_args seems to fix this problem, but I feel like it's a hackish solution. I'll submit a patch shortly.

As for your side question - Python supports Windows quite well and most of the time there are no bigger compatibility issues. Even TensorFlow got ported to Windows recently. Honestly, the biggest quirk with using Python on Windows is to remember to escape or use proper slashes in paths. Python is a really flexible and versatile language and I'm not a huge fan of JavaScript.

If you're asking why not use Python on Linux - I do use both, Mostly Linux for server-side apps, but sometimes I need to make an app that runs on Windows.