function f = yesno(filename)
% This is the main function to distinguish 'YES' from 'NO'
% It handles all of the calling of the other functions
% The altorithm it follows is quite simple.
%
% First the sound wave is divided into overlapping blocks.
% Each block contains 600 samples which is about 30 msec long.
%
% Next the blocks are examined to see if they contain
% any significant data. The total energy and the number
% of zero crossings are both measured to determine this.
%
% Finally, if there is a substantial signal, the zero
% crossings are again counted in each block. A high number
% of zero crossings is indicative of the presence of
% an unvoiced fricative (150-300 zero crossings per block
% are typical), whereas voiced phones tend to have much fewer
% zero crossings (around 10-50 per block).
%
% Unvoiced fricatives are 'f' 's' 'sh' and 'th' (as in think)
% If we know the word spoken is either 'yes' or 'no'
% we can simply look for unvoiced fricatives, by looking
% for blocks with sufficient numbers of zero crossings.
% The precence of an unvoiced fricative would indicate
% that the word being spoken is 'yes', while the absence
% of such would indicate that the word spoken is 'no'
%
% This method was found to correctly distinguinsh 'yes'
% from 'no' with 100% accuracy among 24 independent voice
% samples taken from 8 different speakers.
%
% Block Size
N = 600;
% Block Increment
M = 200;
% Threshold to discard
sumthresh = 0.035;
zerocrossthresh = 0.060;
rawdata = wavread(filename);
blockeddata = block(rawdata,N,M);
strippeddata = strip(blockeddata,sumthresh,zerocrossthresh);
zerocrossdata = zerocrossmap(strippeddata);
plot(zerocrossdata);
maxzerocross = max(zerocrossdata);
if (maxzerocross < 5)
f='INSUFFICIENT DATA';
elseif (maxzerocross > 100)
f='YES';
else
f='NO';
end