Home > asr > wordQiYinBgPlot.m

wordQiYinBgPlot

PURPOSE ^

cmWordBgPlot: Plot background yellow patches for words obtained from a given CM (confidence measure) file

SYNOPSIS ^

function word=wordQiYinBgPlot(cmObj, fs, minY, maxY)

DESCRIPTION ^

 cmWordBgPlot: Plot background yellow patches for words obtained from a given CM (confidence measure) file
    Usage:  cmWordBgPlot(cmObj, fs, minY, maxY)
        This function is primarily used in waveCmPlot.m

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SUBFUNCTIONS ^

SOURCE CODE ^

0001 function word=wordQiYinBgPlot(cmObj, fs, minY, maxY)
0002 % cmWordBgPlot: Plot background yellow patches for words obtained from a given CM (confidence measure) file
0003 %    Usage:  cmWordBgPlot(cmObj, fs, minY, maxY)
0004 %        This function is primarily used in waveCmPlot.m
0005 
0006 %    Roger Jang, 20050103
0007 
0008 if nargin<1; selfdemo; return; end
0009 
0010 word=cmWordBgPlot(cmObj, fs, minY, maxY);
0011 % Change word patches
0012 for i=1:length(word)
0013     if strcmp(word(i).name, 'sil') | strcmp(word(i).name, 'sp');
0014         set(word(i).textH, 'string', '');
0015     else
0016         set(word(i).textH, 'string', word(i).name);
0017         set(word(i).patchH, 'faceColor', 0.5*[1 1 1]);    % Change patch color
0018     end
0019     for j=1:length(word(i).phone)
0020         phoneName=word(i).phone(j).name;
0021         plusPos=findstr(phoneName, '+');    % Take the first out of a bi-phone, such as uw+t
0022         phoneName=phoneName(1:plusPos-1);
0023         set(word(i).phone(j).textH, 'string', phoneName);
0024         % change patch color
0025         if isUnvoicedPhone(phoneName, 'hanyu')
0026             index=word(i).phone(j).time*fs/10000000;
0027             word(i).phone(j).patchH=patch(index([1 2 2 1])/fs, [minY minY maxY maxY], 0.8*[1 1 1]);
0028             set(word(i).phone(j).patchH, 'edgeColor', 'k');
0029         end
0030     end
0031 end
0032 axis([-inf inf minY, maxY]);
0033 
0034 % ====== Self demo
0035 function selfdemo
0036 wavFile='朝辭白帝彩雲間.wav';
0037 wavFile='但使龍城飛將在.wav';
0038 cmFile=[wavFile(1:end-3), 'cm'];
0039 [wave, fs, nbits]=wavread(wavFile);
0040 feval(mfilename, cmFile, fs, -1, 1);
0041 time=(1:length(wave))/fs;
0042 waveH=line(time, wave);
0043 axis([min(time), max(time), -1, 1]); 
0044 box on

Generated on Tue 01-Jun-2010 09:50:19 by m2html © 2003