diff Code/Test/plotAudioFrameByType.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 diff
--- a/Code/Test/plotAudioFrameByType.m	Mon Sep 10 09:20:12 2012 +0100
+++ b/Code/Test/plotAudioFrameByType.m	Wed Feb 13 11:02:39 2013 +0000
@@ -1,17 +1,40 @@
 function plotAudioFrameByType( x, noOfValidFrames, vuv, frameLength );
 
+values = unique( vuv );
 
-hold on
+
+figure(1); hold off;
+
 
 for frameIdx = 1:noOfValidFrames
     startPoint = ((frameIdx-1) * frameLength)+1;
     endPoint = frameIdx * frameLength;
-%     if( vuv( frameIdx ) == 0 ) %silent
-%         plot( startPoint : endPoint  , x( startPoint : endPoint ), 'w' );
-    if( vuv( frameIdx ) == 1 ) % voiced
-        plot( startPoint : endPoint , x( startPoint : endPoint ), 'y' );
-    elseif( vuv( frameIdx ) == 2 ) %unvoiced
-        plot( startPoint : endPoint , x( startPoint : endPoint ) , 'r' );
+    xTicks = frameIdx : 1/frameLength : (frameIdx+1)-(1/frameLength);
+
+    if( length( values) == 2 )
+        type1 = values(1);
+        type2 = values(2);
+        if( vuv( frameIdx ) == type1 ) % voiced
+    %         plot( startPoint : endPoint , x( startPoint : endPoint ), 'y' );
+            plot( xTicks , x( startPoint : endPoint ), 'y' );hold on
+        elseif( vuv( frameIdx ) == type2 ) %unvoiced
+    %         plot( startPoint : endPoint , x( startPoint : endPoint ) , 'r' );
+            plot( xTicks , x( startPoint : endPoint ) , 'r' );hold on
+        end
+    elseif( length( values) == 3 )
+        type1 = values(1);
+        type2 = values(2);
+        type3 = values(3);
+        if( vuv( frameIdx ) == type1 ) % voiced
+    %         plot( startPoint : endPoint , x( startPoint : endPoint ), 'y' );
+            plot( xTicks , x( startPoint : endPoint ), 'y' );hold on
+        elseif( vuv( frameIdx ) == type2 ) %unvoiced
+    %         plot( startPoint : endPoint , x( startPoint : endPoint ) , 'r' );
+            plot( xTicks , x( startPoint : endPoint ) , 'g' );hold on
+        elseif( vuv( frameIdx ) == type3 ) %unvoiced
+    %         plot( startPoint : endPoint , x( startPoint : endPoint ) , 'r' );
+            plot( xTicks , x( startPoint : endPoint ) , 'r' );hold on
+        end
     end
 end
 hold off
\ No newline at end of file