如何开发语音识别像会说话的tom应用 [英] How to develop voice recognizing app like talking tom
问题描述
如何开发语音识别像会说话的汤姆应用程序吗?
1,我的要求是如何识别声音没有像按钮的任何事件,触摸事件)
2.所有录音样本含有通过按钮,但我的要求是确认的声音在上一次使用的用户通话记录的声音,当用户停止的声音,它会自动修改的声音在其他一些声音就像汤姆或鹦鹉
3.我已经通过按钮来完成
我的.java
文件storageDir =新的文件(Environment.getExternalStorageDirectory(),SRAVANTHI);
storageDir.mkdir();
Log.d(APP_TAG,存储目录设置为+ storageDir);
OUTFILE = File.createTempFile(有code,名为.3gp,storageDir);
//初始化记录
recorder.setAudioSource(MediaRecorder.AudioSource.MIC);
recorder.setOutputFormat(MediaRecorder.OutputFormat.THREE_GPP);
recorder.setAudioEn codeR(MediaRecorder.AudioEn coder.AMR_NB);
recorder.setOutputFile(outfile.getAbsolutePath());
//初始化播放器
player.setDataSource(outfile.getAbsolutePath());
尝试 {
。录音机prepare();
recorder.start();
记录= TRUE;
}赶上(IllegalStateException异常E){
Log.w(APP_TAG,无效的记录状态..复位/释放应该被称为);
}赶上(IOException异常E){
Log.w(APP_TAG,无法写入SD卡);
}
recorder.stop();
对于播放按钮
尝试{
播放= TRUE;
播放器prepare()。
player.start();
}赶上(IllegalStateException异常E){
Log.w(APP_TAG,非法状态......球员应该被重置);
}赶上(IOException异常E){
Log.w(APP_TAG,无法写入SD卡);
}
那么先检查音量,录音后,才超过一定值?
也许这将是有益的: 机器人:检测音量
How to develop voice recognizing app like Talking Tom?
1. My request is how to recognize the voice without any events like buttons, touch events)
2. All voice recording sample containing through button, but my requirement is recognizing voice when user talk on that time recording voice and when user stop voice it automatically modify the voice in some other voice like Tom or parrot
3. I have done through button
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();
for play button
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");
}
What about checking sound volume first, recording only after it is over certain value?
Maybe this will be usefull: android: Detect sound level
这篇关于如何开发语音识别像会说话的tom应用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!