Recorded sound file (ala google now, google keep) - RecognizerIntent/Listener

无人久伴 提交于 2019-12-09 13:32:20

问题


I have been developing an application that uses the recognizerIntent to get voice input. However, since jelly bean was launched, I have not been able to get the actual sound file from my voice input.

In the recognitionListener (http://developer.android.com/reference/android/speech/RecognitionListener.html) there is a method called onBufferReceived. However, there are no promises that this method will be called, and when I implemented it, it never got called. Is there any way to force this method to execute or what is the "best-practice"-approach to gather the sound file that the recognizerIntent analyzes?

It should be possible since both google now can do it with the voice-command "note-to-self", and Google Keep:s voice-notes does the same.

Thanks


回答1:


I don't think there is a way to force it. It clearly depends on the recognition service implementation. If Google decides to not call onBufferReceived then there is no way to get the actual data that is used. Note that the mentioned Google apps don't use the (public) Intent / Service API to access the speech recognition but seem to use a private API within the apps (the speech recognition might be bundled within their apps).



来源:https://stackoverflow.com/questions/15547438/recorded-sound-file-ala-google-now-google-keep-recognizerintent-listener

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!