Error in helperspeechSpectrograms (line 14) numHops = ceil((segmentDuration - frameDurat​ion)/hopDu​ration);

조회 수: 1 (최근 30일)
function X = helperspeechSpectrograms(ads,segmentDuration,frameDuration,hopDuration,numBands)
% This function is only for use in the
% "Spoken Digit Recognition with Wavelet Scattering and Deep Learning"
% example. It may change or be removed in a future release.
%
% helperspeechSpectrograms(ads,segmentDuration,frameDuration,hopDuration,numBands)
% computes speech spectrograms for the files in the datastore ads.
% segmentDuration is the total duration of the speech clips (in seconds),
% frameDuration the duration of each spectrogram frame, hopDuration the
% time shift between each spectrogram frame, and numBands the number of
% frequency bands.
disp("Computing speech spectrograms...");
numHops = ceil((segmentDuration - frameDuration)/hopDuration);
numFiles = length(ads.Files);
X = zeros([numBands,numHops,1,numFiles],'single');
for i = 1:numFiles
[x,info] = read(ads);
x = normalizeAndResize(x);
fs = info.SampleRate;
frameLength = round(frameDuration*fs);
hopLength = round(hopDuration*fs);
spec = melSpectrogram(x,fs, ...
'Window',hamming(frameLength,'periodic'), ...
'OverlapLength',frameLength - hopLength, ...
'FFTLength',2048, ...
'NumBands',numBands, ...
'FrequencyRange',[50,4000]);
% If the spectrogram is less wide than numHops, then put spectrogram in
% the middle of X.
w = size(spec,2);
left = floor((numHops-w)/2)+1;
ind = left:left+w-1;
X(:,ind,1,i) = spec;
if mod(i,500) == 0
disp("Processed " + i + " files out of " + numFiles)
end
end
disp("...done");
end
Error in helperspeechSpectrograms (line 14) numHops = ceil((segmentDuration - frameDuration)/hopDuration);

답변 (0개)

카테고리

Help CenterFile Exchange에서 AI for Audio에 대해 자세히 알아보기

제품


릴리스

R2021a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by