title: How to save sound produced from text as mp3 or wave in python
body: <p>I want to convert text to sound file and save to system.
  i tried pyttsx and read <a href="http://pyttsx.readthedocs.org/en/v1.1/engine.html#the-engine-factory" rel="nofollow noreferrer">this</a> doc. but no option to save the produced sound.
  Then i read <a href="https://stackoverflow.com/questions/9900137/recording-synthesized-text-to-speech-to-a-file-in-python">this</a> answer and installed espeak. i tried this</p>
  
  <pre><code>import subprocess
  
  def textToWav(text,file_name):
     subprocess.call(["espeak",text,"-w"+file_name+".wav"])
  
  textToWav('hello world','hello')
  </code></pre>
  
  <p>code. but it producing error something like
  <strong>not able to find subprocess espeak</strong>.
  But i can run GUI application of espeak now.
  What is the problem?</p>