function X = helperspeechSpectrograms(ads,segmentDuration,frameDuration,hopDuration,numBands)
disp("Computing speech spectrograms...");
numHops = ceil((segmentDuration - frameDuration)/hopDuration);
numFiles = length(ads.UnderlyingDatastore.Files);
X = zeros([numBands,numHops,1,numFiles],'single');
for i = 1:numFiles
[x,info] = read(ads);
fs = info.SampleRate;
frameLength = round(frameDuration*fs);
hopLength = round(hopDuration*fs);
spec = melSpectrogram(x,fs, ...
'WindowLength',frameLength, ...
'OverlapLength',frameLength - hopLength, ...
'FFTLength',2048, ...
'NumBands',numBands, ...
'FrequencyRange',[50,4000]);
X(:,:,1,i) = spec;
end
disp("...done");
end