Mercurial > hg > emotion-detection-top-level
view Code/Descriptors/Matlab/Common/detect_VoicedUnvoiced.m @ 1:a3d62264030c
tested and working
author | Dawn Black <dawn.black@eecs.qmul.ac.uk> |
---|---|
date | Mon, 10 Sep 2012 09:13:53 +0100 |
parents | ea0c737c6323 |
children | 92ca03a8fa99 |
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, 0 ); % remove the silent frames [x, fs, frameLength, noOfFrames] = openFile( [ sampleFileName '.wav' ] ); [ silentFrames ] = removeSilentData( 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 );