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

2019-02-12 03:16发布

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.

2条回答
虎瘦雄心在
2楼-- · 2019-02-12 03:38

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

查看更多
可以哭但决不认输i
3楼-- · 2019-02-12 03:49

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.

查看更多
登录 后发表回答