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

📄 psola.m

📁 matlab code for discrete time signal processing overlay and a
💻 M
字号:
%psola.m
function out=psola(in,m,alpha,beta)
%     in    input signal
%     m     pitch marks (from PitchMarker.m function)
%     alpha time stretching factor
%     beta  pitch shifting factor

P = diff(m);   %compute pitch periods

if m(1)<=P(1), %remove first pitch mark
   m=m(2:length(m)); 
   P=P(2:length(P)); 
end

if m(length(m))+P(length(P))>length(in) %remove last pitch mark
    m=m(1:length(m)-1);
    else
    P=[P P(length(P))]; 
end

Lout=ceil(length(in)*alpha);   
out=zeros(1,Lout); %output signal

tk = P(1)+1;       %output pitch mark

while round(tk)<Lout
  [minimum i] = min( abs(alpha*m - tk) ); %find analysis segment
  pit=P(i); 
  st=m(i)-pit;
  en=m(i)+pit;
  gr = in(st:en) .* hanning(2*pit+1);
  iniGr=round(tk)-pit;      
  endGr=round(tk)+pit;
  if endGr>Lout, break; end
  out(iniGr:endGr) = out(iniGr:endGr)+gr'; %overlap new segment
  tk=tk+pit/beta;
end %while

⌨️ 快捷键说明

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