4

I want to use espeak(http://espeak.sourceforge.net) with python2.7.0-32 bit in windows7.

Additionally, I also want to save the audio files generated by espeak.

NightShadeQueen
  • 3,284
  • 3
  • 24
  • 37
steel
  • 41
  • 1
  • 1
  • 4
  • here's how you could [run `espeak` as an external subprocess in Python](http://stackoverflow.com/a/11270665/4279) – jfs Mar 05 '14 at 23:23
  • @KiritoMcSpock9733 I don't see any reason it wouldn't work unless espeak command itself doesn't work on Windows (the Python code is portable otherwise). – jfs Jul 19 '16 at 21:48

4 Answers4

5

I tried to install this package in Windows 8 but couldn't really get it in the first few attempts.

But this is what i did to get espeak to work with python

  1. Download and Install espeak for Windows from here
  2. Add the eSpeak/command-line folder to PATH so that the command espeak is available
  3. Call espeak commands using python module subprocess similar to how it is done in the example below

http://machakux.appspot.com/blog/44003/making_speech_with_python

Vidhuran
  • 212
  • 4
  • 16
  • Note that [link-only answers](http://meta.stackoverflow.com/tags/link-only-answers/info) are discouraged, SO answers should be the end-point of a search for a solution (vs. yet another stopover of references, which tend to get stale over time). Please consider adding a stand-alone synopsis here, keeping the link as a reference. – kleopatra Aug 29 '13 at 10:26
  • @Vidhuran what's curious is that after I appended the eSpeak\command_line path to PATH, the espeak commands worked fine in cmd.exe, but they didn't in the Python shell. – Mushroom Man Jul 19 '16 at 22:18
  • @KiritoMcSpock9733 How are you trying to call espeak from the python shell. You should be doing something like this import subprocess text = '"Hello World"' subprocess.call('espeak '+text, shell=True) – Vidhuran Jul 20 '16 at 10:35
  • @Vidhuran Yeah I did that and it still didn't work, but after I restarted cmd.exe it worked fine (I don't know why that worked) – Mushroom Man Jul 20 '16 at 19:55
4

Im using this at the moment which is working well...on my Raspberry Pi

from subprocess import call

call(["espeak","-s140 -ven+18 -z","Hello From Mike"])
Mikeys4u
  • 1,494
  • 18
  • 26
2

How about something like this.

import subprocess

def execute_unix(inputcommand):
   p = subprocess.Popen(inputcommand, stdout=subprocess.PIPE, shell=True)
   (output, err) = p.communicate()
   return output

a = "Some amazing words of wisdom."

# write out to wav file 
b = 'espeak -w temp.wav "%s" 2>>/dev/null' % a  

# speak aloud
c = 'espeak -ven+f3 -k5 -s150 --punct="<characters>" "%s" 2>>/dev/null' % a #speak aloud

execute_unix(b) 
execute_unix(c) 
0

What are you asking exactly?

Here there is documentation:

eSpeak Documentation

And samples:

eSpeak samples

If you have a specific doubt we can help you.

Antonio MG
  • 20,382
  • 3
  • 43
  • 62
  • I want to ask you that i want to make an application in python programming language in which user will browse a pdf or text file on his/her machine in windows(specifically) and by using espeak i want to save the text of that file into audio file and output it in a definite folder so how do i make connection between espeak and python.or espeak with some other programming language. if you are still not clear about the problem please leave a comment.Thanks in Advance – steel Jul 11 '13 at 11:02