if ~exist('auSet') fprintf('Loading mat/auSet2.mat...\n'); load mat/auSet2.mat end %% Classification by pitch max, volume max, and duration max for i=1:length(auSet) phoneSet=auSet(i).asraOutput(2).phone; vowelIndex=find([auSet(i).asraOutput(2).phone.isVowel]); vowelSet=phoneSet(vowelIndex); for j=1:length(vowelSet) id=vowelIndex(j); vowelPitch=vowelSet(j).pitch; % Extend the pitch if the leading consonant is pitched (This could go wrong, for instance, "noneqivocal") % if id>1 && ~phoneSet(id-1).isVowel && ~phoneSet(id-1).pitched % vowelPitch=[phoneSet(id-1).pitch, vowelPitch]; % end vowelSet(j).pitchMax=max(vowelPitch); vowelSet(j).volMax=max(vowelSet(j).volume); vowelSet(j).duration=diff(vowelSet(j).interval); end [pitchMax, auSet(i).pStressByPitch]=max([vowelSet.pitchMax]); [volMax, auSet(i).pStressByVolume]=max([vowelSet.volMax]); [~, auSet(i).pStressByDuration]=max([vowelSet.duration]); auSet(i).pitchDiff=pitchMax-vowelSet(auSet(i).stressPos).pitchMax; end gtStress=[auSet.stressPos]; pStressByPitch=[auSet.pStressByPitch]; pStressByVolume=[auSet.pStressByVolume]; pStressByDuration=[auSet.pStressByDuration]; rr=sum(gtStress==pStressByPitch)/length(gtStress); fprintf('rr=%g%% using pitch max\n', rr*100); rr=sum(gtStress==pStressByVolume)/length(gtStress); fprintf('rr=%g%% using volume max\n', rr*100); rr=sum(gtStress==pStressByDuration)/length(gtStress); fprintf('rr=%g%% using duration max\n', rr*100); plot(sort([auSet.pitchDiff])); %% Check mis-classified recordings index=find([auSet.pitchDiff]>0); auSet2=auSet(index); % Misclassified cases [sortValue, sortIndex]=sort([auSet2.pitchDiff], 'descend'); auSet2=auSet2(sortIndex); for i=1:length(auSet2) fprintf('%d/%d: file=%s\n', i, length(auSet2), auSet2(i).path); au=myAudioRead(auSet2(i).path); sound(au.signal, au.fs); [parentDir, text]=fileparts(auSet2(i).path); asraOutput=waveAssess(auSet2(i).path, text, 'english', 1, 'temp.pv'); % Forced alignment fprintf('GT stress=%d, predicted stress=%d\n', auSet2(i).stressPos, auSet2(i).pStressByPitch); fprintf('Press any key to continue...'); pause; fprintf('\n'); end