微软的文本转语音服务,已经听不出是机器了
Python七号
共 2931字,需浏览 6分钟
·
2021-12-19 13:54
今天刷到了微软在 2021 年 5 月发布的文本转语音服务(TTS),试了下,真的听不出这是机器在读,而且,可以分辨出中文的多音字,如士大夫和大(dai)夫,儿化音也可以连起来,可以自动推断出语气和情感,非常智能。感觉以后的播音员要失业了。
大家先来听一段官方的样例,看一看能否听得出这是机器人读的?
如果感兴趣,可以在这里[1]自己测试下。
要是微信读书里面的机器人可以这么读,那体验就更好了。
微软也给出了 Python 语言调用该服务的代码:
import azure.cognitiveservices.speech as speechsdk
# Creates an instance of a speech config with specified subscription key and service region.
# Replace with your own subscription key and service region (e.g., "westus").
speech_key, service_region = "YourSubscriptionKey", "YourServiceRegion"
speech_config = speechsdk.SpeechConfig(subscription=speech_key, region=service_region)
# Creates a speech synthesizer using the default speaker as audio output.
speech_synthesizer = speechsdk.SpeechSynthesizer(speech_config=speech_config)
# Receives a text from console input.
print("Type some text that you want to speak...")
text = input()
# Synthesizes the received text to speech.
# The synthesized speech is expected to be heard on the speaker with this line executed.
result = speech_synthesizer.speak_text_async(text).get()
# Checks result.
if result.reason == speechsdk.ResultReason.SynthesizingAudioCompleted:
print("Speech synthesized to speaker for text [{}]".format(text))
elif result.reason == speechsdk.ResultReason.Canceled:
cancellation_details = result.cancellation_details
print("Speech synthesis canceled: {}".format(cancellation_details.reason))
if cancellation_details.reason == speechsdk.CancellationReason.Error:
if cancellation_details.error_details:
print("Error details: {}".format(cancellation_details.error_details))
print("Did you update the subscription info?")
运行上述代码,需要你在微软的 Azure 注册一个账号,可以免费试用,具体教程[2]见文末。
最后的话
相信在不久的将来,我们完全分辨不出听到的声音是真人发出的还是机器人发出的。
推荐阅读:
留言
参考资料
这里: https://azure.microsoft.com/en-us/services/cognitive-services/text-to-speech/?ocid=AID3027325#features
[2]教程: https://docs.microsoft.com/zh-cn/azure/cognitive-services/speech-service/get-started-text-to-speech?tabs=script%2Cwindowsinstall&pivots=programming-language-python
评论
MaryTTSJava 编写的文本转语音系统
MaryTTS是一个用纯Java写的文本转语音客户端服务器系统,因此可以在许多平台上运行。运行MaryTTS运行./gradlewrun 启动MaryTTS服务器。然后使用Web浏览器在 http:/
MaryTTSJava 编写的文本转语音系统
0
Ekho中文文本转语音引擎
Ekho(余音)是一个把文字转换成声音的软件。它目前支持粤语、普通话(国语)、诏安客语、藏语、雅言(中国古代通用语)和韩语(试验中),英文则通过Festival间接实现。支持Linux、Windows
Ekho中文文本转语音引擎
0
gTTS基于 Python 的文本转语音库
gTTS是一个Python库和CLI工具,用于与GoogleTranslate的text-to-speechAPI交互。特征可定制的特定于语音的句子标记器,允许阅读无限长度的文本,同时保持正确的语调、
gTTS基于 Python 的文本转语音库
0
Coqui TTS基于深度学习的文本转语音库
CoquiTTS是一个用于高级文本到语音生成的库。它建立在最新研究的基础上,旨在实现易于训练、速度和质量之间的最佳平衡。CoquiTTS带有预训练模型、用于测量数据集质量的工具,并且已经在20多种语言
Coqui TTS基于深度学习的文本转语音库
0