导航:首页 > 操作系统 > android音频识别

android音频识别

发布时间:2024-07-06 04:41:38

① 怎样轻松实现语音识别在android开发中

语音识别 2008年Google语音搜索在iphone平台上线,Android 1.5 将语音识别应用到搜索功能上。 手动输入是目前主要与手机互动的方式,语音搜索宗旨是最大限度地改善人机交互的便捷性。 在玩游戏时,通过语音来控制操作,更显得人性化,体验更佳。 Android 中主要通过RecognizerIntent来实现语音识别。 RecognizerIntent包括的常量 ACTION_RECOGNIZE_SPEECH ACTION_WEB_SEARCH EXTRA_LANGUAGE EXTRA_LANGUAGE_MODEL EXTRA_MAX_RESULTS EXTRA_PROMPT EXTRA_RESULTS LANGUAGE_MODEL_FREE_FORM LANGUAGE_MODEL_WEB_SEARCH RESULT_AUDIO_ERROR RESULT_CLIENT_ERROR RESULT_NETWORK_ERROR RESULT_NO_MATCH RESULT_SERVER_ERROR // 打开语音识别 Intent intent = new Intent(RecognizerIntent.ACTION_RECOGNIZE_SPEECH); intent.putExtra(RecognizerIntent.EXTRA_LANGUAGE_MODEL, RecognizerIntent.LANGUAGE_MODEL_FREE_FORM); intent.putExtra(RecognizerIntent.EXTRA_PROMPT, “开始语音"); startActivityForResult(intent, VOICE_RECOGNITION_REQUEST_CODE); 在模拟器上找不到语音设备,会抛出异常ActivityNotFoundException。 示例: 点击“开始使用语音识别”按钮后,开始语音输入,然后在onActivityResult方法中取得结果并显示出来 protect void onActivityResult(int requestCode, int resultCode, Intent data) { if(requestCode == VOICE_RECOGNITION_REQUEST_CODE && resultCode == RESULT_OK) { ArrayList<String> results = data.getStringArrayListExtra(RecognizerIntent.EXTRA_RESULTS); StringBuffer sb = new StringBuffer(); for(int i=0; i<results.size; i++) { sb.append(results.get(i)); } Toast.makeText(this, sb.toString(), Toast.LENGTH_LONG).show(); super.onActivityResult(requestCode, resultCode, data); }

② Android 上的语音识别是怎么实现

语音识别,借助于云端技术可以识别用户的语音输入,包括语音控制等技术,下面我们将利用Google 提供的Api 实现这一功能。
功能点为:通过用户语音将用户输入的语音识别出来,并打印在列表上。
功能界面如下:

步骤阅读
2
用户通过点击speak按钮显示界面:
步骤阅读
3
用户说完话后,将提交到云端搜索
步骤阅读
4
在云端搜索完成后,返回打印数据:
步骤阅读

5
* Copyright (C) 2008 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a of the License at
*

*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package com.example.android.apis.app;

import com.example.android.apis.R;

import android.app.Activity;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.content.pm.ResolveInfo;
import android.os.Bundle;
import android.speech.RecognizerIntent;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.ListView;

import java.util.ArrayList;
import java.util.List;

/**
* Sample code that invokes the speech recognition intent API.
*/
public class VoiceRecognition extends Activity implements OnClickListener {

private static final int VOICE_RECOGNITION_REQUEST_CODE = 1234;

private ListView mList;

/**
* Called with the activity is first created.
*/
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);

// Inflate our UI from its XML layout description.
setContentView(R.layout.voice_recognition);

// Get display items for later interaction
Button speakButton = (Button) findViewById(R.id.btn_speak);

mList = (ListView) findViewById(R.id.list);

// Check to see if a recognition activity is present
PackageManager pm = getPackageManager();
List activities = pm.queryIntentActivities(
new Intent(RecognizerIntent.ACTION_RECOGNIZE_SPEECH), 0);
if (activities.size() != 0) {
speakButton.setOnClickListener(this);
} else {
speakButton.setEnabled(false);
speakButton.setText("Recognizer not present");
}
}

/**
* Handle the click on the start recognition button.
*/
public void onClick(View v) {
if (v.getId() == R.id.btn_speak) {
startVoiceRecognitionActivity();
}
}

/**
* Fire an intent to start the speech recognition activity.
*/
private void startVoiceRecognitionActivity() {
Intent intent = new Intent(RecognizerIntent.ACTION_RECOGNIZE_SPEECH);
intent.putExtra(RecognizerIntent.EXTRA_LANGUAGE_MODEL,
RecognizerIntent.LANGUAGE_MODEL_FREE_FORM);
intent.putExtra(RecognizerIntent.EXTRA_PROMPT, "Speech recognition demo");
startActivityForResult(intent, VOICE_RECOGNITION_REQUEST_CODE);
}

