当前位置: 首页 > news >正文

TTS微软Azure

微软Azure

https://portal.azure.com/ 注册后绑定visa卡
image

创建微软语音服务

创建资源
image
选择AI应用和代理 -》 语音
image
输入语音服务必填项
image
然后点击创建
image
创建完成后如下
image
点击转到资源

语音服务

image
点击转到SpeechStudio
image
语音库
image
没有有声内容创作,切换到旧外观
image
出现有声内容创作
image

SDK

开发文档:
https://learn.microsoft.com/en-us/azure/ai-services/speech-service/get-started-text-to-speech?tabs=macos&pivots=programming-language-csharp
Github示例代码:
https://github.com/Azure-Samples/cognitive-services-speech-sdk

Python代码调用

VSCode下载Azure AI Speech Toolkit
image

Python代码调用API

安装azure包

pip install azure-cognitiveservices-speech
import os
import azure.cognitiveservices.speech as speechsdk# This example requires environment variables named "SPEECH_KEY" and "ENDPOINT"
# Replace with your own subscription key and endpoint, the endpoint is like : "https://YourServiceRegion.api.cognitive.microsoft.com"
speech_config = speechsdk.SpeechConfig(subscription=os.environ.get('SPEECH_KEY'), endpoint=os.environ.get('ENDPOINT'))
audio_config = speechsdk.audio.AudioOutputConfig(use_default_speaker=True)# The neural multilingual voice can speak different languages based on the input text.
speech_config.speech_synthesis_voice_name='zh-CN-XiaoxiaoNeural'speech_synthesizer = speechsdk.SpeechSynthesizer(speech_config=speech_config, audio_config=audio_config)# Get text from the console and synthesize to the default speaker.
print("Enter some text that you want to speak >")
text = input()speech_synthesis_result = speech_synthesizer.speak_text_async(text).get()if speech_synthesis_result.reason == speechsdk.ResultReason.SynthesizingAudioCompleted:print("Speech synthesized for text [{}]".format(text))
elif speech_synthesis_result.reason == speechsdk.ResultReason.Canceled:cancellation_details = speech_synthesis_result.cancellation_detailsprint("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 set the speech resource key and endpoint values?")
http://www.agseo.cn/news/351/

相关文章:

  • 12.6 类的封装
  • 深度解码你自己看着办:职场新人必须掌握的潜台词破解术
  • 6 个替代 Jira 的开源项目管理工具推荐
  • 记录一个Windows上的键盘鼠标模拟库和沟子库--Input
  • 惊世骇俗:《易经》六十四卦与数学公理完整映射表
  • 解决docker: Error response from daemon: Get “https://registry-1.docker.io/v2/“:连接超时问题
  • 27届春招备战一轮复习--第三期(推荐)
  • 数据集和数据系统_AI成为工作中很好用的协同成员了
  • IDM超详细图文安装激活教程,一次安装免费使用 Internet Download Manager
  • 标题
  • 12.5 多态与多态性
  • 集训日记
  • 数字孪生技术如何破解产线效率瓶颈? - 智慧园区
  • 三期集训 日记?
  • 需求爆炸?领歌3步科学精简法,让团队重获掌控力!
  • 从想法到代码:AI编程时代,我们如何高质量“喂养”AI?
  • 12.4 菱形继承问题(了解)
  • 25年CSP前ds做题记录
  • 极域电子学生机无法连接教师机
  • Python Flask框架入门_2.API增加授权验证
  • 12.2 类的派生
  • CSP-S模拟18
  • 在服务器后台运行python服务
  • HCIP回顾—2 OSPF工作过程及状态机制
  • python基础——函数小进阶
  • 你的开发服务器在说谎-热重载与热重启的关键区别
  • 在疼痛中,在喧嚣 失聪与惶惑中
  • AT_agc018_b [AGC018B] Sports Festival
  • 11.5 类与数据类型
  • 开发手记(二)——图片转换成base64编码