⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 setpitchpar.m

📁 ITU-T G.723.1 Speech Coder: Matlab implementation This package implements the speech coder and de
💻 M
字号:
function Pitchpar = SetPitchpar (Pitchpar)% Pitch parameters% PMin: Minimum pitch lag% PMax: Maximum pitch lag% PMode: Pitch mode for each subframe; 0 is relative to open%    loop pitch; 1 is relative to previous closed loop pitch% CBookThr: Pitch lag threshold for choosing gain codebooks.%    Lag values less than or equal to the threshold use codebook%    0, other lag values use codebook 1.% LOffs: Pitch offsets for different modes% b: Pitch coefficient vectors (two codebooks)% Tamepar: Pitch taming parameters% $Id: SetPitchpar.m 1.6 2004/08/06 G.723.1-v2r1a $NCBook = length (Pitchpar.b);for (i = 1:NCBook)  if (ischar (Pitchpar.b{i}))    Pitchpar.b{i} = load (Pitchpar.b{i});  endendNc = size (Pitchpar.b{1}, 1);% Lag offsets for the pitch coefficientsif (~ isfield (Pitchpar, 'POffs'))  RefOffs = fix ((Nc - 1) / 2);  Pitchpar.POffs = (-RefOffs):(Nc - 1 - RefOffs);end% Excitation memory lengthNPMode = max (Pitchpar.PMode);LMem = 0;for (i = 1:NPMode)  if (i == 1)    LMem = max (LMem, Pitchpar.PMax(i) + Pitchpar.POffs(end));  else    JMax = max (Pitchpar.LOffs{i});        LMem = max (LMem, Pitchpar.PMax(i) + JMax + Pitchpar.POffs(end));  endend% Pitch taming parametersif (isfield (Pitchpar, 'Tamepar'))  Tamepar = Pitchpar.Tamepar;  if (~ isfield (Tamepar, 'ISub'))    Tamepar.ISub = 30;  end  if (~ isfield (Tamepar, 'NE'))    Tamepar.NE = floor (LMem / Tamepar.ISub) + 1;  end  if (~ isfield (Tamepar, 'Nx'))    Tamepar.Nx = repmat (inf, 1, NCBook);  end  for (i = 1:NCBook)    if (ischar (Tamepar.g{i}))      Tamepar.g{i} = load (Tamepar.g{i});    elseif (isempty (Tamepar.g{i}))      Nq = size (Pitchpar.b{i}, 2);      for (j = 1:Nq)        Tamepar.g{i}(j) = abs (sum (abs (Pitchpar.b{i}(:,j))));      end    end  end  Tamepar.E = zeros (Tamepar.NE, 1);  Pitchpar.Tamepar = Tamepar;endreturn

⌨️ 快捷键说明

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