pyttsx3 save_to_file() 无法在 macOS 上运行

问题描述 投票:0回答:1

pyttsx3 无法在我的 mac 上运行(python 11)

# sample code from the readme

import pyttsx3
engine = pyttsx3.init()
engine.save_to_file('Hello World', 'test.mp3')
engine.runAndWait()

实际上,pyttsx3无法在mac上工作,我发现了这个问题在macos上无法工作pyttsx3提到https://pypi.org/project/py3-tts/并且使用

py3-tts
它可以在我的mac上工作。

但是

save_to_file
无法工作,代码只是卡在那里并且不会退出。经过一番尝试和错误后,我发现我可以将 tts 保存到 wav 文件而不是 mp3。但这是为什么呢?

text-to-speech pyttsx3 pyttsx espeak
1个回答
0
投票

我认为这是因为 NSSS(默认的 MacOS 语音引擎)不支持导出到

.mp3

我尝试安装 espeak-ng,原始 espeak 的最新分支,(检查 https://github.com/espeak-ng/espeak-ng?tab=readme-ov-file#history)查看是否可以支持 espeak-ng。但遗憾的是它无法在 macOS 上运行。所以我必须将 tts 保存到

.wav
文件并使用其他工具将其转换为
.mp3

© www.soinside.com 2019 - 2024. All rights reserved.