How to fix Exception with an error code:0x15 (SPXERR_MIC_ERROR)

Meixuan MX4 Luo 0 Reputation points
2024-12-02T02:57:56.8833333+00:00

I built a voice assistant, and after conversing for a while, the following error occurred in the voice recognition:
Error: ErrorCode=RuntimeError, ErrorDetails=0x15 (SPXERR_MIC_ERROR)
My calling method is as follows. Could you please tell me why this problem occurred and how to solve it?

private fun recognizeFromMicrophone(speechConfig: SpeechConfig?) {
    try {
        val audioConfig = AudioConfig.fromDefaultMicrophoneInput()
        speechRecognizer = SpeechRecognizer(speechConfig, audioConfig)

        myRecognizerListener?.onBeginOfSpeech()
        recognizingResult = ""

      
        speechRecognizer.recognizing.addEventListener { _, e ->
            handleRecognizingEvent(e.result.text)
        }

      
        CoroutineScope(Dispatchers.IO).launch {
            try {
                val speechRecognitionResult: SpeechRecognitionResult = speechRecognizer.recognizeOnceAsync().get()
                handleRecognitionResult(speechRecognitionResult)
            } catch (e: Exception) {
                VoiceLog.error(TAG, "Error: " + e.message)
                withContext(Dispatchers.Main) {
                    myRecognizerListener?.onError(VoiceError("Azure_Recognize_Error_400", e.message ?: "Unknown error"))
                }
            }
        }
    } catch (e: Exception) {
        VoiceLog.error(TAG, "Error starting speech recognizer: ${e.message}")
    }
}
Azure AI Speech
Azure AI Speech
An Azure service that integrates speech processing into apps and services.
1,954 questions
{count} votes

1 answer

Sort by: Most helpful
  1. navba-MSFT 27,485 Reputation points Microsoft Employee
    2024-12-07T09:51:36.0933333+00:00

    @Meixuan MX4 Luo I tried Android example but didn't repro in 4 hour audio.

    https://github.com/Azure-Samples/cognitive-services-speech-sdk/tree/master/samples/java/android/sdkdemo/app/src/main/java/com/microsoft/cognitiveservices/speech/samples/sdkdemo

    Could you please refer the sample code. (for example, start, stop and close recognizer...) ? Awaiting your reply.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.