desbma / GoogleSpeech

Read text using Google Translate TTS API
GNU Lesser General Public License v2.1
161 stars 37 forks source link

Docker #9

Closed andrius closed 7 years ago

andrius commented 7 years ago

Hello, I have dockerized GoogleSpeech but it requires ALSA as dependency. It is isolated system and also installed on VPS, that also does not have any soundboard – I believe it won't work on VPS aswell.

Is there any way to get rid of ALSA?

~/Development/docker/GoogleSpeech-docker master* ak@c0
❯ docker run -ti --rm --name googlespeech googlespeech -l en "this is a test"
Playing speech segment (en): 'this is a test'
ALSA lib confmisc.c:767:(parse_card) cannot find card '0'
ALSA lib conf.c:4528:(_snd_config_evaluate) function snd_func_card_driver returned error: No such file or directory
ALSA lib confmisc.c:392:(snd_func_concat) error evaluating strings
ALSA lib conf.c:4528:(_snd_config_evaluate) function snd_func_concat returned error: No such file or directory
ALSA lib confmisc.c:1246:(snd_func_refer) error evaluating name
ALSA lib conf.c:4528:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory
ALSA lib conf.c:5007:(snd_config_expand) Evaluate error: No such file or directory
ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM default
Traceback (most recent call last):
  File "/usr/bin/google_speech", line 11, in <module>
    load_entry_point('google-speech==1.0.16', 'console_scripts', 'google_speech')()
  File "/usr/lib/python3.6/site-packages/google_speech-1.0.16-py3.6.egg/google_speech/__init__.py", line 297, in cl_main
  File "/usr/lib/python3.6/site-packages/google_speech-1.0.16-py3.6.egg/google_speech/__init__.py", line 251, in main
  File "/usr/lib/python3.6/site-packages/google_speech-1.0.16-py3.6.egg/google_speech/__init__.py", line 136, in play
  File "/usr/lib/python3.6/site-packages/google_speech-1.0.16-py3.6.egg/google_speech/__init__.py", line 218, in play
RuntimeError

UPDATE: I wanted to save recording to file vs playing, is it possible with GoogleSpeech?

desbma commented 7 years ago

GoogleSpeech uses sox to play audio, which in your case seem to have been build with ALSA as default audio engine. If your environement does not support ALSA, you can change it using the AUDIODEV environment variable as described in the Playing & Recording Audio section of the sox man page.

If you only want to download the audio file and don't care about playing it, GoogleSpeech is probably not the right tool, but there are ways to do it by copying the URL or reading the cache file, more details here