资源简介
百度语音识别通过REST API的方式给开发者提供一个通用的HTTP接口,基于该接口,开发者可以轻松的获取语音识别能力,本工程演示了如何在VS2017下使用语音识别服务REST API,具体介绍可见 http://blog.csdn.net/update_sh/article/details/77914559

代码片段和文件信息
/***************************************************************************
*
* Copyright (c) 2014 Baidu.com Inc. All Rights Reserved
*
**************************************************************************/
#include “base64.h“
static const std::string base64_chars =
“ABCDEFGHIJKLMNOPQRSTUVWXYZ“
“abcdefghijklmnopqrstuvwxyz“
“0123456789+/“;
static inline bool is_base64(unsigned char c) {
return (isalnum(c) || (c == ‘+‘) || (c == ‘/‘));
}
std::string base64_encode(unsigned char const* bytes_to_encode unsigned int in_len) {
std::string ret;
int i = 0;
int j = 0;
unsigned char char_array_3[3];
unsigned char char_array_4[4];
while (in_len--) {
char_array_3[i++] = *(bytes_to_encode++);
if (i == 3) {
char_array_4[0] = (char_array_3[0] & 0xfc) >> 2;
char_array_4[1] = ((char_array_3[0] & 0x03) << 4) + ((char_array_3[1] & 0xf0) >> 4);
char_array_4[2] = ((char_array_3[1] & 0x0f) << 2) + ((char_array_3[2] & 0xc0) >> 6);
char_array_4[3] = char_array_3[2] & 0x3f;
for(i = 0; (i <4) ; i++)
ret += base64_chars[char_array_4[i]];
i = 0;
}
}
if (i)
{
for(j = i; j < 3; j++)
char_array_3[j] = ‘\0‘;
char_array_4[0] = (char_array_3[0] & 0xfc) >> 2;
char_array_4[1] = ((char_array_3[0] & 0x03) << 4) + ((char_array_3[1] & 0xf0) >> 4);
char_array_4[2] = ((char_array_3[1] & 0x0f) << 2) + ((char_array_3[2] & 0xc0) >> 6);
char_array_4[3] = char_array_3[2] & 0x3f;
for (j = 0; (j < i + 1); j++)
ret += base64_chars[char_array_4[j]];
while((i++ < 3))
ret += ‘=‘;
}
return ret;
}
std::string base64_decode(std::string const& encoded_string) {
int in_len = encoded_string.size();
int i = 0;
int j = 0;
int in_ = 0;
unsigned char char_array_4[4] char_array_3[3];
std::string ret;
while (in_len-- && ( encoded_string[in_] != ‘=‘) && is_base64(encoded_string[in_])) {
char_array_4[i++] = encoded_string[in_]; in_++;
if (i ==4) {
for (i = 0; i <4; i++)
char_array_4[i] = base64_chars.find(char_array_4[i]);
char_array_3[0] = (char_array_4[0] << 2) + ((char_array_4[1] & 0x30) >> 4);
char_array_3[1] = ((char_array_4[1] & 0xf) << 4) + ((char_array_4[2] & 0x3c) >> 2);
char_array_3[2] = ((char_array_4[2] & 0x3) << 6) + char_array_4[3];
for (i = 0; (i < 3); i++)
ret += char_array_3[i];
i = 0;
}
}
if (i) {
for (j = i; j <4; j++)
char_array_4[j] = 0;
for (j = 0; j <4; j++)
char_array_4[j] = base64_chars.find(char_array_4[j]);
char_array_3[0] = (char_array_4[0] << 2) + ((char_array_4[1] & 0x30) >> 4);
char_array_3[1] = ((char_array_4[1] & 0xf) << 4) + ((char_array_4[2] & 0x3c) >> 2);
char_array_3[2] = ((char_array_4[2] & 0x3) << 6) + char_array_4[3];
for (j = 0; (j < i - 1); j++) ret += char_array_3[j];
}
return ret;
}
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 2935 2014-05-28 14:38 baidu_voice_reco\baidu_voice\ba
文件 452 2014-05-29 10:51 baidu_voice_reco\baidu_voice\ba
文件 331776 2017-09-08 18:02 baidu_voice_reco\baidu_voice\curl\bin\curl.exe
文件 3001856 2017-09-07 16:43 baidu_voice_reco\baidu_voice\curl\bin\libcrypto-1_1-x64.dll
文件 416768 2017-09-08 18:02 baidu_voice_reco\baidu_voice\curl\bin\libcurl.dll
文件 219136 2016-11-02 16:37 baidu_voice_reco\baidu_voice\curl\bin\libssh2.dll
文件 516608 2017-09-07 16:44 baidu_voice_reco\baidu_voice\curl\bin\libssl-1_1-x64.dll
文件 96860 2017-08-08 00:42 baidu_voice_reco\baidu_voice\curl\include\curl\curl.h
文件 3034 2017-08-14 08:04 baidu_voice_reco\baidu_voice\curl\include\curl\curlver.h
文件 3473 2017-08-08 00:42 baidu_voice_reco\baidu_voice\curl\include\curl\easy.h
文件 2071 2017-08-08 00:42 baidu_voice_reco\baidu_voice\curl\include\curl\mprintf.h
文件 16094 2017-08-08 00:42 baidu_voice_reco\baidu_voice\curl\include\curl\multi.h
文件 1329 2017-08-08 00:42 baidu_voice_reco\baidu_voice\curl\include\curl\stdcheaders.h
文件 20711 2017-08-13 18:10 baidu_voice_reco\baidu_voice\curl\include\curl\system.h
文件 42101 2017-08-08 00:42 baidu_voice_reco\baidu_voice\curl\include\curl\typecheck-gcc.h
文件 8255 2017-09-08 18:02 baidu_voice_reco\baidu_voice\curl\lib\libcurl.exp
文件 14074 2017-09-08 18:02 baidu_voice_reco\baidu_voice\curl\lib\libcurl.lib
文件 11346 2017-07-26 17:40 baidu_voice_reco\baidu_voice\json\json-forwards.h
文件 71025 2017-08-09 18:53 baidu_voice_reco\baidu_voice\json\json.h
文件 11608 2017-09-08 18:45 baidu_voice_reco\baidu_voice\json-cpp\json\json-forwards.h
文件 71793 2017-09-08 20:20 baidu_voice_reco\baidu_voice\json-cpp\json\json.h
文件 157809 2017-09-08 20:03 baidu_voice_reco\baidu_voice\json-cpp\jsoncpp.cpp
文件 156887 2017-08-09 18:53 baidu_voice_reco\baidu_voice\jsoncpp.cpp
文件 7280 2017-09-09 12:46 baidu_voice_reco\baidu_voice\sample.cpp
文件 1443 2017-09-09 13:22 baidu_voice_reco\baidu_voice_reco.sln
文件 6360 2017-09-09 13:26 baidu_voice_reco\baidu_voice_reco.vcxproj
文件 1173 2017-09-08 19:52 baidu_voice_reco\baidu_voice_reco.vcxproj.filters
文件 375 2017-09-09 13:26 baidu_voice_reco\baidu_voice_reco.vcxproj.user
文件 52512 2014-06-06 18:51 baidu_voice_reco\test.pcm
目录 0 2017-09-09 13:20 baidu_voice_reco\baidu_voice\curl\include\curl
............此处省略13个文件信息
相关资源
- VisualStudioUninstaller vs卸载工具
- 组态王驱动开发包3.0.0.7(中文)
- 多窗口后台鼠标连点器
- 使用选择性重传协议实现UDP可靠通信
- VC 获得文件属性 获取文件的创建时
- 读者写者问题(读者优先,写者优先
- 用VC 编写的仿QQ聊天室程序源代码
- 外点法程序
- 外罚函数程序
- qt-电子点菜系统
- 推箱子及人工智能寻路C 源代码
- 自己写的航空订票系统c 版--数据结构
- 数据结构实验魔王语言
- MUSIC算法c 实现
- C 餐厅叫号系统(QT平)
- 国际象棋c 完整版
-
ob
jectARX给Auto CAD加工具条 - 画图程序MFC/VC/VC CRectTracker 串行化
- MFC网络编程实例
- c 课程设计 职工信息管理系统
- VC 游戏编程—附源代码
- IpHlpApi.h&IpHlpApi.lib
- 清华大学 c 郑莉 ppt课件
- c 程序判断离散数学中命题公式
- 多项式求和(数据结构C 版)
- vc 6.0开发的流程图编辑器
- VC 天空盒(skyBox)实现(附源代码)
- c MFC 画多边形
- 用C 实现的对网络上的ARP数据包进行
- Microsoft基本类库 (MFC)(C 库)
评论
共有 条评论