Azure-Samples / cognitive-services-speech-sdk

Sample code for the Microsoft Cognitive Services Speech SDK
MIT License
2.8k stars 1.83k forks source link

Cognitive speech service is not working in one of the zebra device TC51 but same code working fine in other device (Nokia 7.2) #2514

Closed JituVarghese closed 1 week ago

JituVarghese commented 1 month ago

I am developing a app having continuous speech to text functionality using Microsoft speech to text cognitive services SDK , its working fine & start the continuous speech to text process in Nokia 7.2 but its not working in Zebra device TC51 as it automatically stopped session instantly with cancellation reason end of stream.

I am using speech recognition SDK version : com.microsoft.cognitiveservices.speech:client-sdk:1.38.0

Code :

 **Speech Recognition initialization code**

private val speechReco: SpeechRecognizer by lazy { speechConfig = SpeechConfig.fromSubscription(speechSubscriptionKey, speechRegion) // config.SetProperty("SPEECH-AudioBufferLength", "100"); speechConfig?.setProperty("SPEECH-AudioBufferLength","100") destroyMicrophoneStream() // in case it was previously initialized microphoneStream = MicrophoneStream() SpeechRecognizer( speechConfig, AudioConfig.fromStreamInput(MicrophoneStream.create()) )

}

     ** Continuous speech recognition process**

private fun startReco() { startRecoButton.isEnabled = false

    val task = speechReco.startContinuousRecognitionAsync()
    executorService.submit {
        task.get()
        Log.i(activityTag, "Continuous recognition finished. Stopping speechReco")
    }

    speechReco.canceled.addEventListener { sender, e ->
        Log.i(
            "Session started",
            "canceled executed---${e.sessionId.toString()} result---${e.result.toString()}--- reason ${e.reason.toString()}--- error code ${e.errorCode.toString()}--- errordetails ${e.errorDetails.toString()}"
        )

    }
    speechReco.sessionStarted.addEventListener { sender, e ->

        Log.i(
            "Session started",
            "session executed---${e.sessionId.toString()} sender---${sender.toString()}--- Authorization ${speechReco.authorizationToken.toString()}"
        )
    }

    speechReco.sessionStopped.addEventListener { sender, e ->
        Log.i(
            "Session started",
            "session stopped executed---${e.sessionId.toString()} sender---${sender.toString()}--- Authorization ${speechReco.authorizationToken.toString()}"
        )

    }

    speechReco.recognized.addEventListener { sender, e ->

        Log.i(
            "Session started",
            "recognized executed---${e.result.text.toString()} sender---${sender.toString()}  --- ${e.result.text}"
        )
        val finalResult = e.result.text
        runOnUiThread {
            recognizedText.text = (finalResult)
        //    stopReco()
        }
    }
    speechReco.recognizing.addEventListener { sender, e ->

        Log.i(
            "Session started",
            "recognizing executed---${e.result.text.toString()} sender---${sender.toString()}"
        )

    }

  //  speechReco.startContinuousRecognitionAsync()

}

Response :

Errorcode : NoError Status code : Canceled Recognized text:<> Canellation Reason : EndOfStream Error Details : " "

Complete response details as follows:

e = {SpeechRecognitionCanceledEventArgs@5797} "SessionId:94561080e4d94bcf95bbe2f3045da5b1 ResultId:5ea199e6a78d45a6b79ea80528cd290b CancellationReason:EndOfStream CancellationErrorCode:NoError Error details:<" cancellationReason = {CancellationReason@5748} "EndOfStream" errorCode = {CancellationErrorCode@5749} "NoError" errorDetails = "" result = {SpeechRecognitionResult@5800} "ResultId:5ea199e6a78d45a6b79ea80528cd290b Status:Canceled Recognized text:<>." offset = {BigInteger@5801} "0" eventHandle = null maxSessionID = 37 maxUUID = 36 sessionId = "94561080e4d94bcf95bbe2f3045da5b1"

Please suggest any changes or solution for it. Thanks

github-actions[bot] commented 1 month ago

This item has been open without activity for 19 days. Provide a comment on status and remove "update needed" label.

pankopon commented 1 month ago

Hi, Speech SDK releases have been tested on the following Android hardware and OS versions:

Unfortunately, depending on vendor specific customizations of the OS, functionality cannot be guaranteed on every possible device.

Based on a quick search, it is a bit unclear whether Zebra TC51 has cellular connectivity or if it's an Android device with no phone functionality?

If possible, please record and post a Speech SDK log from the failing case: https://learn.microsoft.com/azure/ai-services/speech-service/how-to-use-logging . Use the latest Speech SDK release, 1.40.0 as of this writing.

github-actions[bot] commented 1 week ago

This item has been open without activity for 19 days. Provide a comment on status and remove "update needed" label.

pankopon commented 1 week ago

Closed since no logs available.