desbma / GoogleSpeech

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

Doesn't work on windows 8 x64 (no default audio device configured) #6

Closed BondarenkoArtur closed 8 years ago

BondarenkoArtur commented 8 years ago

Hello, I installed everything needed, and also libmp3lame-0 and libmad-0. And I've no idea how to tell sox default audio device. play only plays audio if i run it with play test.mp3 -t waveaudio But I'm bad in programming using python, so i cannot fix that by myself.

Here what I've in devices image

Error that i've

play FAIL sox: Sorry, there is no default audio device configured
Traceback (most recent call last):
  File "S:/Code/Python/vksp/test.py", line 3, in <module>
    gs.main('hi', lang='en', sox_effects='')
  File "S:\Soft\Python_v3.5.1\lib\site-packages\google_speech\__init__.py", line 253, in main
    Speech(text, lang).play(sox_effects)
  File "S:\Soft\Python_v3.5.1\lib\site-packages\google_speech\__init__.py", line 137, in play
    segment.play(sox_effects)
  File "S:\Soft\Python_v3.5.1\lib\site-packages\google_speech\__init__.py", line 217, in play
    raise RuntimeError()
RuntimeError

My code is super simple

import google_speech as gs

gs.main('hi', lang='en', sox_effects='')
desbma commented 8 years ago

Hi,

Can you try play test.mp3 -t waveaudio 2, and see if it works ?

If it does, you can add :

import os
os.putenv("AUDIODEV", "2")

in your script, or set the environment variable AUDIODEV to 2 in Windows configuration.

BondarenkoArtur commented 8 years ago
C:\Users\Arthur\Music>play test.mp3
play FAIL sox: Sorry, there is no default audio device configured

C:\Users\Arthur\Music>play test.mp3 -t waveaudio 2
play FAIL sox: Sorry, there is no default audio device configured

C:\Users\Arthur\Music>play test.mp3 -t waveaudio 1
play FAIL sox: Sorry, there is no default audio device configured

C:\Users\Arthur\Music>play test.mp3 -t waveaudio 0
play FAIL sox: Sorry, there is no default audio device configured

C:\Users\Arthur\Music>play test.mp3 -t waveaudio 3
play FAIL sox: Sorry, there is no default audio device configured

C:\Users\Arthur\Music>play test.mp3 -t waveaudio 4
play FAIL sox: Sorry, there is no default audio device configured

C:\Users\Arthur\Music>play test.mp3 -t waveaudio

test.mp3:

 File Size: 9.05k     Bit Rate: 47.8k
  Encoding: MPEG audio
  Channels: 1 @ 16-bit
Samplerate: 44100Hz
Replaygain: off
  Duration: 00:00:01.52

In:98.3% 00:00:01.49 [00:00:00.03] Out:65.7k [      |      ] Hd:0.0 Clip:0
Done.

here is mp3 inside of zip test.zip

BondarenkoArtur commented 8 years ago

I was trying different combinations this cmd = ["play", "-q", "-t", "mp3", "-", "-t waveaudio", "trim", "0.1", "reverse", "trim", "0.07", "reverse"] gives me play FAIL sox: missing filename

maybe i can save audiodata to file and just launch file?

desbma commented 8 years ago

I have released v1.0.14 with a possible fix, can you update (pip install -U google_speech), and check if it is fixed?