Caldarie / flutter_tflite_audio

Audio classification Tflite package for flutter (iOS & Android). Can support Google Teachable Machine models
MIT License
64 stars 26 forks source link

How do I keep the stream listening #23

Closed jlia0 closed 3 years ago

jlia0 commented 3 years ago

I need to make an app that can continuously listen to the ambient sound. But the example can only work once and require restarting the audio recognition. Is there a workaround to achieve continuous listening?

Caldarie commented 3 years ago

Hi, have you tried setting numOfInference to a higher value? This parameter allows you to set how many times you want to loop the recognition. The stream will not close until the loop is finished.

Just to note, there’s currently a bug with android if you set numOfInference to a very high value, for example numOfInference = 9999. I aim for address this issue very soon.

Caldarie commented 3 years ago

hi @JLiao98

Good news, i have published the new update on dart pub. This should fix the memory issue when keeping the stream listening for a long period of time. You can set it numOfInference = 99999 if you wish to run it almost indefinitely.

Please let me know if you run across any bugs.