资源简介
google code mfcc c语言实现。MIT 开源协议。语音识别可用。

代码片段和文件信息
/*
* libmfcc.c - Code implementation for libMFCC
* Copyright (c) 2010 Jeremy Sawruk
*
* This code is released under the MIT License.
* For conditions of distribution and use see the license in LICENSE
*/
#include
#include “libmfcc.h“
/*
* Computes the specified (mth) MFCC
*
* spectralData - array of doubles containing the results of FFT computation. This data is already assumed to be purely real
* samplingRate - the rate that the original time-series data was sampled at (i.e 44100)
* NumFilters - the number of filters to use in the computation. Recommended value = 48
* binSize - the size of the spectralData array usually a power of 2
* m - The mth MFCC coefficient to compute
*
*/
double GetCoefficient(double* spectralData unsigned int samplingRate unsigned int NumFilters unsigned int binSize unsigned int m)
{
double result = 0.0f;
double outerSum = 0.0f;
double innerSum = 0.0f;
unsigned int k l;
// 0 <= m < L
if(m >= NumFilters)
{
// This represents an error condition - the specified coefficient is greater than or equal to the number of filters. The behavior in this case is undefined.
return 0.0f;
}
result = NormalizationFactor(NumFilters m);
for(l = 1; l <= NumFilters; l++)
{
// Compute inner sum
innerSum = 0.0f;
for(k = 0; k < binSize - 1; k++)
{
innerSum += fabs(spectralData[k] * GetFilterParameter(samplingRate binSize k l));
}
if(innerSum > 0.0f)
{
innerSum = log(innerSum); // The log of 0 is undefined so don‘t use it
}
innerSum = innerSum * cos(((m * PI) / NumFilters) * (l - 0.5f));
outerSum += innerSum;
}
result *= outerSum;
return result;
}
/*
* Computes the Normalization Factor (Equation 6)
* Used for internal computation only - not to be called directly
*/
double NormalizationFactor(int NumFilters int m)
{
double normalizationFactor = 0.0f;
if(m == 0)
{
normalizationFactor = sqrt(1.0f / NumFilters);
}
else
{
normalizationFactor = sqrt(2.0f / NumFilters);
}
return normalizationFactor;
}
/*
* Compute the filter parameter for the specified frequency and filter bands (Eq. 2)
* Used for internal computation only - not the be called directly
*/
double GetFilterParameter(unsigned int samplingRate unsigned int binSize unsigned int frequencyBand unsigned int filterBand)
{
double filterParameter = 0.0f;
double boundary = (frequencyBand * samplingRate) / binSize; // k * Fs / N
double prevCenterFrequency = GetCenterFrequency(filterBand - 1); // fc(l - 1) etc.
double thisCenterFrequency = GetCenterFrequency(filterBand);
double nextCenterFrequency = GetCenterFrequency(filterBand + 1);
if(boundary >= 0 && boundary < prevCenterFrequency)
{
filterParameter = 0.0f;
}
else if(boundary >= prevCenterFrequency && boundary < thisCenterFrequency)
{
filterParameter = (boundary - prevCenterFrequency) / (thisCenterFrequency -
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
目录 0 2016-03-18 22:14 libmfcc\
文件 214692 2016-03-18 22:14 libmfcc\Sturm2010b.pdf
文件 1240 2016-03-18 22:14 libmfcc\libmfcc.h
文件 283 2016-03-18 22:14 libmfcc\TODO
目录 0 2016-03-18 22:14 libmfcc\libmfcc_example\
文件 1376 2016-03-18 22:14 libmfcc\libmfcc_example\example.c
文件 82062 2016-03-18 22:14 libmfcc\libmfcc_example\sample.dat
文件 4705 2016-03-18 22:14 libmfcc\libmfcc.c
目录 0 2016-03-18 22:14 libmfcc\.hg\
文件 0 2016-03-18 22:14 libmfcc\.hg\undo.dirstate
目录 0 2016-03-18 22:14 libmfcc\.hg\cache\
文件 44 2016-03-18 22:14 libmfcc\.hg\cache\tags
文件 92 2016-03-18 22:14 libmfcc\.hg\cache\branchheads
文件 276 2016-03-18 22:14 libmfcc\.hg\dirstate
文件 8 2016-03-18 22:14 libmfcc\.hg\branch
文件 42 2016-03-18 22:14 libmfcc\.hg\undo.desc
目录 0 2016-03-18 22:14 libmfcc\.hg\store\
文件 186 2016-03-18 22:14 libmfcc\.hg\store\fncache
目录 0 2016-03-18 22:14 libmfcc\.hg\store\data\
文件 64 2016-03-18 22:14 libmfcc\.hg\store\data\_sturm2010b.pdf.i
目录 0 2016-03-18 22:14 libmfcc\.hg\store\data\libmfcc__example\
文件 32456 2016-03-18 22:14 libmfcc\.hg\store\data\libmfcc__example\sample.dat.i
文件 770 2016-03-18 22:14 libmfcc\.hg\store\data\libmfcc__example\example.c.i
文件 501 2016-03-18 22:14 libmfcc\.hg\store\data\_r_e_a_d_m_e.i
文件 197952 2016-03-18 22:14 libmfcc\.hg\store\data\_sturm2010b.pdf.d
文件 570 2016-03-18 22:14 libmfcc\.hg\store\data\libmfcc.h.i
文件 714 2016-03-18 22:14 libmfcc\.hg\store\data\_l_i_c_e_n_s_e.i
文件 262 2016-03-18 22:14 libmfcc\.hg\store\data\_t_o_d_o.i
文件 1512 2016-03-18 22:14 libmfcc\.hg\store\data\libmfcc.c.i
文件 0 2016-03-18 22:14 libmfcc\.hg\store\undo.phaseroots
文件 0 2016-03-18 22:14 libmfcc\.hg\store\phaseroots
............此处省略10个文件信息
- 上一篇:c语言实现通讯录C语言代码
- 下一篇:C语言计算器带括号、小数计算
相关资源
- 操作系统c语言模拟文件管理系统844
- C语言开发实战宝典
- C++中头文件与源文件的作用详解
- C语言代码高亮html输出工具
- 猜数字游戏 c语言代码
- C语言课程设计
- 数字电位器C语言程序
- CCS FFT c语言算法
- 使用C语言编写的病房管理系统
- 通信过程中的RS编译码程序(c语言)
- 计算机二级C语言上机填空,改错,编
- 用回溯法解决八皇后问题C语言实现
- 简易教务管理系统c语言开发文档
- 操作系统课设 读写者问题 c语言实现
- 小波变换算法 c语言版
- C流程图生成器,用C语言代码 生成C语
- 3des加密算法C语言实现
- 简单的C语言点对点聊天程序
- 单片机c语言源程序(51定时器 八个按
- 个人日常财务管理系统(C语言)
- c语言电子商务系统
- 小甲鱼C语言课件 源代码
- 将图片转换为C语言数组的程序
- C语言实现的一个内存泄漏检测程序
- DES加密算法C语言实现
- LINUX下命令行界面的C语言细胞游戏
- 用单片机控制蜂鸣器播放旋律程序(
- 学校超市选址问题(数据结构C语言版
- 电子时钟 有C语言程序,PROTEUS仿真图
- 尚观培训linux许巍老师关于c语言的课
评论
共有 条评论