how to chang the frame size from 20 ms to 10ms

I want to change frame size in this code? Where should I make changes?
function [L0code,L1code,L2code,L3code]=LpAnalysis11(speech)
%speech£­£­£­ÓïÒôÖ¡(240µã,±àÂëÊý¾Ý(present_speech)λÓÚ(121:200))
%L0code,L1code,L2code,L3code--ÉùµÀ²ÎÊýÂë×Ö
global L1 L2 L3 L0 MA1 MA2 lspcb1 lspcb2 lspcb3 q_old rcAR1 rcAR2;
global freq_prev;%ÓÃÓÚli¸üÐÂ
%¼ÆËã×ÔÏà¹ØÏµÊý
window=zeros(1,240);
for i=1:200
window(i)=0.54-0.46*cos((i-1)*2*pi/399);
end
for i=1:40
window(200+i)=cos(2*pi*(i-1)/159);
end
window_speech=window.*speech;
AR=autocorr_levinson(window_speech);
%AR=lpc(window_speech,10);
%°Ñ×ÔÏà¹ØÏµÊýת»¯ÎªLSP(Ï߯׶Ô)²ÎÊý
ls=lpcar2ls(AR);
%ÒÔÏÂΪÁ¿»¯LSP²ÎÊý------------------------
oumiga=ls*2*pi;
l_qua=zeros(1,10);%Á¿»¯¹ýµÄl
W=zeros(1,10);
lsp_qua=zeros(1,10);%Á¿»¯¹ýµÄlsp
%¶¨Òå¼ÓȨϵÊýW
if oumiga(2)-0.04*pi-1>0
W(1)=1;
else
W(1)=10*(oumiga(2)-0.04*pi-1)^2+1;
end
for i=2:9
if oumiga(i+1)-oumiga(i-1)-1>0
W(i)=1;
else
W(i)=10*(oumiga(i+1)-oumiga(i-1)-1)^2+1;
end
end
if -oumiga(9)+0.92*pi-1>0
W(10)=1;
else
W(10)=10*(-oumiga(9)+0.92*pi-1)^2+1;
end
W(4)=W(4)*1.2;
W(5)=W(5)*1.2;
%ÒÔÏÂÁ½´ÎÑ­»··Ö±ðÕë¶ÔÁ½¸öMAÔ¤²âÆ÷
tempL1=0;
tempL2=0;
tempL3=0;
Elsf=zeros(1,2);
for t=1:2
if t==1
%µÚÒ»¸öMAÄ£ÐÍ
%Ê×ÏÈÇóµ±Ç°µÚnÖ¡µÄµÚÒ»±¾ÂëÊéÖеÄϱê,L1=.....
l_target=jisuanL1(oumiga,MA1);
%Çóµ±Ç°µÚnÖ¡µÄµÚ¶þ±¾ÂëÊéÖеÄϱê,L2=.....
jisuanL2(W,l_target);
%µ÷Õûli(0.0012)(i=1:5)
for i=1:5
l_qua(i)=lspcb1(L1,i)+lspcb2(L2,i);
end
l_qua(1:5)=lsp_expand(l_qua(1:5),0.0012);
%round(l_qua*2^13)
%Çóµ±Ç°µÚnÖ¡µÄµÚ¶þ±¾ÂëÊéÖеÄϱê,L3=.....
jisuanL3(W,l_target);
%µ÷Õûli(0.0012)(i=6:10)
for i=6:10
l_qua(i)=lspcb1(L1,i)+lspcb3(L3,i-5);
end
l_qua(6:10)=lsp_expand(l_qua(6:10),0.0012);
%round(l_qua*2^13)'
%ÒÔϽøÐеڶþ´Îµ÷Õû£¬gap=0.0006
l_qua=lsp_expand(l_qua,0.0006);
%round(l_qua*2^13)'
tempL1=L1;
tempL2=L2;
tempL3=L3;%µÚÒ»¸öMAÄ£ÐÍÁ¿»¯index
%ÒÔϼÆËãElsf
Elsf(t)=lsp_get_tdist(W,l_qua,l_target,MA1);
else
%µÚ¶þ¸öMAÄ£ÐÍ
%Ê×ÏÈÇóµ±Ç°µÚnÖ¡µÄµÚÒ»±¾ÂëÊéÖеÄϱê,L1=.....
l_target=jisuanL1(oumiga,MA2);
%ÒÔϼÆËãL2
jisuanL2(W,l_target);
for i=1:5
l_qua(i)=lspcb1(L1,i)+lspcb2(L2,i);
end
l_qua(1:5)=lsp_expand(l_qua(1:5),0.0012);
%round(l_qua*2^13)
jisuanL3(W,l_target);
%ÒÔϵ÷Õûli(0.0012)(i=6:10)
for i=6:10
l_qua(i)=lspcb1(L1,i)+lspcb3(L3,i-5);
end
l_qua(6:10)=lsp_expand(l_qua(6:10),0.0012);
%round(l_qua*2^13)'
%ÒÔϽøÐеڶþ´Îµ÷Õû£¬gap=0.0006
l_qua=lsp_expand(l_qua,0.0006);
%round(l_qua*2^13)'
%ÒÔϼÆËãElsf
Elsf(t)=lsp_get_tdist(W,l_qua,l_target,MA2);
end
end
%ÇóL0(MAÔ¤²âÆ÷index)²¢×îÖÕÈ·¶¨L1 L2 L3
%round(Elsf*2^27)
if Elsf(1)<Elsf(2)
L0=0;
L1=tempL1;
L2=tempL2;
L3=tempL3;
else
L0=1;
end
%L0
%L1
%L2
%L3
%----------------------------------------
%ÒÔÏ»ñµÃÁ¿»¯ºóµÄlsp (w^)
if L0==0
P=MA1;
else
P=MA2;
end
lsp_qua=lsp_get_quant(lspcb1,lspcb2,lspcb3,L1,L2,L3,P,freq_prev);%(q_lsf)
%round(lsp_qua*2^13)'
%ÒÔϸüÐÂfreq_prev (li)
freq_prev(1:3,:)=freq_prev(2:end,:);
freq_prev(4,:)=l_qua;
%ÒÔÏÂperform LSPÄÚ²å
[rcAR1,rcAR2]=int_qlpc(q_old,cos(lsp_qua));
%round(rcAR1*2^12)'
%round(rcAR2*2^12)'
% /* Compute A(z/gamma) */
%Ö»ÒªÖªµÀrcAR ¾Í¿ÉÒÔ¼ÆËãA(z/gamma)£¬ÔÚ´ËÊ¡ÂÔ
%/* update the LSPs for the next frame */
q_old=cos(lsp_qua);
%round(q_old*2^15)'
%¹¹ÔìÂë×Ö
%L0char=dec2bin(L0,1);
%L0code=bin2dec(L0char(:))';
L0code=dec_bin(L0,1);
%L0code=bin_dec(L0bin,1)';
%L1char=dec2bin(L1-1,7);
%L1code=bin2dec(L1char(:))';
L1code=dec_bin(L1-1,8);
%L1code=bin_dec(L1bin,7)';
%L2char=dec2bin(L2-1,5);
%L2code=bin2dec(L2char(:))';
L2code=dec_bin(L2-1,2);
%L2code=bin_dec(L2bin,5)';
%L3char=dec2bin(L3-1,5);
%L3code=bin2dec(L3char(:))';
L3code=dec_bin(L3-1,2);
%L3code=bin_dec(L3bin,5)';

답변 (1개)

Walter Roberson
Walter Roberson 2011년 4월 29일

0 개 추천

Unfortunately, your comments got converted from your language into a useless string of symbols, so we cannot run an automatic translator to try to figure out what you said in them.
Without the comments, we have no hint as to what the time units are.
The occurrences of the number 200 are suggestive of the possibility that you have 10 samples per millisecond, but that is speculation.
You have a lot of "magic numbers" in your code. For example, we do not know if it the 399 is 200*2-1 or if there is some other reason for that number showing up there. Are the 240 representing 200 samples plus a fixed width of 40 samples, or should the 40 be 1/5 of the number of samples? The 159 is probably 160-1 but is that 4*40-1 and thus ((4/5 times the number of samples) minus 1) and so would be 79 if the number of samples is 100 ??
You need to go through the code and rewrite it so that all of the numbers that depend upon the number of samples are replaced by calculated values; once you do that, changing to 10 ms will be a change of a single number. If you do not understand the code well enough to know what each of the numbers means, then we, who have never seen the code before, have little chance of figuring it out.

카테고리

도움말 센터File Exchange에서 Creating and Concatenating Matrices에 대해 자세히 알아보기

태그

질문:

2011년 4월 29일

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by