求java中文语音识别例子 我在坛子里搜索了,没有找到合适的,还请各位朋友们帮帮忙。我要实现的目的是通过麦克接收用户语音指令,执行相应指令。对于语速,方言等最好有比较好的兼容性。谢谢。分不是问题,问题也不是没分,所以,帮帮忙吧,哥们有的是分。谢谢 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 楼主试试这个!希望对你有帮助...package CSDN;import java.io.*;import javax.sound.sampled.AudioSystem;import javax.sound.sampled.AudioInputStream;import javax.sound.sampled.AudioFormat;import javax.sound.sampled.SourceDataLine;import javax.sound.sampled.DataLine;import javax.sound.sampled.FloatControl;import javax.sound.sampled.TargetDataLine;public class RecordAndPlay { volatile int divider; public RecordAndPlay(){ Play(); } public static void main(String[] args) { new RecordAndPlay(); } //播放音频文件 public void Play() { try { AudioFormat audioFormat =// new AudioFormat(AudioFormat.Encoding.PCM_SIGNED, 44100F,// 8, 1, 1, 44100F, false); new AudioFormat(AudioFormat.Encoding.PCM_SIGNED,44100F, 16, 2, 4, 44100F, true); DataLine.Info info = new DataLine.Info(TargetDataLine.class, audioFormat); TargetDataLine targetDataLine = (TargetDataLine) AudioSystem.getLine(info); targetDataLine.open(audioFormat); SourceDataLine sourceDataLine; info = new DataLine.Info(SourceDataLine.class, audioFormat); sourceDataLine = (SourceDataLine) AudioSystem.getLine(info); sourceDataLine.open(audioFormat); targetDataLine.start(); sourceDataLine.start(); FloatControl fc=(FloatControl)sourceDataLine.getControl(FloatControl.Type.MASTER_GAIN); double value=0.2; float dB = (float)(Math.log(value==0.0?0.0001:value)/Math.log(10.0)*20.0); fc.setValue(dB); int nByte = 0; final int bufSize=1024; byte[] buffer = new byte[bufSize]; while (nByte != -1) { //System.in.read(); nByte = targetDataLine.read(buffer, 0, bufSize); sourceDataLine.write(buffer, 0, nByte); } sourceDataLine.stop(); } catch (Exception e) { e.printStackTrace(); } }} 好像IBM有提供一些开发包的,可以在网上查查看 我知道ibm有过语音识别的软件,这样的东西不会免费的...... 关注一下,看看csdn有没牛人。话说这个不好做啊。语音识别,文字识别,图像识别类似之类的东西做好了都会很值钱的。 急需哪位帮我修改一下我的Java code 求一匹配页面标签的正则表达式 不声明类也可以? 用javamail接收邮件的错误,大家看看。 用什么工具运行图形界面的程序? 如何在JAVA中对ORACLE数据库的BLOB形的数据库字段进行修改????(高手请看)!!!!!!! JSP和XML差不多吗? java 的ClassPath问题 请问各位大侠jbuilder中页面转换问题 jb 中popup menu 如何使用?? jdk1.6 怎样学习源代码 java、xml与SQL数据库综合应用
import javax.sound.sampled.AudioSystem;
import javax.sound.sampled.AudioInputStream;
import javax.sound.sampled.AudioFormat;
import javax.sound.sampled.SourceDataLine;
import javax.sound.sampled.DataLine;
import javax.sound.sampled.FloatControl;
import javax.sound.sampled.TargetDataLine;
public class RecordAndPlay {
volatile int divider;
public RecordAndPlay(){
Play();
}
public static void main(String[] args) {
new RecordAndPlay();
}
//播放音频文件
public void Play() { try {
AudioFormat audioFormat =
// new AudioFormat(AudioFormat.Encoding.PCM_SIGNED, 44100F,
// 8, 1, 1, 44100F, false);
new AudioFormat(AudioFormat.Encoding.PCM_SIGNED,44100F, 16, 2, 4,
44100F, true);
DataLine.Info info = new DataLine.Info(TargetDataLine.class,
audioFormat);
TargetDataLine targetDataLine = (TargetDataLine) AudioSystem.getLine(info);
targetDataLine.open(audioFormat);
SourceDataLine sourceDataLine;
info = new DataLine.Info(SourceDataLine.class, audioFormat);
sourceDataLine = (SourceDataLine) AudioSystem.getLine(info);
sourceDataLine.open(audioFormat);
targetDataLine.start();
sourceDataLine.start();
FloatControl fc=(FloatControl)sourceDataLine.getControl(FloatControl.Type.MASTER_GAIN);
double value=0.2;
float dB = (float)(Math.log(value==0.0?0.0001:value)/Math.log(10.0)*20.0);
fc.setValue(dB);
int nByte = 0;
final int bufSize=1024;
byte[] buffer = new byte[bufSize];
while (nByte != -1) {
//System.in.read();
nByte = targetDataLine.read(buffer, 0, bufSize);
sourceDataLine.write(buffer, 0, nByte);
}
sourceDataLine.stop(); } catch (Exception e) {
e.printStackTrace();
}
}
}
话说这个不好做啊。语音识别,文字识别,图像识别类似之类的东西做好了都会很值钱的。