资源简介
百度语音识别Android SDK版本的demo, 语音语义的使用都有完整的demo
代码片段和文件信息
package com.baidu.android.voicedemo;
import com.baidu.voicerecognition.android.Candidate;
import com.baidu.voicerecognition.android.VoiceRecognitionClient;
import com.baidu.voicerecognition.android.VoiceRecognitionClient.VoiceClientStatusChangeListener;
import com.baidu.voicerecognition.android.VoiceRecognitionConfig;
import android.os.Handler;
import android.support.v4.app.FragmentActivity;
import android.widget.EditText;
import android.widget.Toast;
import java.util.List;
/**
* 使用底层API方式识别Demo,开发者可以定义UI交互
*
* @author yangliang02
*/
public class ApiDemoActivity extends FragmentActivity {
private ControlPanelFragment mControlPanel;
private VoiceRecognitionClient mASREngine;
/** 正在识别中 */
private boolean isRecognition = false;
/** 音量更新间隔 */
private static final int POWER_UPDATE_INTERVAL = 100;
/** 识别回调接口 */
private MyVoiceRecogListener mListener = new MyVoiceRecogListener();
/** 主线程Handler */
private Handler mHandler;
/**
* 结果展示
*/
private EditText mResult = null;
/**
* 音量更新任务
*/
private Runnable mUpdateVolume = new Runnable() {
public void run() {
if (isRecognition) {
long vol = mASREngine.getCurrentDBLevelMeter();
mControlPanel.volumeChange((int) vol);
mHandler.removeCallbacks(mUpdateVolume);
mHandler.postDelayed(mUpdateVolume POWER_UPDATE_INTERVAL);
}
}
};
protected void onCreate(android.os.Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.api_demo_activity);
mResult = (EditText) findViewById(R.id.recognition_text);
mASREngine = VoiceRecognitionClient.getInstance(this);
mASREngine.setTokenApis(Constants.API_KEY Constants.SECRET_KEY);
mHandler = new Handler();
mControlPanel = (ControlPanelFragment) (getSupportFragmentManager()
.findFragmentById(R.id.control_panel));
mControlPanel.setOnEventListener(new ControlPanelFragment.OnEventListener() {
@Override
public boolean onstopListening() {
mASREngine.speakFinish();
return true;
}
@Override
public boolean onstartListening() {
mResult.setText(null);
VoiceRecognitionConfig config = new VoiceRecognitionConfig();
config.setProp(Config.CURRENT_PROP);
config.setLanguage(Config.getCurrentLanguage());
config.enableVoicePower(Config.SHOW_VOL); // 音量反馈。
if (Config.PLAY_START_SOUND) {
config.enableBeginSoundEffect(R.raw.bdspeech_recognition_start); // 设置识别开始提示音
}
if (Config.PLAY_END_SOUND) {
config.enableEndSoundEffect(R.raw.bdspeech_speech_end); // 设置识别结束提示音
}
config.setSampleRate(VoiceRecognitionConf
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 9549 2014-05-07 17:58 Baidu-Voice-SDK-Android-1.4.1\doc\allclasses-fr
文件 8469 2014-05-07 17:58 Baidu-Voice-SDK-Android-1.4.1\doc\allclasses-nofr
文件 12293 2014-05-07 17:58 Baidu-Voice-SDK-Android-1.4.1\doc\com\baidu\voicerecognition\android\BufferThreadRecorder.html
文件 11643 2014-05-07 17:58 Baidu-Voice-SDK-Android-1.4.1\doc\com\baidu\voicerecognition\android\Candidate.html
文件 4541 2014-05-07 17:58 Baidu-Voice-SDK-Android-1.4.1\doc\com\baidu\voicerecognition\android\class-use\BufferThreadRecorder.html
文件 4420 2014-05-07 17:58 Baidu-Voice-SDK-Android-1.4.1\doc\com\baidu\voicerecognition\android\class-use\Candidate.html
文件 4387 2014-05-07 17:58 Baidu-Voice-SDK-Android-1.4.1\doc\com\baidu\voicerecognition\android\class-use\Config.html
文件 4420 2014-05-07 17:58 Baidu-Voice-SDK-Android-1.4.1\doc\com\baidu\voicerecognition\android\class-use\CsvWriter.html
文件 4497 2014-05-07 17:58 Baidu-Voice-SDK-Android-1.4.1\doc\com\baidu\voicerecognition\android\class-use\ExternalRecorder.html
文件 6753 2014-05-07 17:58 Baidu-Voice-SDK-Android-1.4.1\doc\com\baidu\voicerecognition\android\class-use\LocationSyncManager.html
文件 4464 2014-05-07 17:58 Baidu-Voice-SDK-Android-1.4.1\doc\com\baidu\voicerecognition\android\class-use\MockPcmRecord.html
文件 11234 2014-05-07 17:58 Baidu-Voice-SDK-Android-1.4.1\doc\com\baidu\voicerecognition\android\class-use\NoProGuard.html
文件 6700 2014-05-07 17:58 Baidu-Voice-SDK-Android-1.4.1\doc\com\baidu\voicerecognition\android\class-use\ResourceParameters.html
文件 6470 2014-05-07 17:58 Baidu-Voice-SDK-Android-1.4.1\doc\com\baidu\voicerecognition\android\class-use\ThreadRecorder.html
文件 6642 2014-05-07 17:58 Baidu-Voice-SDK-Android-1.4.1\doc\com\baidu\voicerecognition\android\class-use\TokenManager.html
文件 4398 2014-05-07 17:58 Baidu-Voice-SDK-Android-1.4.1\doc\com\baidu\voicerecognition\android\class-use\Utility.html
文件 6660 2014-05-07 17:58 Baidu-Voice-SDK-Android-1.4.1\doc\com\baidu\voicerecognition\android\class-use\VoiceDataStorage.html
文件 8026 2014-05-07 17:58 Baidu-Voice-SDK-Android-1.4.1\doc\com\baidu\voicerecognition\android\class-use\VoiceRecognitionClient.html
文件 7940 2014-05-07 17:58 Baidu-Voice-SDK-Android-1.4.1\doc\com\baidu\voicerecognition\android\class-use\VoiceRecognitionClient.VoiceClientStatusChangeListener.html
文件 7401 2014-05-07 17:58 Baidu-Voice-SDK-Android-1.4.1\doc\com\baidu\voicerecognition\android\class-use\VoiceRecognitionConfig.html
文件 15728 2014-05-07 17:58 Baidu-Voice-SDK-Android-1.4.1\doc\com\baidu\voicerecognition\android\Config.html
文件 12554 2014-05-07 17:58 Baidu-Voice-SDK-Android-1.4.1\doc\com\baidu\voicerecognition\android\CsvWriter.html
文件 13177 2014-05-07 17:58 Baidu-Voice-SDK-Android-1.4.1\doc\com\baidu\voicerecognition\android\ExternalRecorder.html
文件 9082 2014-05-07 17:58 Baidu-Voice-SDK-Android-1.4.1\doc\com\baidu\voicerecognition\android\LocationSyncManager.html
文件 12616 2014-05-07 17:58 Baidu-Voice-SDK-Android-1.4.1\doc\com\baidu\voicerecognition\android\MockPcmRecord.html
文件 6967 2014-05-07 17:58 Baidu-Voice-SDK-Android-1.4.1\doc\com\baidu\voicerecognition\android\NoProGuard.html
文件 3026 2014-05-07 17:58 Baidu-Voice-SDK-Android-1.4.1\doc\com\baidu\voicerecognition\android\package-fr
文件 10506 2014-05-07 17:58 Baidu-Voice-SDK-Android-1.4.1\doc\com\baidu\voicerecognition\android\package-summary.html
文件 9030 2014-05-07 17:58 Baidu-Voice-SDK-Android-1.4.1\doc\com\baidu\voicerecognition\android\package-tree.html
文件 8954 2014-05-07 17:58 Baidu-Voice-SDK-Android-1.4.1\doc\com\baidu\voicerecognition\android\package-use.html
............此处省略332个文件信息
- 上一篇:jsp高校科研项目管理系统.rar
- 下一篇:java调用海康sdk案例
相关资源
- 农业物联网 温室大棚监控系统 客户端
- haxm-windows_v7_2_0android-sdk安装需要
- Android蓝牙设备之间通过UUID通信
- 超高仿今日头条 新闻客户端 最终版
- Android 通知栏Notification的全面整合学习
- android 高仿 频道管理----网易、今日头
- android 仿 新闻阅读器 菜单弹出效果
- 高仿今日头条 网易 源码
- android sdk platform-tools(26.0.2)
- Android实现免责声明页
- 基于Android系统调音器的研究和实现
- Android音乐播放器 原码
- Android High Performance Programming 安卓高性
- 基于Android的P2P手机高清视频在线点播
- QQ、微信自动接听辅助工具 Android
- ANDROID小说阅读软件源代码
- Android课程设计--财务统计
- Android云笔记
- 面向Android的移动支付
- Android平台的移动互联网开发
- Android 自定义view-仿新浪微博#话题#插
- Android应用源码(精)仿博客园客户端
- 基于zip4j开源框架实现android解压带有
- creator实现调用android相机相册,并实现
- android微信支付(代码请完整带走)保
- Android 7.0+抓包https突破ssl-pinning方案抓
- Android 数据抓取实现歌曲在线搜索
- Android旋转专辑图片—仿留声机效果
- Android 2D游戏引擎AndEngine快速入门教程
- eclipse --- Android拍照,相册选择图片以
评论
共有 条评论