简体   繁体   中英

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

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

Is there 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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM