资源简介
语音识别中的MFCC参数提取的java源码和FFT的java源码

代码片段和文件信息
public final class FFT {
public int logm;
final int MAXLOGM = 20; /* max FFT length 2^MAXLOGM */
final double TWOPI = 6.28318530717958647692;
final double SQHALF = 0.707106781186547524401;
int brseed[] = new int[4048];
float tab[][];
public FFT(int nlength) {
double dtemp = Math.log(nlength) / Math.log(2);
if ((dtemp - (int) dtemp) != 0.0) {
throw new Error(“FFT length must be a power of 2.“);
} else {
this.logm = (int) dtemp;
}
if (logm >= 4) {
creattab(logm);
}
}
/**
* Calculates the magnitude spectrum of a real signal. The returned vector
* contains only the positive frequencies.
*/
public float[] calculateFFTMagnitude(float x[]) {
int i n;
n = 1 << this.logm;
if (x.length > n) {
throw new Error(“Tried to use a “ + n
+ “-points FFT for a vector with “ + x.length + “ samples!“);
}
rsfft(x);
float[] mag = new float[n / 2 + 1];
mag[0] = x[0]; // DC frequency must be positive always
if (n == 1) {
return mag;
}
mag[n / 2] = (float) Math.abs(x[n / 2]); // pi (meaning: fs / 2)
// System.out.println(“FFT before magnitude“);
// IO.DisplayVector(x);
for (i = 1; i < n / 2; i++) {
mag[i] = (float) Math.sqrt(x[i] * x[i] + x[n - i] * x[n - i]);
// System.out.println(mag[i] + “ “ + x[i] + “ “ + x[n-i]);
}
// IO.DisplayVector(mag);
return mag;
}
/**
* Calculates the magnitude spectrum of a real signal. The returned vector
* contains only the positive frequencies.
*/
public double[] calculateFFTMagnitude(double inputData[]) {
int i n;
n = 1 << this.logm;
if (inputData.length > n) {
throw new Error(“Tried to use a “ + n
+ “-points FFT for a vector with “ + inputData.length
+ “ samples!“);
}
// System.out.println(“magnitude test“);
// double[] dtest = DSP.DFTMagnitude(inputData);
// IO.DisplayVector(dtest);
float[] x = new float[n];
for (i = 0; i < inputData.length; i++) {
x[i] = (float) inputData[i];
}
rsfft(x);
// System.out.println(“FFT before magnitude“);
// IO.DisplayVector(x);
double[] mag = new double[n / 2 + 1];
mag[0] = x[0]; // DC frequency must be positive always
if (n == 1) {
return mag;
}
mag[n / 2] = Math.abs(x[n / 2]); // pi (meaning: fs / 2)
for (i = 1; i < n / 2; i++) {
mag[i] = Math.sqrt(x[i] * x[i] + x[n - i] * x[n - i]);
// System.out.println(mag[i] + “ “ + x[i] + “ “ + x[n-i]);
}
// IO.DisplayVector(mag);
return mag;
}
/**
* Calculates the power (magnitude squared) spectrum of a real signal. The
* returned vector contains only the positive frequencies.
*/
public double[] calculateFFTPower(double inputData[]) {
int i n;
n = 1 << this.logm;
// System.out.println(“magnitude test“);
// double[] dtest = DSP.DFTMagnitude(inputData);
// IO.DisplayVector(dtest);
float[] x = new float[n];
for (i = 0; i < inputData.length; i++) {
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 17791 2012-03-08 19:25 MFCC.java
文件 20160 2012-03-08 19:26 FFT.java
----------- --------- ---------- ----- ----
37951 2
相关资源
- Windows bat 设置Java环境变量
- java 毕业设计 进销存管理系统 源码
- java图片浏览器跨平台运行程序与源码
- 基于java的在线考试系统-毕业设计
- 微博系统(Java源码,servlet+jsp),适
- java串口通信全套完整代码-导入eclip
- jsonarray所必需的6个jar包.rar
- 三角网构TIN生成算法,Java语言实现
- java代码编写将excel数据导入到mysql数据
- Java写的cmm词法分析器源代码及javacc学
- JAVA JSP公司财务管理系统 源代码 论文
- JSP+MYSQL旅行社管理信息系统
- 推荐算法的JAVA实现
- 基于Java的酒店管理系统源码(毕业设
- java-图片识别 图片比较
- android毕业设计
- java23种设计模式+23个实例demo
- java Socket发送/接受报文
- JAVA828436
- java界面美化 提供多套皮肤直接使用
- 在线聊天系统(java代码)
- 基于Java的图书管理系统807185
- java中实现将页面数据导入Excel中
- java 企业销售管理系统
- java做的聊天系统(包括正规课程设计
- Java编写的qq聊天室
- 商店商品管理系统 JAVA写的 有界面
- JAVA开发聊天室程序
- 在linux系统下用java执行系统命令实例
- java期末考试试题两套(答案) 选择(
评论
共有 条评论