Google语音识别学习札记 - Windows PC机上测试语音识别

来源:互联网 发布:网络平台推广是什么 编辑:程序博客网 时间:2024/06/05 14:06
Google语音识别学习札记 - Windows PC机上测试语音识别API


第一步:录制Google识别的录音文件
Audacity是免费,开源,跨平台的声音录制编辑软件。
启动应用,在左下角选择16000mHZ录音,录音后保存为speechInput.flac文件
下载地址:http://audacity.sourceforge.net/?lang=zh-CN


第二步:调用Google接口进行语音识别测试
下面用免费的wget命令行程序,调用Google接口,要求进行中文语言zh-CN识别,源输入录音文件为flac格式,编码率为16000mHZ,返回信息输出到GoogleSpeechAPI.txt文件。
wget -O "GoogleSpeechAPI.txt" --user-agent="Mozilla/5.0" --post-file=speechInput.flac --header="Content-Type: audio/x-flac; rate=16000" "http://www.google.com/speech-api/v1/recognize?xjerr=1&client=chromium&lang=zh-CN&maxresults=1"


Google返回结果如下:
{"status":0,"id":"a44e9fab4888a7713175a07b035d49ad-1","hypotheses":[{"utterance":"大家早上好","confidence":0.7236291}]}




参考: 
Google 语音识别介绍

中文介绍:FLAC stands for Free Lossless Audio Codec, an audio format similar to MP3

原创粉丝点击