clear all; clc; clf;

k=0.5;
TWIN=3*14;

[IR1,fs,bit]=wavread('C:\HIL\LisztZeneakademia_Nagyterem\Impulse\z_2_R_c1_i.wav'); 
[IR2,fs,bit]=wavread('C:\HIL\LisztZeneakademia_Nagyterem\Impulse\z_14_R_c1_i.wav'); 

OFFS=0;
[IRr,IRi,IRint]=dokt_ir2interp_v2(IR1,IR2,fs,bit,k,OFFS,TWIN);

% ábrázolás
[vv1,vv2,tt1,tt2]=dokt_ir2int2mx(IR1,IR2,fs,bit,k,OFFS,TWIN);
vvu=k.*vv1+(1-k).*vv2; ttu=round(k.*tt1+(1-k).*tt2);
clf; hold all; 
LIM1=1800; LIM2=4600; kicsi=-max(abs(IR1)); nagy=-kicsi;
subplot(3,1,1);
plot(IR1); hold on;
   for i=1:length(tt1)-1, plot(tt1(i+1)-round(TWIN/2)+1:tt1(i+1)+round(TWIN/2),vv1(:,i),'r'); end; 
   set(gca,'Xlim',[LIM1 LIM2]); set(gca,'Ylim',[kicsi nagy]);
subplot(3,1,2);
plot(IR2); hold on; 
   for i=1:length(tt2)-1, plot(tt2(i+1)-round(TWIN/2)+1:tt2(i+1)+round(TWIN/2),vv2(:,i),'r'); end; 
   set(gca,'Xlim',[LIM1 LIM2]); set(gca,'Ylim',[kicsi nagy]);
subplot(3,1,3);
plot(IRint); hold on;  
   for i=1:length(ttu)-1, plot(ttu(i+1)-round(TWIN/2)+1:ttu(i+1)+round(TWIN/2),vvu(:,i),'r'); end; 
   set(gca,'Xlim',[LIM1 LIM2]); set(gca,'Ylim',[kicsi nagy]);
hold off; 

wavwrite(IRint,fs,bit,'IR7b');