python将文字转换为语音_python将文字翻译成语音

1586010002-jmsa.png

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 https://gist.github.com/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).

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?

thanks

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 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.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值