locked
Data is still sent to reco engine after EndMicandRecognition? RRS feed

  • Question

  • using VB

    on formload I startMicandRecogntion

    I play an audio clip that prompts for input (playing the clip triggers EndMicandRecognition)

    when the clip has stopped it  then calls StartMicandRecogntion again.

    For some reason voice input is still gathered if the person speaks during the question. so it handles that input instead of input gathered after the clip has ended (it gets backed up)

    Is there something I am missing here?

    Any input or thoughts on this would be greatly appreciated. Is there a buffer or something I can clear when the clip ends so it only processes the recognition data after the question has been asked?

    Friday, June 3, 2016 6:29 PM

All replies

  • I know this question is a few months old but as it is the first thing that comes up in Google I wanted to share a solution to the problem.

    If you set the MicrophoneRecognitionClient to null and create it again when you need it, it stops listening (obviously). It's not the most elegant way to handle the problem but it works.

    Let that garbage collector do its job.

    public void start()
    {
        if (micClient == null)
        {
            CreateMicrophoneRecoClient();
        }
        micClient.StartMicAndRecognition();
    }
    
    public void stop()																		        {
        if (micClient != null)
        {
            micClient.EndMicAndRecognition();
    	micClient = null;
        }
    }
    
    private void CreateMicrophoneRecoClient()
    {
        micClient = SpeechRecognitionServiceFactory.CreateMicrophoneClient(Mode, DefaultLocale, subscriptionKey, subscriptionKey);
        micClient.OnMicrophoneStatus += OnMicrophoneStatus;
        micClient.OnPartialResponseReceived += OnPartialResponseReceivedHandler;
        micClient.OnConversationError += OnConversationErrorHandler;
    }

    Friday, August 26, 2016 2:11 PM
  • Thanks Michael. I was really hoping to not have to re instantiate it as that uses up another key and I only get 5k free a month. As it stands the recognizer shuts off after 2 min and needs to be reset. It would seem this is the only viable solution. Any idea what the difference is between "EndMicandRecognition' and 'stopAudio'? 
    Friday, August 26, 2016 6:38 PM