Home > asr > uvBgPlot.m

uvBgPlot

PURPOSE ^

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

SYNOPSIS ^

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

DESCRIPTION ^

 cmWordBgPlot: Plot background yellow patches for words obtained from a given CM (confidence measure) file
    Usage: word=uvBgPlot(cmObj, fs, minY, maxY)

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SUBFUNCTIONS ^

SOURCE CODE ^

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

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