有没有办法将音频文件发送到语音到文本识别

时间:2021-12-24 19:42:35

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

我希望Android语音识别系统能够分析音频文件而不是麦克风的默认传入语音。

Is there any way to do that ?

有没有办法做到这一点?

Thank you.

谢谢。

2 个解决方案

#1


1  

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

我认为它的工作方式与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.

正如他所提到的,您可以将麦克风文件转换为.flac文件并将其发送到语音API,您将得到相同的结果。所以你可以使用SOX并自己转换它。

Hope it helps. Dias

希望能帮助到你。迪亚斯

#2


1  

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

cmusphinx.sourceforge.net/wiki/tutorialandroid刚刚发现链接听起来有人创建了一个Android版的Sphinx。

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

看看Android api这样做似乎不受支持。 (http://developer.android.com/reference/android/speech/package-summary.html)

You might be able to using another API.

您可以使用其他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.

我知道微软的C#api允许这样做,但为了使它有用,你可能需要设置一个服务器,你编写的程序记录手机上的声音文件,然后将其发送到服务器。

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.

CMUSphinx(http://cmusphinx.sourceforge.net/wiki/)是用Java编写的,因此可以在Android设备上运行它。在那个api上你创建一个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.

我发现这个https://gist.github.com/alotaiba/1730160有一个快速的网络搜索(谷歌“语音识别api接受文件”)所以网上可能有其他服务可以接受一个文件发送到他们。

#1


1  

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

我认为它的工作方式与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.

正如他所提到的,您可以将麦克风文件转换为.flac文件并将其发送到语音API,您将得到相同的结果。所以你可以使用SOX并自己转换它。

Hope it helps. Dias

希望能帮助到你。迪亚斯

#2


1  

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

cmusphinx.sourceforge.net/wiki/tutorialandroid刚刚发现链接听起来有人创建了一个Android版的Sphinx。

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

看看Android api这样做似乎不受支持。 (http://developer.android.com/reference/android/speech/package-summary.html)

You might be able to using another API.

您可以使用其他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.

我知道微软的C#api允许这样做,但为了使它有用,你可能需要设置一个服务器,你编写的程序记录手机上的声音文件,然后将其发送到服务器。

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.

CMUSphinx(http://cmusphinx.sourceforge.net/wiki/)是用Java编写的,因此可以在Android设备上运行它。在那个api上你创建一个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.

我发现这个https://gist.github.com/alotaiba/1730160有一个快速的网络搜索(谷歌“语音识别api接受文件”)所以网上可能有其他服务可以接受一个文件发送到他们。