MFCC matlab code

%function ccc=mfcc(x)   

%归一化mel滤波器组系数   

filename=input(‘input filename:‘,‘s‘);

[x,fs,bits]=wavread(filename);

bank=melbankm(24,256,fs,0,0.5,‘m‘);   

bank=full(bank);   

bank=bank/max(bank(:));   

?T系数,12*24   

for k=1:12   

    n=0:23;   

    dctcoef(k,:)=cos((2*n+1)*k*pi/(2*24));   

end   

%归一化倒谱提升窗口   

w=1+6*sin(pi*[1:12] ./12);   

w=w/max(w);   

%预加重滤波器   

xx=double(x);   

xx=filter([1 -0.9375],1,xx);   

%语音信号分帧   

xx=enframe(xx,256,80);   

%计算每帧的MFCC参数   

for i=1:size(xx,1)   

    y=xx(i,:)   

    s=y‘ .*hamming(256);   

    t=abs(fft(s));   

    t=t.^2;   

    c1=dctcoef*log(bank*t(1:129));   

    c2=c1.*w‘;   

    m(i,:)=c2‘;   

end   

%差分参数   

dtm=zeros(size(m));   

for i=3:size(m,1)-2   

    dtm(i,:)=-2*m(i-2,:)-m(i-1,:)+m(i+1,:)+2*m(i+2,:);   

end   

dtm=dtm/3;   

%合并mfcc参数和一阶差分mfcc参数   

ccc=[m dtm];   

%去除首位两帧,因为这两帧的一阶差分参数为0   

ccc=ccc(3:size(m,1)-2,:);

subplot(211)

ccc_1=ccc(:,1);

plot(ccc_1);title(‘MFCC‘);

% ylabel(‘幅值‘);

% title(‘一维数组及其幅值的关系‘)

% [h,w]=size(ccc);

% A=size(ccc);

% subplot(212)

% plot([1,w],A);

% xlabel(‘维数‘);

% ylabel(‘幅值‘);

% title(‘维数于幅值的关系‘)

return
时间: 2024-08-08 13:59:29

MFCC matlab code的相关文章

支持向量机的smo算法(MATLAB code)

建立smo.m % function [alpha,bias] = smo(X, y, C, tol) function model = smo(X, y, C, tol) % SMO: SMO algorithm for SVM % %Implementation of the Sequential Minimal Optimization (SMO) %training algorithm for Vapnik's Support Vector Machine (SVM) % % This

[工具]Loop subdivision algorithm+matlab code

引言:分析Loop subdivision algorithm的原理及代码实现.该算法可以用在对3D网格的细分上.同时,在形状检索领域,经常需要选取视点(viewpoint)来对模型进行绘制(render),例如,在zhouhui lian的CM-BOF方法中,对正八面体进行细化分解得到均匀的视点分布. 关于原理,有一些中文博客,但是讲的不是太详细,对照代码可能可以看的更清楚. 直接上代码吧.中文注释是我注释的,代码是在mathwork上看到的. function [newVertices, n

求平均排序MATLAB code

A0=R(:,1:2:end); for i=1:17 A1=A0(i,:); p=sort(unique(A1)); for j=1:length(p) Rank0(A1==p(j))=j; end Rank(i,:)=Rank0; end RD5=mean(Rank);

word linkage 选择合适的聚类个数matlab code

clear load fisheriris X = meas; m = size(X,2); % load machine % load census % % X = meas; % X=X(1:2000,:); d = pdist(X,'euclidean'); Z = linkage(d,'ward');%Create a hierarchical binary cluster tree using linkage % [Hr,Tr]=dendrogram(Z, 0); %generates

sequential minimal optimization,SMO for SVM, (MATLAB code)

function model = SMOforSVM(X, y, C ) %sequential minimal optimization,SMO tol = 0.001; maxIters = 3000; global i1 i2 K Alpha M1 m1 w b [m, n] = size(X); K = (X*X'); Alpha = zeros(m,1); w = 0; b = 0; flag =1;iters = 1; while flag >0 & iters < max

梅尔频率倒谱系数(MFCC) 学习笔记

最近学习音乐自动标注的过程中,看到了有关使用MFCC提取音频特征的内容,特地在网上找到资料,学习了一下相关内容.此笔记大部分内容摘自博文 http://blog.csdn.net/zouxy09/article/details/9156785 有小部分标注和批改时我自己加上的,以便今后查阅. 语音信号处理之(四)梅尔频率倒谱系数(MFCC) [email protected] http://blog.csdn.net/zouxy09 在任意一个Automatic speech recogniti

MATLAB抠图

http://blog.sina.com.cn/s/blog_5dd2e9270100xdcp.html 代码不能运行,不知道咋回事 poison matting matlab code 注:显示图像后,单击鼠标左键连出完全背景区域,双击左键结束: 图像改变后,再单击鼠标左键连出完全前景区域,双击左键结束.即可得到结果. A=imread('ppmm2.bmp'); imshow(A); hold on; Threshold = 1; UniBack=[0 0 255]; % choose ba

Matlab编程基础

平台:Win7 64 bit,Matlab R2014a(8.3) "Matlab"是"Matrix Laboratory" 的缩写,中文"矩阵实验室",是强大的数学工具.本文侧重于Matlab的编程语言侧面,讲述Matlab的基本语法,以及用Matlab语言进行程序设计.值得一提的是,Matlab从R2014a版本开始支持中文语言了! 1.基本概念 Matlab默认启动后界面: Matlab有关的文件后缀: File Extension Des

Matlab tips and tricks

matlab tips and tricks and ... page overview: I created this page as a vectorization helper but it grew to become my annotated Matlab reading cache. In order to motivate the DSP people out there, I am showing below how one can apply a window and scal