我正在创建一个项目,该项目使用Azure的voice to text向用户传回字符串。我想用SSML改变语音的性别和风格,但Python似乎并不真正支持字符串中所需的所有符号。我找不到关于它的任何文档,但有办法吗
我的代码:
import azure.cognitiveservices.speech as speechsdk
what_needs_to_be_spoken = "Sample text to be spoken"
# 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 = "insert_azure_speech_key_here", "eastus"
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)
# 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(what_needs_to_be_spoken).get()
语音合成器的SDK完全支持SSML
Python应该支持字符串中所需的所有符号
下面是python中字符串的概述
https://realpython.com/python-strings/#string-manipulation
如果您还需要更多,请告诉我们
相关问题 更多 >
编程相关推荐