AudioDatastore input output error

조회 수: 1 (최근 30일)
krishna Chauhan
krishna Chauhan 2020년 6월 4일
댓글: jibrahim 2020년 6월 4일
I am using audio files of unequal length,But for calculation of melSpectrograms i need equal datasamples in each file. I applied the transform function to make files equal. But then its not reading the transflrm files as desired. I am following https://in.mathworks.com/help/wavelet/examples/spoken-digit-recognition-with-wavelet-scattering-and-deep-learning.html example on my data. My code giving error
XTrain = helperspeechSpectrograms(scatds_Train,segmentDuration,frameDuration,hopDuration,numBands);
This scatds_Train is the transformed datastore, which is not readable by the support function there. I have attached this supporting file.
its giving me following error
"Unable to perform assignment because the size of the left side is 40-by-186 and the size of the right side is 40-by-187."
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.UnderlyingDatastore.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, ...
'WindowLength',frameLength, ...
'OverlapLength',frameLength - hopLength, ...
'FFTLength',2048, ...
'NumBands',numBands, ...
'FrequencyRange',[50,4000]);
X(:,:,1,i) = spec;
end
disp("...done");
end
%--------------------------------------------------------------------------
  댓글 수: 1
jibrahim
jibrahim 2020년 6월 4일
krishna,
Put a breakpoint where you assign spec to X(:,:,1,i), and then call read on your transform datastore. I think there is a mismatch in sizes on that line

댓글을 달려면 로그인하십시오.

답변 (0개)

카테고리

Help CenterFile Exchange에서 Feature Extraction에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by