function vdHmmPlot(wObj, taskOpt) % hmmEval4audio: HMM evaluation for vibrato detection % % Usage: % vdHmmPlot(wObj, taskOpt) % % Example: % waveFile='D:\dataset\vibrato\female\combined-female.wav'; % taskOpt=vdOptSet; % load vdHmmModel.mat % Obtain hmmModel % wObj=hmmEval4audio(waveFile, taskOpt, hmmModel, 1); % Category: HMM plot for vibrato detection % Roger Jang, 20130106 if nargin<1, selfdemo; return; end subplot(2,1,1); time=(0:length(wObj.signal(:,1))-1)/wObj.fs; plot(time, wObj.signal(:,1)); set(gca, 'xlim', [min(time), max(time)]); ylabel('Ampetitue'); title('Waveform'); %labeled data subplot(2,1,2); tempPitch=wObj.other.pitch; tempPitch(tempPitch==0)=nan; plot(wObj.other.pitchTime, tempPitch); set(gca, 'xlim', [min(time), max(time)]); axisLimit=axis; yAxisLimit=axisLimit(3:4); %line(wObj.other.sFrameTime, yAxisLimit(wObj.cOutput), 'color', 'k', 'marker', '.', 'linestyle', 'none'); %line(wObj.other.sFrameTime, yAxisLimit(wObj.tOutput), 'color', 'r', 'marker', 'o', 'linestyle', 'none'); for i=1:length(wObj.tOutput) if wObj.tOutput(i)==2, line(wObj.other.sFrameTime(i)*[1 1], yAxisLimit, 'color', 'y'); end end for i=1:length(wObj.other.cueTime) line(wObj.other.cueTime(i)*[1 1], yAxisLimit, 'color', 'r'); end for i=1:length(wObj.cOutput) if wObj.cOutput(i)==2, line(wObj.other.sFrameTime(i), yAxisLimit(2), 'color', 'k', 'marker', '.'); end end xlabel('Time (sec)'); ylabel('Semitone'); title('Pitch (Groundtruth: read lines, computed: black dots)'); % Confusing matrix confMat=confMatGet(wObj.tOutput, wObj.cOutput); opt=confMatPlot('defaultOpt'); opt.className=taskOpt.outputName; opt.mode='both'; opt.format='8.2f'; figure; confMatPlot(confMat,opt); fprintf('Accuracy=%g%%\n', wObj.rr*100); % ====== Self demo function selfdemo mObj=mFileParse(which(mfilename)); strEval(mObj.example);