Android 在安卓系统中,当用户停止说话后,如何自动停止录音?
我是android新手,正在尝试构建一个语音到文本的android应用程序。我正在学习教程 当我点击麦克风按钮时,它开始录音,但只在20秒后停止,不像现在谷歌那样停止。我怎样才能做到这一点 录音部分是:Android 在安卓系统中,当用户停止说话后,如何自动停止录音?,android,speech-to-text,avspeechsynthesizer,Android,Speech To Text,Avspeechsynthesizer,我是android新手,正在尝试构建一个语音到文本的android应用程序。我正在学习教程 当我点击麦克风按钮时,它开始录音,但只在20秒后停止,不像现在谷歌那样停止。我怎样才能做到这一点 录音部分是: private void promptSpeechInput() { Intent intent = new Intent(RecognizerIntent.ACTION_RECOGNIZE_SPEECH); intent.putExtra(RecognizerIntent.EXTRA_
private void promptSpeechInput() {
Intent intent = new Intent(RecognizerIntent.ACTION_RECOGNIZE_SPEECH);
intent.putExtra(RecognizerIntent.EXTRA_LANGUAGE_MODEL,
RecognizerIntent.LANGUAGE_MODEL_FREE_FORM);
intent.putExtra(RecognizerIntent.EXTRA_LANGUAGE, Locale.getDefault());
intent.putExtra(RecognizerIntent.EXTRA_PROMPT,
getString(R.string.speech_prompt));
try {
startActivityForResult(intent, REQ_CODE_SPEECH_INPUT);
} catch (ActivityNotFoundException a) {
Toast.makeText(getApplicationContext(),
getString(R.string.speech_not_supported),
Toast.LENGTH_SHORT).show();
}
}
尝试将
EXTRA\u SPEECH\u INPUT\u COMPLETE\u SILENCE\u LENGTH\u MILLIS
添加到意图中。这表示需要多少毫秒的静默时间才能使其假定输入已完成