view Code/Descriptors/Matlab/Common/detect_VoicedUnvoiced.m @ 4:92ca03a8fa99 tip

Update to ICASSP 2013 benchmark
author Dawn Black
date Wed, 13 Feb 2013 11:02:39 +0000
parents a3d62264030c
children
line wrap: on
line source
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 );