我正在尝试使用Google Cloud Speech API转录一个简短的采访音频文件,但它只能转录录音的前半分钟。我进行了多次尝试,录音时间超过一分钟,结果是相同的。我的问题是,如何获得给定文件的完整音频转录?
您可以在这里找到我的一个用例:
上载音频文件:
POST https://speech.googleapis.com/v1beta1/speech:asyncrecognize?key={YOUR_API_KEY}
{
"config": {
"encoding": "LINEAR16",
"sampleRate": 16000,
},
"audio": {
"uri": "gs://protean-blend-146812.appspot.com/record__2017_02_02_12_02_17_greg_16000.wav",
}
}
在响应中得到了操作编号:
{
"name": "8977932499808116064"
}
使用操作号进行请求:
GET https://speech.googleapis.com/v1beta1/operations/8977932499808116064?key={YOUR_API_KEY}
得到结果:
{
"name": "8977932499808116064",
"metadata": {
"@type": "type.googleapis.com/google.cloud.speech.v1beta1.AsyncRecognizeMetadata",
"progressPercent": 100,
"startTime": "2017-02-02T11:21:41.346784Z",
"lastUpdateTime": "2017-02-02T11:23:03.150491Z"
},
"done": true,
"response": {
"@type": "type.googleapis.com/google.cloud.speech.v1beta1.AsyncRecognizeResponse",
"results": [
{
"alternatives": [
{
"transcript": "McGregor you have any stories about being lost that you have all the good advice well let me know in the Golden …
speech-recognition google-api speech-to-text google-speech-api google-cloud-speech
我做了一个新的构建(周末之后)和我的应用程序崩溃,下面的例外.有趣的是,我上周使用相同的配置进行了构建,没有任何代码更改,然后就可以了.该应用程序在模拟器上运行良好,但在我的三星Galaxy Tab 2 10.1抛出异常.我正在使用Android Studio 1.5.1.有人面临同样的问题吗?
12-21 14:19:27.359 6142-6142/? E/AndroidRuntime: FATAL EXCEPTION: main
java.lang.NullPointerException
at android.view.View.getHardwareLayer(View.java:10225)
at android.view.ViewGroup.drawChild(ViewGroup.java:2863)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:2489)
at android.view.View.getDisplayList(View.java:10462)
at android.view.ViewGroup.drawChild(ViewGroup.java:2850)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:2489)
at android.view.View.getDisplayList(View.java:10462)
at android.view.ViewGroup.drawChild(ViewGroup.java:2850)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:2489)
at android.view.View.draw(View.java:11028)
at android.view.View.getDisplayList(View.java:10464)
at android.view.ViewGroup.drawChild(ViewGroup.java:2850)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:2489)
at android.view.View.draw(View.java:11028)
at android.widget.FrameLayout.draw(FrameLayout.java:450)
at android.view.View.getDisplayList(View.java:10464)
at android.view.ViewGroup.drawChild(ViewGroup.java:2850)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:2489)
at android.view.View.getDisplayList(View.java:10462)
at android.view.ViewGroup.drawChild(ViewGroup.java:2850)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:2489)
at android.view.View.getDisplayList(View.java:10462)
at android.view.ViewGroup.drawChild(ViewGroup.java:2850)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:2489)
at android.view.View.getDisplayList(View.java:10462)
at android.view.ViewGroup.drawChild(ViewGroup.java:2850)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:2489)
at android.view.View.getDisplayList(View.java:10462)
at android.view.HardwareRenderer$GlRenderer.draw(HardwareRenderer.java:840)
at android.view.ViewRootImpl.draw(ViewRootImpl.java:1923)
at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1647)
at android.view.ViewRootImpl.handleMessage(ViewRootImpl.java:2459)
at android.os.Handler.dispatchMessage(Handler.java:99) …
Run Code Online (Sandbox Code Playgroud)