资源简介
psola 算法的matlab代码!!
代码片段和文件信息
function y = tdpsola(sfspscaletscalepmvuv);
% vuv: her pitch mark aras齨daki k齭m齨 v/uv karar?
% (length(vuv)=length(pm)-1)
% uv ise pitch scaling yap齦m齳or
if (pscale ==1 & tscale==1)
y=s;
else
%Find pitch marks if necessary
if (nargin==4)
pm = find_pmarks(sfs);
end
%Do v/uv detection if necessary here
if (nargin<6)
%vuv=ones(length(pm)-11);%detect v/uv here!!!
vuv=detect_vuv(sfspm);
end
%Apply pitch scaling on the pitch marks
% and find new pitch marks (pm_ps)
pm_ps=pm;
if (pscale~=1)
pshift=0;
for i = 2:length(pm)
T0=pm(i)-pm(i-1);
if (vuv(i-1)>0)
if (pscale>1)
pshift=pshift-round(T0*(pscale-1)/pscale);
else
pshift=pshift+round(T0*(1/pscale-1));
end
end
pm_ps(i)=pm(i)+pshift;
end
end
%Find frames to be repeated/deleted for time scaling
% and store this information in useds
new_tscale=tscale*pm(length(pm))/pm_ps(length(pm_ps));
avg=sum(diff(pm_ps))/(length(pm_ps)-1);
if (new_tscale>1)
useds=zeros(1length(pm_ps)-2);
tot=new_tscale;
for i = 1 : length(useds)
while(tot>1)
useds(i)=useds(i)+1;
%tot=tot-1;
tot=tot-(pm_ps(i+1)-pm_ps(i))/avg;
end
tot=tot+new_tscale;
en
- 上一篇:jade盲源分离算法
- 下一篇:使用matlab进行普朗克公式计算
评论
共有 条评论