资源简介
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语言计算器带括号、小数计算
- c语言实现通讯录C语言代码
- c语言版学生成绩管理系统实验报告
- 单片机C语言,Proteus仿真,多功能闹钟
- 计算机操作系统实验报告,C语言实现
- 表达式求值(C语言栈实现)
- 学生成绩管理系统C语言
- c语言实现的大数四则运算程序
- 学生学分综合管理系统
- c语言运动会分数统计
- svd分解的C语言实现
- c语言课程设计学生选课系统
- 简易秒表时钟的设计含C语言及proteu
- C语言DFT计算
- 大作业C语言的五子棋全套
- c语言编写的置换密码源代码
- 最小RTSP服务器,C语言代码
- 用链表实现多项式加减法运算
- 郁闷的出纳员(c语言)
- 音频编码pcm的c语言实现
- aes密钥扩展C语言实现
- 运动会分数统计系统 c语言
- c语言课程设计_实验设备管理系统
- C语言 实现离散数学真值表
- C语言电梯的模拟运行课程设计实验报
- 斗地主课程设计 c语言版
- Koch曲线C语言
- 连连看游戏C语言代码
- C语言程序设计报告——虚拟示波器
- 拉格朗日插值、分段线性插值、三次
评论
共有 条评论