android - 如何开发像会说话的汤姆猫一样的语音识别应用

标签 android android-layout manifest voice

如何开发像会说话的汤姆猫这样的语音识别应用?
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");
}

最佳答案

如何先检查音量,超过一定值才录音?

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

关于android - 如何开发像会说话的汤姆猫一样的语音识别应用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11357862/

相关文章:

android - 如何从图像数据集创建模型并在 Chainer 中使用它?

java - 使用 arraylist 和 foreach 时如何避免内存泄漏?

android - 带有水平滚动的自定义 View

android - 如何为电视设置任何布局(宽度、高度)?

java - JRE 不使用可运行 jar 的 list 文件指定的类路径

xml - 在 Windows Phone 商店上传应用程序时出错

android - ionic Cordova 文件上传错误 : Not allowed to load local resource

android:广播接收器的优先级值首先在我的应用程序中获取短信

android - 我如何设计新地方 AutocompleteSupportFragment

Android - 如何避免在多个 list 文件中重复?