Search This Blog

Tuesday, December 10, 2019

Python Google Speech Setup and Example (WINDOWS)

1. Download SOX latest version - https://sourceforge.net/projects/sox/files/sox/

2. Install it (ex: C:\Program Files (x86)\sox-14-4-2 )
     2.1 download 2 (libmad-0.dll, libmp3lame-0.dll) DLLs and copy to C:\Program Files (x86)\sox-14-4-2;

                 https://app.box.com/s/tzn5ohyh90viedu3u90w2l2pmp2bl41t


3. Set environment path in system variable

4. Restart the IDE or CMD prompt

5. in cmd prompt
        set path=%path%;C:\Program Files (x86)\sox-14-4-2;
       echo %path%

6. pip install google_speech
    pip install sox

7. create a sample test.py


from google_speech import Speech

# say "Hello World"
text = "Hello This is Vijay DR";
lang = "en";
speech = Speech(text, lang);
speech.play();

# you can also apply audio effects while playing (using SoX)
# see http://sox.sourceforge.net/sox.html#EFFECTS for full effect documentation
sox_effects = ("speed", "1.5");
speech.play(sox_effects);

# save the speech to an MP3 file (no effect is applied)
speech.save("output.mp3");


8. cmp prompt py test.py



enjoy !
vijay

No comments:

Hit Counter


View My Stats