📄 readwav.m
字号:
function [c_c, c_u, c_c_min,c_c_max,c_u_min,c_u_max] =readwav(filename)
%$Id: readwav.m,v 1.1.1.1 2000/10/16 09:30:40 mattb Exp $
%===========================================================================
% Matt Bowers - University of Bath
%
% Copyright (c) 1996
%===========================================================================
%
% Read in wavelet file
%
% Arguements:
% filename full path to .wav file, including .wav extension
%
% Returns:
% c_c 'cc' coefficients
% c_u 'cu' coefficients
% c_c_min }
% c_c_max } these are the min and max filter tap numbers for c_c and c_u
% c_u_min }
% c_u_max }
%
%===========================================================================
file_ID=openfile(filename,'r'); % Open file
c_c_min = fscanf(file_ID,'%d',1); % Read number of cc taps
c_c_max = fscanf(file_ID,'%d',1);
for i=1:(c_c_max - c_c_min+1) % Read cc taps
c_c(i)=[fscanf(file_ID,['%lf' 10],1)];
end
c_u_min = fscanf(file_ID,'%d',1); % Read number of cu taps
c_u_max = fscanf(file_ID,'%d',1);
for i=1:(c_u_max - c_u_min+1) % Read cu taps
c_u(i)=[fscanf(file_ID,['%lf' 10],1)];
end
shutfile(file_ID); % Close file
cclen = c_c_max-c_c_min+1;
culen = c_u_max-c_u_min+1;
if mod(cclen,2)==1
%odd length
if mod(culen,2)==0
error('Odd length analysis filter with even length synthesis filter')
end
diff=abs(culen-cclen);
if mod(diff-2,4)~=0
error('For odd lengths, lengths must differ by 2 + 4k')
end
else
% even length
if mod(culen,2)==1
error('Even length analysis filter with odd length synthesis filter')
end
diff=abs(culen-cclen);
if mod(diff,4)~=0
error('For even lengths, lengths must differ by a multiple of 4')
end
end
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -