dawn@0
|
1 function plotAudioFrameByType( x, noOfValidFrames, vuv, frameLength );
|
dawn@0
|
2
|
Dawn@4
|
3 values = unique( vuv );
|
dawn@0
|
4
|
Dawn@4
|
5
|
Dawn@4
|
6 figure(1); hold off;
|
Dawn@4
|
7
|
dawn@0
|
8
|
dawn@0
|
9 for frameIdx = 1:noOfValidFrames
|
dawn@0
|
10 startPoint = ((frameIdx-1) * frameLength)+1;
|
dawn@0
|
11 endPoint = frameIdx * frameLength;
|
Dawn@4
|
12 xTicks = frameIdx : 1/frameLength : (frameIdx+1)-(1/frameLength);
|
Dawn@4
|
13
|
Dawn@4
|
14 if( length( values) == 2 )
|
Dawn@4
|
15 type1 = values(1);
|
Dawn@4
|
16 type2 = values(2);
|
Dawn@4
|
17 if( vuv( frameIdx ) == type1 ) % voiced
|
Dawn@4
|
18 % plot( startPoint : endPoint , x( startPoint : endPoint ), 'y' );
|
Dawn@4
|
19 plot( xTicks , x( startPoint : endPoint ), 'y' );hold on
|
Dawn@4
|
20 elseif( vuv( frameIdx ) == type2 ) %unvoiced
|
Dawn@4
|
21 % plot( startPoint : endPoint , x( startPoint : endPoint ) , 'r' );
|
Dawn@4
|
22 plot( xTicks , x( startPoint : endPoint ) , 'r' );hold on
|
Dawn@4
|
23 end
|
Dawn@4
|
24 elseif( length( values) == 3 )
|
Dawn@4
|
25 type1 = values(1);
|
Dawn@4
|
26 type2 = values(2);
|
Dawn@4
|
27 type3 = values(3);
|
Dawn@4
|
28 if( vuv( frameIdx ) == type1 ) % voiced
|
Dawn@4
|
29 % plot( startPoint : endPoint , x( startPoint : endPoint ), 'y' );
|
Dawn@4
|
30 plot( xTicks , x( startPoint : endPoint ), 'y' );hold on
|
Dawn@4
|
31 elseif( vuv( frameIdx ) == type2 ) %unvoiced
|
Dawn@4
|
32 % plot( startPoint : endPoint , x( startPoint : endPoint ) , 'r' );
|
Dawn@4
|
33 plot( xTicks , x( startPoint : endPoint ) , 'g' );hold on
|
Dawn@4
|
34 elseif( vuv( frameIdx ) == type3 ) %unvoiced
|
Dawn@4
|
35 % plot( startPoint : endPoint , x( startPoint : endPoint ) , 'r' );
|
Dawn@4
|
36 plot( xTicks , x( startPoint : endPoint ) , 'r' );hold on
|
Dawn@4
|
37 end
|
dawn@0
|
38 end
|
dawn@0
|
39 end
|
dawn@0
|
40 hold off |