Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions speech/gen_dataVals_from_wave_viewer.m
Original file line number Diff line number Diff line change
Expand Up @@ -302,10 +302,15 @@
onset_type = 'default amplitude onset';
end

% find boundaries for onset detection. Only consider samples that could
% have formants, ie, that exist in ftrack_taxis
startIx = find(sigmat.ampl_taxis > sigmat.ftrack_taxis(1), 1);
endIx = find(sigmat.ampl_taxis > sigmat.ftrack_taxis(end), 1) - 1; % subtracting 1 so endIx is inside the ftrack_taxis range

% find onset
onsetIndAmp = find(sigmat.ampl > ampl_thresh4voicing);
onsetIndAmp = find(sigmat.ampl(startIx:endIx) > ampl_thresh4voicing);
if onsetIndAmp
onsetIndAmp = onsetIndAmp(1) + 1;
onsetIndAmp = onsetIndAmp(1) + startIx;
else
onsetIndAmp = 1;
onset_type = 'no amplitude onset found';
Expand Down Expand Up @@ -341,7 +346,7 @@

% find the index of ftrack_taxis that's closest to and greater than ampl_taxis's onset index
[~, onsetIndFtrack] = find(sigmat.ftrack_taxis - sigmat.ampl_taxis(onsetIndAmp)>0, 1);
if ~isempty(onsetIndFrack)
if ~isempty(onsetIndFtrack)
offsetIndFtrack = find(ampl_Ftrack(onsetIndFtrack:end) < ampl_thresh4voicing);
else
offsetIndFtrack = [];
Expand Down