Hi Kaarel, I needed a solution for pause detection in my app and your solution is the best one I've found. Good work and thanks for sharing. I've abstracted it so it's easier to include anywhere.
The issue is with the MediaRecorder.AudioSource type and how differently it behaves between MIC and VOICE_RECOGNITION and across various devices. I've added a PAUSE_IGNORE_TIME to prevent the immediate reports of pause scores > 100 being triggered, until the results appear to settle down to below PAUSE_THRESHOLD = 7.
Not sure if the threading and synchronisation is a little too much, but seems to work fine.
Hope constructing it as a separate entity will help perfect it.
I've also added my standard logging class, as I couldn't be bothered to remove it all from my code :)
Gist of Classes here
Ben
Hi Kaarel, I needed a solution for pause detection in my app and your solution is the best one I've found. Good work and thanks for sharing. I've abstracted it so it's easier to include anywhere.
The issue is with the MediaRecorder.AudioSource type and how differently it behaves between MIC and VOICE_RECOGNITION and across various devices. I've added a PAUSE_IGNORE_TIME to prevent the immediate reports of pause scores > 100 being triggered, until the results appear to settle down to below PAUSE_THRESHOLD = 7.
Not sure if the threading and synchronisation is a little too much, but seems to work fine.
Hope constructing it as a separate entity will help perfect it.
I've also added my standard logging class, as I couldn't be bothered to remove it all from my code :)
Gist of Classes here
Ben