How to truncate number of sample in audiofiles using audioDatastore function in MATLAB?
3 次查看(过去 30 天)
显示 更早的评论
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 个评论
Walter Roberson
2020-4-25
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
采纳的回答
Walter Roberson
2020-4-23
data(45001, :) = 0;
data = data(1:45000, 1);
No if needed, and handles multiple channels converting to single channel.
12 个评论
Walter Roberson
2020-4-25
It will take me more searching and testing. It turns out that audioDataStore ignores custom readFcn so it might be necessary to recode it for to use a datastore of type 'File'.
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Dataset Management and Labeling 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!