diff --git a/pyttsx3/drivers/nsss.py b/pyttsx3/drivers/nsss.py index 6cf5f81..1b27ef9 100644 --- a/pyttsx3/drivers/nsss.py +++ b/pyttsx3/drivers/nsss.py @@ -2,7 +2,7 @@ from Foundation import * from AppKit import NSSpeechSynthesizer from PyObjCTools import AppHelper -from ..voice import Voice +from pyttsx3.voice import Voice def buildDriver(proxy): @@ -60,8 +60,7 @@ def _toVoice(self, attr): except KeyError: lang = attr['VoiceLanguage'] return Voice(attr['VoiceIdentifier'], attr['VoiceName'], - [lang], attr['VoiceGender'], - attr['VoiceAge']) + [lang], attr['VoiceGender']) @objc.python_method def getProperty(self, name): @@ -100,7 +99,10 @@ def setProperty(self, name, value): @objc.python_method def save_to_file(self, text, filename): url = Foundation.NSURL.fileURLWithPath_(filename) + import time + self._tts.startSpeakingString_toURL_(text, url) + time.sleep(max(1, len(text) * 0.01)) def speechSynthesizer_didFinishSpeaking_(self, tts, success): if not self._completed: