1

I'm creating a project that uses Azure's voice to text to speak a string back to the user. I want to change the voice gender and style with SSML, but Python does not seem to really support all the symbols needed in the string. I can't find any documentation on it, but is there a way?

My code:

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()

1 Answers1

0

SSML is fully supported in the SDK for the SpeechSynthesizer

Python should support all the symbols needed inside the string.

Here is a general overview of Strings in python.

https://realpython.com/python-strings/#string-manipulation

Please let us know if there is more you need.

chschrae
  • 36
  • 2
  • I was able to add the symbols needed to use the SSML in the python string. However, Azure's Text to Speech does not support the input method. How do I change the intonation of the 'speech-bot'? – g.schindler17 Jul 16 '21 at 13:20
  • I'm a little confused at what part isn't working. Are you saying there is valid SSML that is being passed to the speak_text_async()? What is the SSML you are having trouble with? – chschrae Jul 18 '21 at 03:58