導航:首頁 > 操作系統 > 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音頻識別相關的資料

熱點內容
重生伺服器是什麼 瀏覽:287
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