function [x,mc,mn,mx]=melbankm(p,n,fs,fl,fh,w)
%MELBANKM determine matrix for a mel/erb/bark-spaced filterbank [X,MN,MX]=(P,N,FS,FL,FH,W)
%
% Inputs:
% p number of filters in filterbank or the filter spacing in k-mel/bark/erb [ceil(4.6*log10(fs))]
% n length of fft
% fs sample rate in Hz
% fl low end of the lowest filter as a fraction of fs [default = 0]
% fh high end of highest filter as a fraction of fs [default = 0.5]
% w any sensible combination of the following:
% 'b' = bark scale instead of mel
% 'e' = erb-rate scale
% 'l' = log10 Hz frequency scale
% 'f' = linear frequency scale
%
% 'c' = fl/fh specify centre of low and high filters
% 'h' = fl/fh are in Hz instead of fractions of fs
% 'H' = fl/fh are in mel/erb/bark/log10
%
% 't' = triangular shaped filters in mel/erb/bark domain (default)
% 'n' = hanning shaped filters in mel/erb/bark domain
% 'm' = hamming shaped filters in mel/erb/bark domain
%
% 'z' = highest and lowest filters taper down to zero [default]
% 'y' = lowest filter remains at 1 down to 0 frequency and
% highest filter remains at 1 up to nyquist freqency
%
% 'u' = scale filters to sum to unity
%
% 's' = single-sided: do not double filters to account for negative frequencies
%
% 'g' = plot idealized filters [default if no output arguments present]
%
% Note that the filter shape (triangular, hamming etc) is defined in the mel (or erb etc) domain.
% Some people instead define an asymmetric triangular filter in the frequency domain.
%
% If 'ty' or 'ny' is specified, the total power in the fft is preserved.
%
% Outputs: x a sparse matrix containing the filterbank amplitudes
% If the mn and mx outputs are given then size(x)=[p,mx-mn+1]
% otherwise size(x)=[p,1+floor(n/2)]
% Note that the peak filter values equal 2 to account for the power
% in the negative FFT frequencies.
% mc the filterbank centre frequencies in mel/erb/bark
% mn the lowest fft bin with a non-zero coefficient
% mx the highest fft bin with a non-zero coefficient
% Note: you must specify both or neither of mn and mx.
%
% Examples of use:
%
% (a) Calcuate the Mel-frequency Cepstral Coefficients
%
% f=rfft(s); % rfft() returns only 1+floor(n/2) coefficients
% x=melbankm(p,n,fs); % n is the fft length, p is the number of filters wanted
% z=log(x*abs(f).^2); % multiply x by the power spectrum
% c=dct(z); % take the DCT
%
% (b) Calcuate the Mel-frequency Cepstral Coefficients efficiently
%
% f=fft(s); % n is the fft length, p is the number of filters wanted
% [x,mc,na,nb]=melbankm(p,n,fs); % na:nb gives the fft bins that are needed
% z=log(x*(f(na:nb)).*conj(f(na:nb)));
%
% (c) Plot the calculated filterbanks
%
% plot((0:floor(n/2))*fs/n,melbankm(p,n,fs)') % fs=sample frequency
%
% (d) Plot the idealized filterbanks (without output sampling)
%
% melbankm(p,n,fs);
%
% References:
%
% [1] S. S. Stevens, J. Volkman, and E. B. Newman. A scale for the measurement
% of the psychological magnitude of pitch. J. Acoust Soc Amer, 8: 185�19, 1937.
% [2] S. Davis and P. Mermelstein. Comparison of parametric representations for
% monosyllabic word recognition in continuously spoken sentences.
% IEEE Trans Acoustics Speech and Signal Processing, 28 (4): 357�366, Aug. 1980.
% Copyright (C) Mike Brookes 1997-2009
% Version: $Id: melbankm.m,v 1.11 2010/01/02 20:02:22 dmb Exp $
%
% VOICEBOX is a MATLAB toolbox for speech processing.
% Home page: http://www.ee.ic.ac.uk/hp/staff/dmb/voicebox/voicebox.html
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% This program is free software; you can redistribute it and/or modify
% it under the terms of the GNU General Public License as published by
% the Free Software Foundation; either version 2 of the License, or
% (at your option) any later version.
%
% This program is distributed in the hope that it will be useful,
% but WITHOUT ANY WARRANTY; without even the implied warranty of
% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
% GNU General Public License for more details.
%
% You can obtain a copy of the GNU General Public License from
% http://www.gnu.org/copyleft/gpl.html or by writing to
% Free Software Foundation, Inc.,675 Mass Ave, Cambridge, MA 02139, USA.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Note "FFT bin_0" assumes DC = bin 0 whereas "FFT bin_1" means DC = bin 1
if nargin < 6
w='tz'; % default options
if nargin < 5
fh=0.5; % max freq is the nyquist
if nargin < 4
fl=0; % min freq is DC
end
end
end
sfact=2-any(w=='s'); % 1 if single sided else 2
wr=' '; % default warping is mel
for i=1:length(w)
if any(w(i)=='lebf');
wr=w(i);
end
end
if any(w=='h') || any(w=='H')
mflh=[fl fh];
else
mflh=[fl fh]*fs;
end
if ~any(w=='H')
switch wr
case 'f' % no transformation
case 'l'
if fl<=0
error('Low frequency limit must be >0 for l option');
end
mflh=log10(mflh); % convert frequency limits into log10 Hz
case 'e'
mflh=frq2erb(mflh); % convert frequency limits into erb-rate
case 'b'
mflh=frq2bark(mflh); % convert frequency limits into bark
otherwise
mflh=frq2mel(mflh); % convert frequency limits into mel
end
end
melrng=mflh*(-1:2:1)'; % mel range
fn2=floor(n/2); % bin index of highest positive frequency (Nyquist if n is even)
if isempty(p)
p=ceil(4.6*log10(fs)); % default number of filters
end
if any(w=='c') % c option: specify fiter centres not edges
if p<1
p=round(melrng/(p*1000))+1;
end
melinc=melrng/(p-1);
mflh=mflh+(-1:2:1)*melinc;
else
if p<1
p=round(melrng/(p*1000))-1;
end
melinc=melrng/(p+1);
end
%
% Calculate the FFT bins corresponding to [filter#1-low filter#1-mid filter#p-mid filter#p-high]
%
switch wr
case 'f'
blim=(mflh(1)+[0 1 p p+1]*melinc)*n/fs;
case 'l'
blim=10.^(mflh(1)+[0 1 p p+1]*melinc)*n/fs;
case 'e'
blim=erb2frq(mflh(1)+[0 1 p p+1]*melinc)*n/fs;
case 'b'
blim=bark2frq(mflh(1)+[0 1 p p+1]*melinc)*n/fs;
otherwise
blim=mel2frq(mflh(1)+[0 1 p p+1]*melinc)*n/fs;
end
mc=mflh(1)+(1:p)*melinc; % mel centre frequencies
b1=floor(blim(1))+1; % lowest FFT bin_0 required might be negative)
b4=min(fn2,ceil(blim(4))-1); % highest FFT bin_0 required
%
% now map all the useful FFT bins_0 to filter1 centres
%
switch wr
case 'f'
pf=((b1:b4)*fs/n-mflh(1))/melinc;
case 'l'
pf=(log10((b1:b4)*fs/n)-mflh(1))/melinc;
case 'e'
pf=(frq2erb((b1:b4)*fs/n)-mflh(1))/melinc;
case 'b'
pf=(frq2bark((b1:b4)*fs/n)-mflh(1))/melinc;
otherwise
pf=(frq2mel((b1:b4)*fs/n)-mflh(1))/melinc;
end
%
% remove any incorrect entries in pf due to rounding errors
%
if pf(1)<0
pf(1)=[];
b1=b1+1;
end
if pf(end)>=p+1
pf(end)=[];
b4=b4-1;
end
fp=floor(pf); % FFT bin_0 i contributes to filters_1 fp(1+i-b1)+[0 1]
pm=pf-fp; % multiplier for upper filter
k2=find(fp>0,1); % FFT bin_1 k2+b1 is the first to contribute to both upper and lower filters
k3=find(fp<p,1,'last'); % FFT bin_1 k3+b1 is the last to contribute to both upper and lower filters
k4=numel(fp); % FFT bin_1 k4+b1 is the last to contribute to any filters
if isempty(k2)
k2=k4+1;
end
if isempty(k3)
k3=0;
end
if any(w=='y') % preserve power in FFT
mn=1; % lowest
没有合适的资源?快使用搜索试试~ 我知道了~
温馨提示
语音信号处理实验教程MATLAB源代码,内含语音信号处理基础、语音信号分析、语音信号特征提取、语音降噪、语音编码、语音合成、语音隐藏、声源定位、语音识别、说话人识别、情感识别。 参考文献 [1]胡航.语音信号处理[M].第4版. 哈尔滨:哈尔滨工业大学出版社,2005 [2]陈杰.Matlab宝典[M].第2版.北京:电子工业出版社,2010 [3]高西全,丁玉美.数字信号处理[M].第3版. 西安:西安电子科技大学出版社,2008 [4]程佩青.数字信号处理教程[M].第3版.北京:清华大学出版社,2007 [5]苏金明,张莲花,刘波.Matlab工具箱应用[M].第1版.北京:电子工业出版社,2004 [6]刘卫国.MATLAB程序设计与应用[M].第2版.北京:高等教育出版社,2006 [7]董辰辉,彭雪峰.MATLAB2008全程指南[M].第1版.北京:电子工业出版社,2009 [8]王洪元.MATLAB语言及其在电子信息工程中的应用[M].第1版.北京:清华大学出版社,2004 [9]杨述斌,李永全.数字信号处理实践教程[M].第1版.武汉:华中科技大学出版社,2007
资源推荐
资源详情
资源评论
收起资源包目录
语音信号处理实验教程MATLAB源代码,内含语音信号处理基础、语音信号分析、基于Matlab的语音信号处理与仿真毕业论文 (673个子文件)
untitled.asv 10KB
C8_1_y.DAT 1KB
兰州商学院毕业论文-基于Matlab的语音信号处理与仿真.docx 259KB
房间声学模型.docx 162B
~$房间声学模型.docx 162B
~$1 语音端点检测实验.docx 162B
untitled.fig 2KB
F2W%P81FWW]@58NR`PZKI{2.jpg 83KB
melbankm.m 11KB
melbankm.m 11KB
untitled.m 10KB
melbankm.m 8KB
frq2bark.m 6KB
C7_4_y_2.m 5KB
C7_3_y_1.m 4KB
C7_4_y_1.m 4KB
svmclassfiction.m 4KB
melcepst.m 4KB
bark2frq.m 4KB
lpcauto.m 4KB
C7_2_y_2.m 4KB
featvector.m 4KB
my_vad.m 3KB
melcepst.m 3KB
pick_peak.m 3KB
melbankm2.m 3KB
featvector.m 3KB
gmm_init.m 3KB
KnnRecognition.m 3KB
enframe.m 3KB
enframe.m 3KB
smoothing.m 3KB
vad_TwoThr.m 3KB
lpcar2fm.m 3KB
erb2frq.m 3KB
frq2erb.m 3KB
C4_1_y_5.m 2KB
frq2mel.m 2KB
frq2mel.m 2KB
mel2frq.m 2KB
mel2frq.m 2KB
TestProgram.m 2KB
C9_3_y_1.m 2KB
GCC_Method.m 2KB
disteusq.m 2KB
vad_forw.m 2KB
Weina_Norm.m 2KB
vad_revr.m 2KB
kmeans1.m 2KB
Spectrum_Method.m 2KB
rdct.m 2KB
getparam.m 2KB
Weina_Im.m 2KB
C3_6_y_1.m 2KB
enframe.m 2KB
knn.m 2KB
C12_4_y.m 2KB
C3_2_y.m 2KB
rfft.m 2KB
rfft.m 2KB
rfft.m 2KB
C9_1_y_3.m 2KB
vad.m 2KB
C2_4_y_2.m 2KB
C2_3_y_1.m 2KB
C7_2_y_1.m 2KB
check_ter.m 2KB
SpectralSubIm.m 2KB
C4_1_y_1.m 2KB
pcm_encode.m 2KB
C4_1_y_4.m 2KB
lpctolsf.m 2KB
lpctolsf.m 2KB
C12_2_y.m 2KB
baum_welch.m 2KB
vad_pro.m 2KB
C4_1_y_3.m 2KB
C4_1_y_2.m 2KB
mfccf.m 2KB
bpnn.m 1KB
C5_2_y_2.m 1KB
matchTemplates.m 1KB
adpcm_encoder.m 1KB
C4_2_y_5.m 1KB
lpcar2pf.m 1KB
LMS.m 1KB
lpcar2pf.m 1KB
pitch_vad.m 1KB
pitch_vad.m 1KB
pitch_vad.m 1KB
pitch_vad.m 1KB
iso226.m 1KB
Formant_Root.m 1KB
C2_5_y_1.m 1KB
pitch_vad.m 1KB
lbg.m 1KB
C4_2_y_3.m 1KB
C5_3_y_1.m 1KB
C5_3_y_2.m 1KB
vad_specEn.m 1KB
共 673 条
- 1
- 2
- 3
- 4
- 5
- 6
- 7
资源评论
流华追梦
- 粉丝: 3635
- 资源: 2052
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功