wit-ai / wit

Natural Language Interface for apps and devices
https://wit.ai/
931 stars 91 forks source link

Voice recognition does not work when startng the scene for a second time. #2732

Open SportsImproVR-Joost opened 2 weeks ago

SportsImproVR-Joost commented 2 weeks ago

Do you want to request a feature, report a bug, or ask a question about wit?

What is the current behavior?

If the current behavior is a bug, please provide the steps to reproduce and if possible a minimal demo of the problem.

What is the expected behavior?

If applicable, what is the App ID where you are experiencing this issue? If you do not provide this, we cannot help.

I have an application that consists of a selection scene and then multiple other scenes. Only one of them has voice recognition. When I select the voice recognition scene from the selection scene for the first time it works fine. But when I go back to the selection scene and then start the voice regonition scene again it does not work anymore and I get the following error: joostvrbeelding_0-1718873048450

The expected behaviour is that the words I speak are still recognizes, just like the first time I invoke the scene.

I found a post with the same error message, but in a different context. I am not doing anything with AudioBuffer (afaik, maybe under the hood somewhere). https://github.com/wit-ai/wit/issues/2588

Is this a bug? Or am I doing something wrong in starting or terminating Wit

I just now tried to find the app id, but Wit keeps logging in with my second Meta account and I can't seem to switch accounts.

[Edit} I tried adding a Wit component to the GameObject that has the AppVoiceExperience component, because the error seems to suggest that something goes wrong when trying to add this (in line 191), but that made no difference in the functionality.

I did get a different error mesage this time: image

So Ifigured I should add a WitService component to the GameObject as well and then the error looks like: image

Now I'm running out of troubleshooting ideas, so I hope someone can help me.

SportsImproVR-Joost commented 4 days ago

With some help from kuffcof who wrote the other issue I was able to solve this.

The solution is to add the line _instanceInit = false to OnDisable

    private void OnDisable()
  {
       _micInput.OnSampleReady -= OnMicSampleReady;

      if (alwaysRecording) StopRecording(this);
       _instanceInit = false;
  }

I hope this will be included in the script so that my change does not get overriden when I update to a new version of the Meta SDK.

Tahatahdish commented 3 days ago

With some help from kuffcof who wrote the other issue I was able to solve this.

The solution is to add the line _instanceInit = false to OnDisable

    private void OnDisable()
  {
       _micInput.OnSampleReady -= OnMicSampleReady;

      if (alwaysRecording) StopRecording(this);
       _instanceInit = false

I hope this will be included in the script so that my change does not get overriden when I update to a new version of the Meta SDK.