I'm trying to make a program that needs a .mp3
file printing. I used gTTS and os modules to do.
In the code, I usually use the os module, but when I run the code, I cannot hear the sound even if I make it louder.
Here is my code:
def open_file(filename):
if sys.platform == "win32":
os.startfile(filename)
else:
opener ="open" if sys.platform == "darwin" else "xdg-open"
subprocess.call([opener, filename])
open_file(Warning.mp3)
messagebox.showinfo("현재 시간", printText)
Note: 현재시간 is in Korean. Sorry for that.
I think I get the error because I wrote 'win32'
, but I'm on maOS X (macOS x: El Capitan). I know what is wrong, but I don't know how to fix it. Can someone help me debug this problem?
答案 0 :(得分:0)
你说你正在将mp3文件转换为文本,所以我认为你应该试试这个模块https://pypi.python.org/pypi/SpeechRecognition/
并转换mp3以将mp3文件转换为text.Hope它有帮助。但是,如果您正在尝试将文字转换为mp3,那么您也可以尝试使用默认语音库的pyttsx
。