Mercurial > hg > emotion-detection-top-level
view Code/Test/checkVUV.m @ 4:92ca03a8fa99 tip
Update to ICASSP 2013 benchmark
author | Dawn Black |
---|---|
date | Wed, 13 Feb 2013 11:02:39 +0000 |
parents | ea0c737c6323 |
children |
line wrap: on
line source
function [] = checkVUV() sampleName = '01_a_male01_pos'; [x, fs, frameLength, noOfFrames] = openFile( [sampleName '.wav'] ); y = buffer( x, frameLength ); %---------------- 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 = getSilenceDecision( sampleName ); [ silentFrames ] = removeSilentData( segmentFrames, noOfFrames ); % % open original annotation file % fileName = [sampleName '.txt']; % % read metrics from file % fileID = fopen( fileName ); % data = fscanf( fileID, '%d', inf ); % annotatedPitch = data(3:4:end); % fclose( fileID ); % open HNR file fileName = [sampleName '_HNR.txt']; % read metrics from file fileID = fopen( fileName ); data = fscanf( fileID, '%f', inf ); harmonic2noise = data(2:2:end); fclose( fileID ); largestH2NValue = max( [max(harmonic2noise) abs(min(harmonic2noise))] ); %normalise harmonic2noise = harmonic2noise/largestH2NValue; %round to 1dp harmonic2noise= (round(harmonic2noise*10))/10; % open audio power file fileName = [sampleName '_AP.txt']; % read metrics from file fileID = fopen( fileName ); data = fscanf( fileID, '%f', inf ); audioPower = data(2:2:end); fclose( fileID ); maxPower = max(audioPower); minFreq = ceil(fs/getVariables('getMinFreq')); %default minimum fundatmental frequency maxFreq = ceil(fs/getVariables('getMaxFreq')); %default maximum fundamental frequency % open pitch file fileName = [sampleName '_YIN_pitch.txt']; % read metrics from file fileID = fopen( fileName ); data = fscanf( fileID, '%f', inf ); pitch = data(2:2:end); fclose( fileID ); % open band power file % fileName = [sampleName '_ASBP_norm.txt']; % % read metrics from file % fileID = fopen( fileName ); % data = fscanf( fileID, '%f', inf ); % bandPowerRatio = data(2:2:end); % fclose( fileID ); % bandPowerRatioRMS = sqrt( mean(( bandPowerRatio/max(bandPowerRatio) ).^2 )); % HNRThresh = 0; hold off; minLength = min([length(harmonic2noise) length(audioPower) length(pitch)]); plotUnits = 1/frameLength; for( i=1:minLength ) if( silentFrames(i) == 0 ) % harmonic2noise(i) == 0 ) %silent % plot( ((i-1)*frameLength)+1:(i*frameLength), y(:,i), 'y' );hold on; plot( i-0.5 + plotUnits : plotUnits : i+0.5, y(:,i), 'y' );hold on; vuv(i) = 0; elseif( ((harmonic2noise(i) <= HNRThresh))... %|| (bandPowerRatio(i)/max(bandPowerRatio) < 0.001)) ... || (pitch(i) > minFreq) ... || (pitch(i) < maxFreq)) %... % || (audioPower(i)/maxPower < 0.0005)) % unvoiced % plot( ((i-1)*frameLength)+1:(i*frameLength), y(:,i), 'r' );hold on; plot( i-0.5 + plotUnits : plotUnits : i+0.5, y(:,i), 'r' );hold on; vuv(i) = 2; else %voiced % plot( ((i-1)*frameLength)+1:(i*frameLength), y(:,i), 'g' );hold on; plot( i-0.5 + plotUnits : plotUnits : i+0.5, y(:,i), 'g' );hold on; vuv(i) = 1; end end % plot( 1 : 1 : length(harmonic2noise), harmonic2noise, 'b' );hold on; % plot( 1 : 1 : length(pitch), pitch/max(pitch), 'w' );hold on; % % pitch thresholds % L=line([0 noOfFrames], [maxFreq/max(pitch) maxFreq/max(pitch)]); % set(L,'color',[1 0 0]); % L=line([0 noOfFrames], [minFreq/max(pitch) minFreq/max(pitch)]); % set(L,'color',[1 0 0]); % % %HNR threshold % L=line([0 noOfFrames], [HNRThresh HNRThresh]); % set(L, 'color', [0 0 1] );