session canceling in azure speech services. speaker diarizer

blooni.app 0 Reputation points
2024-06-14T19:16:49.84+00:00

hello

i want to use azure speaker diarizer which is in this link.

the code runs for 30 seconds and then gives me this error:

SessionStarted 
event Canceled 
event CLOSING on ConversationTranscriptionCanceledEventArgs(session_id=f57c2b29297f46eeb2467caff71ced25, result=ConversationTranscriptionResult(result_id=cb5bf6cc3dca41a0b9324963a6fe1b4f, speaker_id=, text=, reason=ResultReason.Canceled)) 
SessionStopped event 
CLOSING on SessionEventArgs(session_id=f57c2b29297f46eeb2467caff71ced25)


this is the code i am using:


def recognize_from_file():
    # This example requires environment variables named "SPEECH_KEY" and "SPEECH_REGION"
    speech_config = speechsdk.SpeechConfig(subscription='xxx', region='eastus')
    speech_config.speech_recognition_language="en-US"

    audio_config = speechsdk.audio.AudioConfig(filename="audio_file_1.wav")
    conversation_transcriber = speechsdk.transcription.ConversationTranscriber(speech_config=speech_config, audio_config=audio_config)

    transcribing_stop = False

    def stop_cb(evt: speechsdk.SessionEventArgs):
        #"""callback that signals to stop continuous recognition upon receiving an event `evt`"""
        print('CLOSING on {}'.format(evt))
        nonlocal transcribing_stop
        transcribing_stop = True

    # Connect callbacks to the events fired by the conversation transcriber
    conversation_transcriber.transcribed.connect(conversation_transcriber_transcribed_cb)
    conversation_transcriber.session_started.connect(conversation_transcriber_session_started_cb)
    conversation_transcriber.session_stopped.connect(conversation_transcriber_session_stopped_cb)
    conversation_transcriber.canceled.connect(conversation_transcriber_recognition_canceled_cb)
    # stop transcribing on either session stopped or canceled events
    conversation_transcriber.session_stopped.connect(stop_cb)
    conversation_transcriber.canceled.connect(stop_cb)

    conversation_transcriber.start_transcribing_async()

    # Waits for completion.
    while not transcribing_stop:
        time.sleep(.5)

    conversation_transcriber.stop_transcribing_async()
recognize_from_file()

this user faced a similar problem, but his solution doesnt work on my case.

i used several audios same issue.

both are short audios, less then 4 minutes

i just created my account an hour ago so i didnt exceed 5 hours

how can i solve this?

thanks

Azure AI Speech
Azure AI Speech
An Azure service that integrates speech processing into apps and services.
1,516 questions
{count} votes