annotate Code/Descriptors/Matlab/Common/detect_VoicedUnvoiced.m @ 0:ea0c737c6323

first commit
author Dawn Black <dawn.black@eecs.qmul.ac.uk>
date Thu, 26 Jul 2012 14:46:25 +0100
parents
children a3d62264030c
rev   line source
dawn@0 1 function [vuv] = Detect_VoicedUnvoiced( sampleWavFileName, x, fs, frameLength, noOfFrames )
dawn@0 2
dawn@0 3 sampleFileName = sampleWavFileName( 1 : length( sampleWavFileName ) - 4 );
dawn@0 4 fileName = [ sampleFileName '_VUV.txt'];
dawn@0 5 fileID = fopen( fileName );
dawn@0 6 %
dawn@0 7 if( fileID < 0 )
dawn@0 8 %---------------- GET THE SILENT FRAME VALUES -------------------
dawn@0 9
dawn@0 10 % only wish to consider pitch values from voiced frames.
dawn@0 11 % silent and unvoiced frames will produce pitch values that
dawn@0 12 % are random and therefore will bias our results
dawn@0 13 segmentFrames = detect_Silence( sampleFileName, 0 );
dawn@0 14
dawn@0 15 % remove the silent frames
dawn@0 16 [ silentFrames ] = removeSilentData( segmentFrames, noOfFrames );
dawn@0 17
dawn@0 18 % [vuv] = voicingByClustering( nonSilentAudio, fs, noOfFrames, frameLength );
dawn@0 19 [vuv] = calculate_VoicedUnvoicedDecision( sampleFileName, x, fs, frameLength, noOfFrames, silentFrames );
dawn@0 20
dawn@0 21 noOfValidFrames = length(vuv);
dawn@0 22
dawn@0 23 % plotAudioFrameByType( nonSilentAudio, noOfValidFrames, vuv, frameLength );
dawn@0 24 % fclose( fileID );
dawn@0 25 fileID = fopen( fileName, 'w');
dawn@0 26 for i = 1 : length(vuv)
dawn@0 27 fprintf(fileID,'%d %d \n', i, vuv(i));
dawn@0 28 end
dawn@0 29 fclose( fileID );
dawn@0 30 fileID = fopen( fileName );
dawn@0 31 end
dawn@0 32
dawn@0 33 vuv = fscanf( fileID, '%d', inf );
dawn@0 34 vuv = vuv( 2:2:end );
dawn@0 35
dawn@0 36 fclose( fileID );