我正在开发一个基于语音识别的Android应用程序.
直到今天,一切都工作得很好并且及时,例如,我会开始我的语音识别器,说话,并且在最多1或2秒内,应用程序收到结果.
这是一个非常可接受的用户体验.
那么今天我现在必须等待十秒或更长时间才能获得识别结果.
我尝试过设置以下EXTRAS,其中没有一个会产生任何明显的区别
RecognizerIntent.EXTRA_SPEECH_INPUT_POSSIBLY_COMPLETE_SILENCE_LENGTH_MILLIS
RecognizerIntent.EXTRA_SPEECH_INPUT_COMPLETE_SILENCE_LENGTH_MILLIS
RecognizerIntent.EXTRA_SPEECH_INPUT_MINIMUM_LENGTH_MILLIS
Run Code Online (Sandbox Code Playgroud)
我一直在不断更改我的应用程序,但这些更改都与语音识别器无关.
我可以采用任何方法来缩短语音识别器切换onBeginningOfSpeech()
到的时间onResults()
吗?
这是一个需要多长时间的例子
07-01 17:50:20.839 24877-24877/com.voice I/Voice: onReadyForSpeech()
07-01 17:50:21.614 24877-24877/com.voice I/Voice: onBeginningOfSpeech()
07-01 17:50:38.163 24877-24877/com.voice I/Voice: onEndOfSpeech()
Run Code Online (Sandbox Code Playgroud) android speech-recognition voice-recognition google-voice-search
我正在尝试让Google即时接受自定义命令,并在进行特定查询时将Intent发送到我的应用.
我使用Tasker和Autovoice成功完成了这项工作,但我想在不使用这些应用程序的情况下做同样的事情.
我找到了这个文档的链接.我在哪里可以处理不能完成任务的常见意图.
我也尝试过谷歌提供的语音交互API,这几乎是一回事,但这并没有帮助.
有没有人在这里实现这一点,而不使用其他应用程序,如Commander,Autovoice或Tasker?
我想在我的应用程序中引入一项新功能:永久语音识别.
首先,我关注了这些帖子:
以及更多其他人,以及来自不同网站的其他帖子.
问题: 我真正要做的是在没有显示谷歌语音活动的情况下进行永久语音识别.例如:当我启动应用程序时,语音识别应该开始并收听.当识别器匹配某些单词时,我的应用程序将相应地执行不同的操作.我不想每次想要进行语音识别时都按下按钮,而且我也不喜欢在屏幕上出现任何与之交谈的内容.我能这样做吗?
欢迎任何建议.谢谢!:)
android speech-recognition voice-recognition google-voice google-voice-search
在大多数Android设备中,RecognitionService将由Google的原生"现在/助理"应用程序提供.
在Android Oreo之前,我能够使用以下简单代码查询Google Recognizer支持的语言:
final Intent vrIntent = new Intent(RecognizerIntent.ACTION_GET_LANGUAGE_DETAILS);
// vrIntent.setPackage("com.google.android.googlequicksearchbox");
getContext().sendOrderedBroadcast(vrIntent, null, new BroadcastReceiver() {
@Override
public void onReceive(final Context context, final Intent intent) {
// final Bundle bundle = intent.getExtras();
final Bundle bundle = getResultExtras(true);
if (bundle != null) {
if (bundle.containsKey(RecognizerIntent.EXTRA_SUPPORTED_LANGUAGES)) {
Log.i("TAG", "onReceive: EXTRA_SUPPORTED_LANGUAGES present");
final ArrayList<String> vrStringLocales = bundle.getStringArrayList(
RecognizerIntent.EXTRA_SUPPORTED_LANGUAGES);
Log.i("TAG", "onReceive: EXTRA_SUPPORTED_LANGUAGES size: " + vrStringLocales.size());
} else {
Log.w("TAG", "onReceive: missing EXTRA_SUPPORTED_LANGUAGES");
}
} else {
Log.w("TAG", "onReceive: Bundle null"); …
Run Code Online (Sandbox Code Playgroud) java android speech-recognition voice-recognition google-voice-search
我对谷歌离线语音识别进行了研究.但它在谷歌nexus 5(操作系统:-4.4)工作正常,但如果我在三星galaxy s5(操作系统:-5.0)实现相同的构建,它无法识别,它显示此错误:
8- ERROR_RECOGNIZER_BUSY.
以下是我的代码.通过保持此链接作为参考,我做了一些更改http://www.truiton.com/2014/06/android-speech-recognition-without-dialog-custom-activity/
没有互联网语音必须承认.我曾经在Pocket sphinx上工作,但它需要大量的侧面声音,因此客户拒绝了它.
public class VoiceRecognitionActivity extends Activity implements RecognitionListener {
private TextView returnedText;
private static ProgressBar progressBar;
private static SpeechRecognizer speech = null;
private static Intent recognizerIntent;
private String LOG_TAG = "VoiceRecognitionActivity";
private Button button1;
Activity activity = VoiceRecognitionActivity.this;
private TextView textView2;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
returnedText = (TextView) findViewById(R.id.textView1);
textView2 = (TextView) findViewById(R.id.textView2);
progressBar = (ProgressBar) findViewById(R.id.progressBar1);
button1 = (Button) findViewById(R.id.button1);
getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
// toggleButton = (ToggleButton) findViewById(R.id.toggleButton1);
PackageManager …
Run Code Online (Sandbox Code Playgroud) android speech-recognition speech-to-text android-intent google-voice-search
我有一个测试应用程序,它以连续的方式使用Google语音,并且每次调用Google识别服务时都会发出哔声.我试图摆脱哔哔声.我已经读过静音音乐流的线程,但这对我不起作用.
我试图找到蜂鸣声文件的位置,所以我可以去系统中删除它.我按照这个线程,但我在5.0系统文件中看不到该文件.
android speech-recognition voice-recognition android-speech-api google-voice-search
我正在尝试使用Google的Cloud Speech API.这里有文档和代码示例:
https://cloud.google.com/speech/docs/basics
https://cloud.google.com/speech/docs/rest-tutorial
Run Code Online (Sandbox Code Playgroud)
如果我将它指向包含的文件audio.raw,但是没有简短的.wav文件,我可以让示例代码运行得很好.
我不知道音频样本文件的格式是什么:
$ file audio.raw
audio.raw: data
Run Code Online (Sandbox Code Playgroud)
我的.wav文件可能有10秒的音频,我得到一个空的结果.
我知道这个答案.
我之前曾问过我的问题,但问题没有答案.
我无法想象我必须得到音频文件的属性恰到好处才能使其工作.我假设一个常见的用例,我的是,有人录制会议,不知道录制的参数,只是想要一个文本文件.
audio google-cloud-platform google-voice-search google-speech-api
我有一个基于Android的Epson Moverio设备,但默认情况下没有语音识别引擎.我已经成功安装了语音搜索应用程序,因此,我能够在我正在开发的应用程序中使用谷歌语音识别.现在,问题是我得到的应用程序版本有点陈旧(我认为它来自2011年,因为那是语音搜索应用程序的最后一次更新).还有其他应用程序类似于我可以安装的语音搜索,并允许我使用最新的谷歌语音识别引擎吗?
内容:
我正在尝试将Google语音操作集成到我的应用中。我已经看过并理解了(或至少是我的想法)google codelabs-io2015示例,在此示例中,如果您不修改代码,一切都会按预期工作。当您尝试使此示例适应实际用例时,问题就开始了。
问题:
所以,我的问题是我正在尝试实施搜索语音操作,但是Activity#isVoiceInteraction始终为false。我最终不了解该活动何时以及为何(以及何时未链接)到语音交互器。
研究:
查看Activity,Activity#isVoiceInteraction和Activity#getVoiceInteractor API级别23的源代码,发现以下内容:
/**
* Check whether this activity is running as part of a voice interaction with the user.
* If true, it should perform its interaction with the user through the
* {@link VoiceInteractor} returned by {@link #getVoiceInteractor}.
*/
public boolean isVoiceInteraction() {
return mVoiceInteractor != null;
}
Run Code Online (Sandbox Code Playgroud)
,
/**
* Retrieve …
Run Code Online (Sandbox Code Playgroud) android google-voice-search google-voice-actions voice-interaction
我正在使用此处定义的可搜索配置在我的活动中实现语音搜索。但是,如果设备的区域设置不同,设置android:voiceLanguage="tr"
似乎不起作用。搜索应用程序对话框将在设备的区域设置以及搜索结果中打开。我使用SearchView
,因此无法捕获该onSearchRequested
函数,否则我可以以编程方式指定参数。设备区域设置为俄语,因此搜索查询会以西里尔语返回。如何强制以土耳其语或至少英语区域设置返回搜索结果?
可搜索.xml
<?xml version="1.0" encoding="utf-8"?>
<searchable xmlns:android="http://schemas.android.com/apk/res/android"
android:label="@string/app_name"
android:voiceLanguage="tr"
android:voiceLanguageModel="web_search"
android:voiceSearchMode="showVoiceSearchButton|launchRecognizer" />
Run Code Online (Sandbox Code Playgroud)
搜索视图设置
@Override
public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.menu_main, menu);
SearchManager searchManager = (SearchManager) getSystemService(Context.SEARCH_SERVICE);
searchItem = menu.findItem(R.id.search);
searchView = (SearchView) MenuItemCompat.getActionView(searchItem);
searchView.setQueryHint(getString(R.string.search));
searchView.setOnQueryTextListener(new SearchWatcher());
if (searchManager != null)
searchView.setSearchableInfo(searchManager.getSearchableInfo(getComponentName()));
return true;
}
Run Code Online (Sandbox Code Playgroud)
处理搜索结果
@Override
protected void onNewIntent(Intent intent) {
setIntent(intent);
handleIntent(intent);
}
private void handleIntent(Intent intent) {
if (Intent.ACTION_SEARCH.equals(intent.getAction())) {
String query = intent.getStringExtra(SearchManager.QUERY);
searchView.setQuery(query, false);
}
}
Run Code Online (Sandbox Code Playgroud) 我终于将我的一个旧项目从 Eclipse/ADT 迁移到 Android Studio (2021.3.1.17)。
在此迁移过程中,我修复了许多由过时和已弃用的方法和关键字引起的问题,这些方法和关键字过去在 Android 2.2 (API 8) 上完美运行,并且在 Eclipse/ADT 上没有产生任何警告。
但现在,在 Android Studio 2021.3、目标 SDK 33 上,我在 AndroidManifest.xml 中收到此错误:
Class referenced in the manifest,
`com.google.android.voicesearch.DetailsReceiver`,
was not found in the project or the libraries
Run Code Online (Sandbox Code Playgroud)
我在谷歌上搜索了有关如何解决此问题的线索,但显然这DetailsReceiver
已经太旧了,实际上已经没有任何参考了。
Android Studio中如何消除这个错误?是否有我可以添加到模块中以使其消失的参考?
更新:过去包含此内容的软件包DetailsReceiver
可以从market://details?id=com.google.android.voicesearch
. 它不再存在于 Google Play 上。
如果您搜索 Google Play,com.google.android.voicesearch
您将获得以下与 Google LLC 相关的匹配项:
我很困惑。有很多候选人希望直接替换com.google.android.voicesearch
但对此不清楚的文档或信息。哪个可下载包取代了它?
我之所以强调“可下载”,是因为在开箱即用的 Google Pixel 4a(Android 11)上,查询时PackagManager …