我有下面的Python代码,它输出口语文本“thisatest”。有人能告诉我如何将输出重定向到音频文件吗?你知道吗
from AppKit import NSSpeechSynthesizer
import time
nssp = NSSpeechSynthesizer
ve = nssp.alloc().init()
from_voice = "com.apple.speech.synthesis.voice.Alex"
data = u'''
This is a test.
'''
def say_data (data):
ve.setVoice_(from_voice)
ve.startSpeakingString_(data)
time.sleep(1)
while ve.isSpeaking():
time.sleep(1)
say_data (data)
目前没有回答
相关问题 更多 >
编程相关推荐