这是一个用于语音信号处理的工具箱
源代码在线查看: fun_warp.m
function y=func_warp1(seg_frame, seg_range, range, orig_map)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% jmw
%
% 6/14/94
%
% Maps desired map to length of segment
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
N = seg_range(2) - seg_range(1) + 1; % length of segment in samples
warp_map = [];
warp_map = zeros(1,N);
for i=1:N,
new_index = ceil((100*i)/N );
warp_map(i) = orig_map(new_index);
end;
% scale amplitudes
max_warp_map = max(warp_map);
warp_map = (1/max_warp_map) * warp_map;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
NF = seg_frame(2) - seg_frame(1) + 1; % number of frames
y=zeros(1,NF);
for i=seg_frame(1):seg_frame(2),
a=range(i,1);
b=range(i,2);
mean_ab = round(0.5 * (a+b));
z=round(mean_ab-range(seg_frame(1),1));
y(i-seg_frame(1)+1) = warp_map(z);
end;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%return;