Android 如何开发语音识别应用程序,如talking tom

Android 如何开发语音识别应用程序,如talking tom,android,android-layout,manifest,voice,Android,Android Layout,Manifest,Voice,如何开发语音识别应用程序,如Talking Tom? 1.我的要求是如何在没有任何事件(如按钮、触摸事件)的情况下识别语音) 2.所有语音记录示例都包含“通过”按钮,但我的要求是,当用户在录制语音时识别语音,当用户停止语音时,它会自动修改其他语音(如Tom或parrot)中的语音 3.我已按完按钮 My.java File storageDir = new File(Environment.getExternalStorageDirectory(), "SRAVANTHI"); storageD

如何开发语音识别应用程序,如Talking Tom?
1.我的要求是如何在没有任何事件(如按钮、触摸事件)的情况下识别语音)
2.所有语音记录示例都包含“通过”按钮,但我的要求是,当用户在录制语音时识别语音,当用户停止语音时,它会自动修改其他语音(如Tom或parrot)中的语音
3.我已按完按钮

My.java

File storageDir = new File(Environment.getExternalStorageDirectory(), "SRAVANTHI");
storageDir.mkdir();
Log.d(APP_TAG, "Storage directory set to " + storageDir);
outfile = File.createTempFile("hascode", ".3gp", storageDir);

// init recorder
recorder.setAudioSource(MediaRecorder.AudioSource.MIC);
recorder.setOutputFormat(MediaRecorder.OutputFormat.THREE_GPP);
recorder.setAudioEncoder(MediaRecorder.AudioEncoder.AMR_NB);
recorder.setOutputFile(outfile.getAbsolutePath());

// init player
player.setDataSource(outfile.getAbsolutePath());

try {
    recorder.prepare();
    recorder.start();
    recording = true;
} catch (IllegalStateException e) {
    Log.w(APP_TAG, "Invalid recorder state .. reset/release should have been called");
} catch (IOException e) {
    Log.w(APP_TAG, "Could not write to sd card");
}

recorder.stop();
播放按钮

try {
    playing = true;
    player.prepare();
    player.start();
} catch (IllegalStateException e) {
    Log.w(APP_TAG, "illegal state .. player should be reset");
} catch (IOException e) {
    Log.w(APP_TAG, "Could not write to sd card");
}

先检查音量,超过一定值后再录音,怎么样

也许这会有用: