How to truncate number of sample in audiofiles using audioDatastore function in MATLAB?
Show older comments
Hi all
I am using audiodatadatastore function to classify my speech signal using wavelet scattering . Unfortunately all my audio files are having different length or sample size. I want to make it uniform for all files.
I did try following
% while hasdata(ads)
% [data,info] = read(ads);
%
% if length(data)<45000
% data=[data;zeros(45000-length(data),1)];
% else
% data=data(1:45000);
% end
% end
But that’s of no use. Help is highly appreciated.
6 Comments
jibrahim
on 22 Apr 2020
kc, can you provide a little more info? Why is your code of no use? Is you goal to set all your signal lengths to 45000?
kc
on 23 Apr 2020
Walter Roberson
on 23 Apr 2020
is it certain that the audio is single channel?
kc
on 23 Apr 2020
Walter Roberson
on 25 Apr 2020
Note: in your release the link to your example should be https://www.mathworks.com/help/releases/R2018b/wavelet/examples/music-genre-classification-using-wavelet-scattering.html
kc
on 25 Apr 2020
Accepted Answer
More Answers (0)
Categories
Find more on AI for Signals in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!