Reputation: 2787
I want to convert text to sound file and save to system. i tried pyttsx and read this doc. but no option to save the produced sound. Then i read this answer and installed espeak. i tried this
import subprocess
def textToWav(text,file_name):
subprocess.call(["espeak",text,"-w"+file_name+".wav"])
textToWav('hello world','hello')
code. but it producing error something like not able to find subprocess espeak. But i can run GUI application of espeak now. What is the problem?
Upvotes: 0
Views: 1415
Reputation: 28390
In general when issuing a subprocess.call you are doing exactly the same as typing the commands in in the directory that your python code would run. You need to be able to cope with things like:
The other program is not installed
It is not on the path
It has not been installed to the standard location
etc.
Upvotes: 1