function asdFeaPlot(au) % asdFeaExtractFromFile: Feature extraction from an audio file % % Usage: % feaMat=asdFeaExtractFromFile(au); % feaMat=asdFeaExtractFromFile(au, asdOpt); % feaMat=asdFeaExtractFromFile(au, asdOpt, showPlot); % [feaMat, frameClass]=asdFeaExtractFromFile(au...); % % Example: % auFile='dataSet/abnormal-cue.wav'; % asdOpt=asdOptSet; % asdOpt.feaType='mfcc'; % fea=asdFeaExtractFromFile(auFile, asdOpt, 1); % Category: Feature extraction for vibrato detection % Roger Jang, 20130106 feaMat=au.feature; frameClass=au.tOutput; [feaDim, frameCount]=size(feaMat); frameTime=au.other.frameTime; cueTime=au.other.cueTime; subplot(211); time=(0:length(au.signal)-1)/au.fs; plot(time, au.signal); set(gca, 'xlim', [min(time), max(time)]); for i=1:frameCount % Plot background yellow lines if frameClass(i)==2, line(frameTime(i)*[1 1], [-1 1], 'color', 'y'); end end h=get(gca, 'children'); set(gca, 'children', flipud(h)); % Change rendering order xlabel('Time (sec)'); ylabel('Amplitude'); title('Waveform'); grid on subplot(212); imagesc(frameTime, 1:feaDim, feaMat); axis xy set(gca, 'ylim', [0 feaDim]); xlabel('Time (sec)'); ylabel('MFCC'); title('MFCC'); audioPlayButton(au); % Add vertical lines subplot(211); startEndLinePlot(cueTime); subplot(212); startEndLinePlot(cueTime); % Plot frame class on top of features markerColor=['k', 'm', 'r']; for i=1:frameCount h=line(frameTime(i), 0, 'marker', '.', 'color', markerColor(frameClass(i))); end function startEndLinePlot(cueTime) axisLimit=axis; for j=1:length(cueTime) lineColor='g'; if mod(j, 2)==0, lineColor='r'; end line(cueTime(j)*[1, 1], [axisLimit(3), axisLimit(4)], 'color', lineColor); end % ====== Self demo function selfdemo mObj=mFileParse(which(mfilename)); strEval(mObj.example);