在使用Microsoft文本到语音时,如何计算每个单词的持续时间?

发布于 2025-01-28 06:59:19 字数 258 浏览 2 评论 0原文

嗨,我正在使用Python中的Pyttsx3,该Python使用Microsoft SDK SAPI5.1文本将文本用于语音合成器来从文本中生成音频。 我面临的问题是,它产生的语音速度不稳定,并且取决于文本的长度,单词的长度等。 这意味着相同的单词将根据其文字更快或更慢。 这些对我来说是挫折,因为我需要为我创建的程序正确工作的每个单词的时间戳,到目前为止,我尝试了不同的公式,它们都不是准确的。

有人有一个想法如何解决这个问题吗? (PS我不想使用语音分析来解决此问题,因为可靠性问题)

Hi I'm using pyttsx3 in python which uses the Microsoft SDK SAPI5.1 text to speech synthesizer to generate audio from text.
Problem that I'm facing is that the the speed of the speech it generate is not stable and it varies depending on the length of the text , the length of the words etc...
It means that the same words would be pronounce faster or slower depending on the text they're in.
These is setback for me because I need the timestamp for each word for the program that I'm creating to work properly , so far I try different formulas none of them are accurate.

Anyone has an idea how to solve this ? (ps I don't want to use speech analysis to solve this because of reliability issues)

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

逆蝶 2025-02-04 06:59:19

您需要设置事件处理程序以获取每个单词的通知。显然,PYTTSX使用Connect API来设置事件:

engine.connect('started-utterance', onStart)
engine.connect('started-word', onWord)
engine.connect('finished-utterance', onEnd)

OnWord签名具有持续时间(我相信)。

You need to set up event handlers to get a notification on each word. Apparently pyttsx uses the connect API to set up events:

engine.connect('started-utterance', onStart)
engine.connect('started-word', onWord)
engine.connect('finished-utterance', onEnd)

The onWord signature has the duration (I believe).

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文