Picovoice / porcupine

On-device wake word detection powered by deep learning
https://picovoice.ai/
Apache License 2.0
3.76k stars 499 forks source link

Porcupine Issue: Porcupine start() in Android library is failing to create AudioRecord #1131

Closed LloydHussell-TomTom closed 1 year ago

LloydHussell-TomTom commented 1 year ago

Expected behaviour

Picovoice should start recording after creating a valid AudioRecord

Actual behaviour

AudioRecord fails to initialise, giving the Picovoice error: ai.picovoice.android.voiceprocessor.VoiceProcessorStateException: Audio recorder did not initialize successfully. Ensure you have acquired permission to record audio from the user.

Steps to reproduce the behaviour

The issue is, I am only getting this on my Asus Tinkerboard 2S. I have noticed that other audio recording applications work fine. I have noticed that the AudioRecord is failing to initialise in the native libs. I suspect it's due to the sample rate provided not being accepted at this point. So I was wondering if we could provide a way to lower or raise the sample rate a little, although the docs say only 16KHz is accepted.

Note, I have fully enabled permissions and have validated the app is enabled for audio recording in multiple places.

ksyeo1010 commented 1 year ago

Our Android library only allows recording via 16KHz. If your device only supports other sample rates, you should use Porcupine low-level API over PorcupineManager and implement your own audio recording + resampler.