【发布时间】:2012-06-09 22:40:27
【问题描述】:
我正在开发一个应用程序,它将记录用户的声音并将文件保存在 SD 卡上,然后允许用户再次收听音频。
我能够允许用户使用 RecognizerIntent 录制他的声音,但我不知道如何保存音频文件并允许用户听到音频。如果有人可以帮助我,我将不胜感激。我在下面显示了我的代码:
// Setting up the onClickListener for Audio Button
attachVoice = (Button) findViewById(R.id.AttachVoice_questionandanswer);
attachVoice.setOnClickListener(new OnClickListener() {
public void onClick(View v) {
Intent voiceIntent = new Intent(RecognizerIntent.ACTION_RECOGNIZE_SPEECH);
voiceIntent.putExtra(RecognizerIntent.EXTRA_LANGUAGE_MODEL, RecognizerIntent.LANGUAGE_MODEL_FREE_FORM);
voiceIntent.putExtra(RecognizerIntent.EXTRA_PROMPT, "Please Speak");
startActivityForResult(voiceIntent, VOICE_REQUEST);
}
});
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
if(requestCode == VOICE_REQUEST && resultCode == RESULT_OK){
}
【问题讨论】:
-
你想录语音还是使用识别api?
-
我要录音。使用 RecognizerIntent 是不可能的吗?
-
不可能的识别器意图是文本到语音识别
-
这完全是另一个功能
-
不要重复提问!你昨天在stackoverflow.com/questions/10900697/…问的问题基本相同
标签: android android-intent android-mediaplayer voice-recognition android-audiomanager