开发者

Is there any way to send audio file to the speech-to-text recognition

开发者 https://www.devze.com 2023-01-25 00:50 出处:网络
I want the Android speech recognition system analysing audio file and not the default incoming voice from microphone.

I want the Android speech recognition system analysing audio file and not the default incoming voice from microphone.

Is there开发者_StackOverflow社区 any way to do that ?

Thank you.


I suppose it works in a similar way to the chrome api - http://mikepultz.com/2011/03/accessing-google-speech-api-chrome-11/

As he has mentioned you can convert the microphone file into a .flac file and send it to the speech api, and you will get the same result. So you can use SOX and convert it yourself.

Hope it helps. Dias


cmusphinx.sourceforge.net/wiki/tutorialandroid Just found that link sounds like someone has created a android version of Sphinx.

Looking at the Android api doing this doesn't seem to be supported. (http://developer.android.com/reference/android/speech/package-summary.html)

You might be able to using another API.

I know that Microsoft's C# api allows this but in order for that to be useful you would probably need to setup a server with a program you wrote record the sound file on the phone and then send it to the server.

CMUSphinx (http://cmusphinx.sourceforge.net/wiki/) is written in Java so it might be possible to get it running on an Android device. On that api you create a StreamSpeechReconizer.

StreamSpeechRecognizer recognizer = new StreamSpeechRecognizer(configuration);
recognizer.startRecognition(new File("speech.wav").toURI().toURL());
SpeechResult result = recognizer.getResult();
recognizer.stopRecognition();

I found this https://gist.github.com/alotaiba/1730160 with a quick web search (google "speech recognition api accepts file") so there might be other services available on the web that would accept a file to be sent to them.

0

精彩评论

暂无评论...
验证码 换一张
取 消