资源简介
百度语音识别通过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个文件信息
相关资源
- openGL实现三维点云显示
- Qt之纯QML实现视频播放器源码
- Bonjour SDK for Windows
- 基于winpcap的网络数据采集器的实现
- 空间向量模型源代码
- 关于求线段和线段,线段和圆弧,圆
- PCL点云库SACSegmentation用法demo
- cocos2dx经典三消游戏
- 《深入理解计算机系统》随书代码
- glut库glew库glfw库glaux库
- 人脸识别系统设计-毕业设计
- ACM大学生程序设计竞赛在线题库精选
- VS2017专业版下载265391
- OpenSSL-win64库使用依赖文件
- 西门子数控系统二次开发
- 多用户多级目录文件系统的实现
- devcpp4990setup
- 俄罗斯方块 SDL 版
- 基于Win socket简单实现一个FTP协议的客
- qt下的modbus Tcp通讯程序
- p2p 的简单实现 上传文件
- 数据结构实验课(全部题目+完整代码
- 哈夫曼树实现图片压缩与解压
- 车辆保险管理系统
- 算法导论第三版英文原版
- CTP接口及开发文档.zip
- 百度语音识别node服务器版demo
- VxWorks及Tornado集成开发环境的使用
- 炫彩界面库帮助文档chm-v2.5.0
- vc实用教程第三版+郑阿奇
评论
共有 条评论