function [vuv] = detect_VoicedUnvoiced( sampleWavFileName, OVERWRITE )

sampleFileName = sampleWavFileName( 1 : length( sampleWavFileName ) - 4 );
fileName = [ sampleFileName '_VUV.txt'];
fileID = fopen( fileName );
% 
if( (fileID < 0) || (OVERWRITE) )
    %---------------- GET THE SILENT FRAME VALUES -------------------
    
    % only wish to consider pitch values from voiced frames.
    % silent and unvoiced frames will produce pitch values that
    % are random and therefore will bias our results
    segmentFrames = detect_Silence( [sampleFileName '.wav'], 0 );

    % remove the silent frames
    [x, fs, frameLength, noOfFrames] = openFile(  [ sampleFileName '.wav' ] ); 
    [ silentFrames ] = getSilentDataArray( segmentFrames, noOfFrames );
    
    % [vuv] = voicingByClustering( nonSilentAudio, fs, noOfFrames, frameLength );
    [vuv] = calculate_VoicedUnvoicedDecision( sampleFileName, x, fs, frameLength, noOfFrames, silentFrames );

    noOfValidFrames = length(vuv);

%     plotAudioFrameByType( nonSilentAudio, noOfValidFrames, vuv, frameLength );
%     fclose( fileID );
    fileID = fopen( fileName, 'w');
    for i = 1 : length(vuv)
        fprintf(fileID,'%d %d \n', i, vuv(i));
    end
    fclose( fileID );
    fileID = fopen( fileName );
end

vuv = fscanf( fileID, '%d', inf );
vuv = vuv( 2:2:end );

fclose( fileID );