% How to read in Hillenbrand formant data -- 
% See bottom of this file for the key.
%      Note that this version works for Matlab but not for Octave
%      The issues (and solutions) are explained in the hints for HW 2
%      http://www.ling.upenn.edu/courses/cogs501/newhw2.m
%      http://www.ling.upenn.edu/courses/cogs501/O_newhw2.m
%      http://www.ling.upenn.edu/courses/cogs501/NewHW2Hints.html

fid = fopen('bigdata2.dat');
FF = textscan(fid,'%s %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d', 10000);
%
% True vowel IDs:
Truth = FF{33};
% Speaker IDs:
Speakers = FF{34};
vnames = {'ae' 'ah' 'aw' 'eh' 'er' 'ey' 'ih' 'iy' 'oa' 'oo' 'uh' 'uw'};
% Duration, pitch, formants at 30% and 70%
F1 = [FF{2} FF{3} FF{13} FF{14} FF{15} FF{25} FF{26} FF{27}];
%
% Eliminate missing formant values (coded as zeros):
Nonzero = ~(F1(:,3)==0 | F1(:,4)==0 | F1(:,5)==0 | F1(:,6)==0 | F1(:,7)==0 | F1(:,8)==0);
F1a = double(F1(Nonzero,:));
Truth = Truth(Nonzero);
Speakers = Speakers(Nonzero);

%
% Line layout of "biggerdata2.dat"
% first column is file ID:
% character 1:     m=man, w=woman, b=boy, g=girl
% characters 2-3:  talker number
% characters 4-5:  vowel (ae="had", ah="hod", aw="hawed", eh="head", er="heard",
%                         ei="haid", ih="hid", iy="heed", oa=/o/ as in "boat",
%                         oo="hood", uh="hud", uw="who'd")
%  
% col2:  duration in msec 
% col3:  f0 at "steady state" 
% col4:  F1 at "steady state" 
% col5:  F2 at "steady state" 
% col6:  F3 at "steady state" 
% col7:  F1 at 10% of vowel duration 
% col8:  F2 at 10% of vowel duration 
% col9:  F3 at 10% of vowel duration 
% col10: F1 at 20% of vowel duration 
% col11: F2 at 20% of vowel duration 
% col12: F3 at 20% of vowel duration 
% col13: F1 at 30% of vowel duration 
% col14: F2 at 30% of vowel duration 
% col15: F3 at 30% of vowel duration 
% col16: F1 at 40% of vowel duration 
% col17: F2 at 40% of vowel duration 
% col18: F3 at 40% of vowel duration 
% col19: F1 at 50% of vowel duration 
% col20: F2 at 50% of vowel duration 
% col21: F3 at 50% of vowel duration 
% col22: F1 at 60% of vowel duration 
% col23: F2 at 60% of vowel duration 
% col24: F3 at 60% of vowel duration 
% col25: F1 at 70% of vowel duration 
% col26: F2 at 70% of vowel duration 
% col27: F3 at 70% of vowel duration 
% col28: F1 at 80% of vowel duration 
% col29: F2 at 80% of vowel duration 
% col30: F3 at 80% of vowel duration 
% 
% col31: 1=man 2=woman 3=boy 4=girl
% col32: talker number (repeats for each of four categories...)
% col33: 1=ae 2=ah 3=aw 4=eh 5=er 6=ey
%        7=ih 8=iy 9=oa 10=oo 11=uh 12=uw
% col34: unique speaker ID, 1 to 139


