2017-04-24 76 views
1

我發現一個pyttsx的分支,讓你錄製。 https://github.com/hick/pyttsx/tree/master/pyttsxpyttsx:停止錄製一次開始

這裏是我的代碼:

engine =pyttsx.init() 
voices = engine.getProperty('voices') 
engine.setProperty('voice', voices[0].id) #change index to change voices 
engine.rec('test this out','test.wav') 

問題是...我無法打開文件,而無需關閉外殼。但我需要運行更多的代碼......比如編碼爲mp3。我已經試過engine.stop()。我經過這裏看:https://github.com/hick/pyttsx/blob/master/pyttsx/engine.py ...

+0

你可以打開一個新的終端或窗口。 – Shiping

回答

0

使用pyttsx3代替pyttsx:

import pyttsx3 

engine = pyttsx3.init() 
engine.say('Nice to meet you') 
engine.runAndWait()