view 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 source
function plotAudioFrameByType( x, noOfValidFrames, vuv, frameLength );

values = unique( vuv );


figure(1); hold off;


for frameIdx = 1:noOfValidFrames
    startPoint = ((frameIdx-1) * frameLength)+1;
    endPoint = frameIdx * frameLength;
    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