Hello, I answered my question: you can get this status by connecting callback functions to the speech synthesizer:
How to poll asynchronous speech synthesis for status in Python
Hello,
I have an object of type speechsdk.SpeechSynthesizer which I am running asynchronous speech synthesis with speech_synthesizer.speak_ssml_async() on, and I want to be able to tell when the synthesis has completed (i.e. how to poll it for an updated result). I can call result.get() but it never changes from ResultReason.SynthesizingAudioStarted. I would like to, for example, be able to poll something and get ResultReason.SynthesizingAudioCompleted once the audio synthesis is complete.
Code to reproduce is below. Polling the result object always prints ResultReason.SynthesizingAudioStarted, even after audio synthesis is clearly finished.
Thank you!
text = 'READ THIS MESSAGE!'
speech_config = speechsdk.SpeechConfig(
subscription=config['key'], region=config['region'])
audio_config = speechsdk.audio.AudioOutputConfig(use_default_speaker=True)
speech_synthesizer = speechsdk.SpeechSynthesizer(
speech_config=speech_config, audio_config=audio_config)
result = speech_synthesizer.start_speaking_ssml_async(f"""
<speak xmlns="http://www.w3.org/2001/10/synthesis" xmlns:mstts="http://www.w3.org/2001/mstts" xmlns:emo="http://www.w3.org/2009/10/emotionml" version="1.0" xml:lang="zh-CN">
<voice name="zh-CN-XiaoxiaoNeural">
<mstts:express-as style="hat" styledegree="1.5">
<prosody rate="-3%" pitch="+0%" range="+5%">
{text}
</prosody>
</mstts:express-as>
</voice>
</speak>
""")
while True:
print(result.get())