/**
* Handle the results from the recognition activity.
*/
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
if (requestCode == VOICE_RECOGNITION_REQUEST_CODE && resultCode == RESULT_OK) {
// Fill the list view with the strings the recognizer thought it could have heard
ArrayList matches = data.getStringArrayListExtra(
RecognizerIntent.EXTRA_RESULTS);
mList.setAdapter(new ArrayAdapter(this, android.R.layout.simple_list_item_1,
matches));
}

super.onActivityResult(requestCode, resultCode, data);
}

③ 苹果的siri软件和安卓的语音识别功能有何区别

苹果的siri软件和安卓的语音识别功能主要有以下区别:
1.语音识别输入——Android实时听写,Siri格式与标点齐全
Android和Siri在进行语音识别输入时都出错颇多,但这也情有可原——毕竟考虑到口音、话筒距离和环境噪音等因素,能做到这样已经实属不易。
最新版Android在进行最基本的语音识别输入时无需连接至互联网历物,而且可以在用户讲话过程中实时显示文字;相比之下,Siri只能在用户停止讲话后一口气“写”出来。
但是Siri可以很好地“听懂”大写、全部大写、无空格等格式,以及冒号、破折号、星号、省略号等各种标点;而Android只能理解句号、逗号、惊叹号等基本标点符号。
2.命令控制——Siri更胜一筹
用语音命令对手机进行控制的优势,主要在于安全和方便。而Siri在命令控制方面比Android更胜一筹,例如:在开车时听到有新信息进来,你只需说一句“读我的新信息”,Siri就能为你朗读信息内容,甚至能邀请你通过语音识别输入回复信息,这样你就完全不用将视线从路面上移开——这样的功能,Android还无法做到。
3.网络信息搜索——Android更强大,Siri擅长提供餐馆和电影信息
同样的问题,Android给出答案的速度比Siri快得多,而且尤其擅长与地点和导航相关的问题,以及回答连续问题。
此外,Android还内置了类似Shazam的音乐识别功能——也就是说,点击语音识别图标并让Android手机听一轿庆首歌,它就迅速找出相应的歌名和歌手。
但是,Siri对餐馆和电影信息更在行——它能通过与订餐网站OpenTable的整合直接进行语音订餐,而且能漂亮地回答很多与电影相关的具体问题等等。
4.使用便利性——Android有硬伤
要想在Android手机上使用语音功能,就得点一下谷歌搜索栏里的闭烂握麦克风图标,而且它只出现在主屏幕或Google Now屏幕上,因此在手机处于休眠状态或者正在使用其他应用时无法使用。
但是在iPhone上,长按Home键或者耳机线上的一个装置,就能随时开启语音功能。
5.人性化程度——Siri有,Android无
Siri比Android更具“人情味”,有时还会跟你讲讲俏皮话。

④ android 百度怎么使用语音识别转化成文字

网络Android语音识别SDK分在线与离线两种,这篇文章介绍在线SDK的使用方法。
在线SDK是以JAR包和动态链接库形式发布和使用,可以从网络开放云平台网站中下载SDK及使用说明文档。
http://developer..com/wiki/index.php?title=docs/cplat/media/voice
完成语音SDK的集成分以下几步,本文将一步步介绍SDK集成方法。

1、注册开放开放平台
点击管理控制台,选择移动应用管理

阅读全文

与android音频识别相关的资料

热点内容
app里面的广告是怎么来的 浏览:885
四川扶贫app怎么登录 浏览:543
我的电脑如何变成服务器 浏览:958
解压球炸开的瞬间 浏览:738
app原生页面怎么画 浏览:550
心经全文pdf 浏览:837
文件如何转换成pdf格式 浏览:431
安卓手机如何打开sep文件 浏览:247
苹果app购买之后怎么退款 浏览:983
工控app与设备怎么连接 浏览:774
下载管理加密了怎么打开 浏览:945
react按需编译慢 浏览:314
影视猎手app怎么缓存 浏览:950
阿里网盘pc自动更新文件夹 浏览:211
苹果7配置相当于安卓什么 浏览:542
怎么下载全军出击app 浏览:879
网吧服务器上装什么 浏览:182
手机里面的文件夹怎么解压 浏览:690
python公里转换 浏览:247
linux命令行全屏模式 浏览:520