AudioDatastore input output error

1 visualización (últimos 30 días)
krishna Chauhan
krishna Chauhan el 4 de Jun. de 2020
Comentada: jibrahim el 4 de Jun. de 2020
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 comentario
jibrahim
jibrahim el 4 de Jun. de 2020
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

Iniciar sesión para comentar.

Respuestas (0)

Categorías

Más información sobre Feature Extraction en Help Center y File Exchange.

Productos

Community Treasure Hunt

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

Start Hunting!

Translated by