Using Google Speech API

梦想与她 提交于 2019-11-29 12:59:42

the following works in curl as long as the file sent is not too long... under 5 seconds.

curl -X POST -H "Content-Type: audio/x-flac; rate=16000" \ -T seg_1.flac "https://www.google.com/speech-api/v1/recognize? \ xjerr=1&client=speech2text&maxresults=1&lang=en-US&key=...48593"

{"status":0,"id":"","hypotheses":[{"utterance":"now it was the favorite pastime","confidence":0.95148802}]}

So, encode to speechX or flac

include a parm with your sample rate from the recording

include your key

keep the file short in duration ( you will have to split files prior to API access )

The FS_Audiofile filestream you are sending to Google is empty, that's why you are not receiving anything back.

You are missing this call:

recognizedAudio.WriteToAudioStream(FS_Audiofile);
标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!