Home > fcn > DIVA_GUI_toolbox > au_fmt_space_init.m

au_fmt_space_init

PURPOSE ^

type can be 1,2,3 - male, female, child...default to male

SYNOPSIS ^

function au_fmt_space_init(hau,type)

DESCRIPTION ^

 type can be 1,2,3 - male, female, child...default to male

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SUBFUNCTIONS ^

SOURCE CODE ^

0001 function au_fmt_space_init(hau,type)
0002 % type can be 1,2,3 - male, female, child...default to male
0003   if(nargin==1)
0004     type=1;
0005   end
0006   [pb.type pb.num pb.vnum pb.vowel pb.f0 pb.f1 pb.f2 pb.f3]= ...
0007       textread('data/verified_pb.data','%d%d%d%s%f%f%f%f');
0008   
0009   vowel_ind=[];
0010   for j=1:length(pb.type)
0011     if(pb.type(j)==type)
0012       if isempty(findstr(char(pb.vowel(j)),'*'))
0013         if isfield(vowel_ind,char(pb.vowel(j)))
0014           vowel_ind.(char(pb.vowel(j)))(end+1)=j;
0015         else
0016           vowel_ind.(char(pb.vowel(j)))(1)=j;
0017         end
0018       end
0019     end
0020   end
0021   names=fieldnames(vowel_ind);
0022   gcolor={'b','g','r','c','m','y','k','b-','g-','r-'};
0023   axes(hau); hold on;
0024   gaussEllipse(names,pb,vowel_ind,gcolor);
0025 %   xlim=mel([0 1200]);
0026 %   ylim=mel([500 3500]);
0027 %   xtick=(mel(linspace(0,1200,5)));
0028 %   ytick=(mel(500:500:3500));
0029 %   xticklabel=floor(linspace(0,1200,5));
0030 %   yticklabel=floor(500:500:3500);
0031 
0032   xlim=[0 900];
0033   ylim=[500 3000];
0034   xtick=linspace(0,900,5);
0035   ytick=500:500:3000;
0036   xticklabel=floor(linspace(0,900,5));
0037   yticklabel=floor(500:500:3000);
0038 
0039   % above, labels are still in Hz, but plotting is mel scaled
0040   
0041   set(hau,'Xlim',xlim,'Ylim',ylim, 'YAxisLocation','left');%,'right');
0042   set(hau,'XTick',xtick,'YTick',ytick);
0043   set(hau,'XTickLabel',xticklabel,'YTickLabel',yticklabel);
0044 
0045 %   xlabel('F1 Frequency (Mel Scaled Hz)');
0046 %   ylabel('F2 Frequency (Mel Scaled Hz)');
0047   xlabel('F1 Frequency (Hz)');
0048   ylabel('F2 Frequency (Hz)');
0049   title('Acoustic Space');
0050   
0051   axis normal;
0052   
0053 function gaussEllipse(names,pb,vowel_ind,gcolor)
0054 % Find and plot ellipses defined by gaussian distribution using mean
0055 % and covariance measured from Peterson and Barney 1952 database
0056   
0057 % Replace means with better vowels -- Rabiner and Schafer and
0058 % Empirical from DIVA experimentation
0059   
0060   F.IY=[270 2290 3010];  % iy
0061   F.IH=[390 1990 2550];  % ih
0062   F.EH=[519 1619 2411];  % eh
0063   F.AE=[660 1720 2410];  % ae
0064   F.AH=[677 1419 2241];  % ah
0065   F.AA=[662 1251 2278];  % aa
0066   F.UH=[541 1097 2239];  % uh
0067   F.UW=[392 964 2233];   % oo
0068   F.ER=[490 1350 1690];  % er
0069   F.AO=[526 910.5 2108];   % ow
0070   
0071   for i=1:length(names)
0072     cur_dist=[pb.f1(vowel_ind.(char(names(i)))) pb.f2(vowel_ind.(char(names(i))))];
0073     mu=mean(cur_dist,1)';
0074     S=cov(cur_dist);
0075   
0076     mu=F.(char(names(i)))([1,2])';
0077     
0078     theta=linspace(0,2*pi,1000);
0079     [vv,dd]=eig(S*2); % 2 standard deviations?
0080     A=real((vv*sqrt(dd))');
0081     x=sin(theta);
0082     y=cos(theta);
0083     z=[x' y']*A;
0084     z=z+repmat(mu',1000,1);
0085     %z=mel(z);
0086     %mu=mel(mu);
0087     plot(z(:,1),z(:,2),char(gcolor(i)),'ButtonDownFcn',get(gca,'ButtonDownFcn'),...
0088          'tag',get(gca,'tag'),'parent',gca);
0089     text(mu(1),mu(2),char(names(i)),'ButtonDownFcn',get(gca,'ButtonDownFcn'),...
0090          'tag',get(gca,'tag'),'parent',gca);
0091   end
0092   return

Generated on Tue 27-Mar-2007 12:06:24 by m2html © 2003