python将文字翻译成语音

编程入门 行业动态 更新时间:2024-10-28 00:24:05
本文介绍了python将文字翻译成语音的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我正在测试文本翻译 (从英语到其他语言),并使用python翻译为音频代码.我正在使用Google Translation API进行翻译,并使用Win32进行音频处理. 在测试时,我发现Google支持 gist.github/jseabold/1473363 这些语言.代码的翻译部分似乎可以在许多选项上正常工作,但是音频部分仅适用于几种语言(英语,西班牙语,意大利语等).

I am working on testing text translation (from English to other language) and translation to audio code using python. I am using google translate api for translation and win32 for audio. While testing i found that google supports gist.github/jseabold/1473363 these languages. The translation part of code seem to be working fine for many options but audio part only works with a few languages (english , spanish , italian etc works).

如您在下面的示例中看到的,我可以看到文本正确地翻译成北印度语,但我没有音频输出.我觉得wincl.dispatch在Google翻译时不支持所有语言.此外,我无法找到有关支持的语言的win32 api的详细信息.您能帮我找到此列表还是将其显示为印地文音频解决方案吗?

as you can see in example below I can see text is translated into Hindi correctly but i get no audio output. I feel that wincl.dispatch is not supporting all languages as google translate. furthurmore i could not find details on win32 api regarding supported languages. can you help me finding this list or in engilsh text to hindi audio solution?

谢谢

from googletrans import Translator import win32com.client as wincl translator = Translator() a=translator.translate('안녕하세요.') a=translator.translate('I am robot',src='en',dest='hi') print (a.text) speak = wincl.Dispatch("SAPI.SpVoice") speak.Speak(a.text) मैं रोबोट हूँ Process finished with exit code 0

推荐答案

SAPI仅支持已安装的语音.由于Microsoft没有印地语TTS语音,因此您将需要在其他地方寻找兼容SAPI的印地语TTS语音或支持印地语TTS的Web服务.网页搜索将帮助您进行选择.

SAPI only supports voices that are installed. Since Microsoft doesn't have a Hindi TTS voice, you will need to look elsewhere for either a SAPI-compliant Hindi TTS voice, or a web service that supports Hindi TTS. A web search will help you with your selection.

更多推荐

python将文字翻译成语音

本文发布于:2023-06-07 13:59:06,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/583072.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:翻译成   语音   文字   python

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!