I have a folder full of audio files and i want read files one by one and compute some parameters and store the result in a matrix any one plese help

1 回表示 (過去 30 日間)
I have sample data of .wav format and i want to read the files one by one and them calcuate the parameters like energy, delta ,power spectrum and these result in a matrix and want to do this process for all the thousand files present in the folder.

回答 (1 件)

jibrahim
jibrahim 2022 年 8 月 29 日
Hi Kalyan,
For this sort of task, consider using audioDatastore.
For example, here is the code to point to a number of audio files, and compute the max sample from each file:
pathToFiles = fullfile(pwd,'toolbox','audio','samples');
ads = audioDatastore(pathToFiles, IncludeSubfolders=true);
ads.Files
% The metric I want to compute
myVals = zeros(1,length(ads.Files));
index = 1;
while hasdata(ads)
fprintf('Progress: %f percent complete\n',ads.progress*100)
x = read(ads);
myVals(index) = max(x(:));
index = index+1;
end
If you have Parallel Processing Toolbox, there are ways to accelerate the operation by partionining the datastore over several workers. You can refer to examples about the partition method for that pattern.

カテゴリ

Help Center および File ExchangeAudio and Video Data についてさらに検索

製品

Community Treasure Hunt

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

Start Hunting!

Translated by