Home > chronux > wave_browser > segment_calc_script.m

segment_calc_script

PURPOSE ^

segment_calc_script

SYNOPSIS ^

This is a script file.

DESCRIPTION ^

 segment_calc_script

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 % segment_calc_script
0002 
0003 tmp=dir;
0004 nfiles=length(tmp);
0005 names=cell(nfiles,1); for j=1:nfiles, names(j)=cellstr(tmp(j).name); end; 
0006 wavnames=regexp(names,'.*wav$','match');
0007 ind=~cellfun('isempty',wavnames);
0008 wavnames=wavnames(ind);
0009 segnames=regexp(names,'.*wav.seg.txt$','match');
0010 ind=~cellfun('isempty',segnames);
0011 segnames=segnames(ind);
0012 
0013 nwaves=length(wavnames);
0014 
0015 movingwin=[0.01 0.005];
0016 params.tapers=[2 3]; params.pad=1; params.Fs=44100; params.fpass=[5000 20000];
0017 F1=[]; F2=[]; F3=[]; F4=[]; F0=[]; C1=[]; C2=[]; 
0018 for i=1:nwaves, 
0019     i
0020 %    data=wavread(wavnames{i}{1});
0021 %    [Feat S t f]= acoustic_features_MB(data,movingwin,params);
0022     sname=[wavnames{i}{1} '.sp'];
0023     load(char(sname),'-mat');
0024     C=fft(log(S),[],2); cep=real(C); C1=[C1 cep(:,2)']; C2=[C2 cep(:,3)'];  
0025     x0=log(mean(S,2))/log(10)*10; x0=x0-max(x0); F0=[F0 x0'];
0026     x=log(Feat(:,1)); w=Feat(:,2)-x; x=x/log(10)*10; x=x-max(x);  
0027     F1=[F1 x'];
0028     F2=[F2 w'];
0029     F3=[F3 Feat(:,3)'];
0030     tmp=load(char(segnames{i}(1))); sz=size(tmp);
0031     seg=zeros(length(t),1); 
0032     if sz(1)>0, 
0033         for j=1:sz(1), ind=find((t>tmp(j,1)) & (t<tmp(j,2))); seg(ind)=1; end
0034     end; 
0035     F4=[F4 seg'];
0036 end
0037 tb=find(F4<1); ts=find(F4>0);  
0038 F5=zeros(length(F0),1);
0039 F5(find(F0>-20))=1.1;
0040 F6=medfilt1(F5,5);

Generated on Fri 28-Sep-2012 12:34:30 by m2html © 2005