如何开发像汤姆汤姆一样的语音识别应用程序

时间:2012-07-06 07:38:37

标签: android android-layout manifest voice

如何开发像Talking Tom这样的语音识别应用程序?     1.我的要求是如何在没有按钮,触摸事件等任何事件的情况下识别声音  2.所有录音样本都包含通过按钮,但我的要求是当用户说话时识别语音录制语音,当用户停止语音时,它会自动修改其他语音中的语音,如汤姆或鹦鹉
 3.我已完成按钮

我的.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");
}

1 个答案:

答案 0 :(得分:0)

如果首先检查音量,仅在超过一定值后进行录音呢?

也许这会有用: android: Detect sound level