[Python] How to get timestamps in Azure text to Speech Synthesized Audio

Discussão em 'Python' iniciado por Stack, Abril 22, 2025.

  1. Stack

    Stack Membro Participativo

    I am trying get timestamps for the generated audio using Azure Text to Speech. I have configured the speech config correctly but I can't find any property related to timestamps in response object. Following code is my code.

    speech_config = speechsdk.SpeechConfig(subscription=speech_key, region=service_region)

    speech_config.speech_synthesis_voice_name = "en-US-AndrewMultilingualNeural"
    speech_config.request_word_level_timestamps()

    text = "Hi"

    # use the default speaker as audio output.
    speech_synthesizer = speechsdk.SpeechSynthesizer(speech_config=speech_config)

    result = speech_synthesizer.speak_text_async(text).get()
    print(result.properties)

    Continue reading...

Compartilhe esta Página