find_harm.m

来自「采用MELP编制的压缩与解码程序」· M 代码 · 共 26 行

M
26
字号
%Find harmonics of the base frequency
%Input:
%        res(residual signal of the quantized LPC)
%        p3(final pitch)
%Output:
%        mag(fourier spectrum magnitude)

function mag=find_harm(res,p3)
down=fix(256/p3);                %floor level of the base frequency
M=fix(p3/4);                     %Get the number of the harmonics
if M<10
   for n=1:M
      up=fix((n+0.5)*512/p3);
      mag(n)=max(res(down:up));
      down=up+1;
   end
   mag=mag*sqrt(M)/norm(mag);
   mag(M+1:10)=1;  
else
   for n=1:10
      up=fix((n+0.5)*512/p3);
      mag(n)=max(res(down:up));
      down=up+1;
   end
   mag=mag*sqrt(10)/norm(mag);
end

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?