how can i load multiple/all audio files(.wav) in matlab ? all files have different names.
19 次查看(过去 30 天)
显示 更早的评论
采纳的回答
KSSV
2022-10-20
audioFiles = dir('*.wav') ;
N = length(audioFiles) ;
for i = 1:N
file - audioFiles(i).name ;
% do what you want
end
3 个评论
Hongmiao Yann
2024-8-13
Is the fourth row code:
file = audioFiles(i).name;
What do [file - audioFiles(i).name] mean?
Stephen23
2024-8-14
编辑:Stephen23
2024-8-14
@Hongmiao Yann: in the fourth line you should replace the minus with equals:
file = audioFiles(i).name;
It allocates one filename to the variable FILE.
更多回答(1 个)
jibrahim
2022-10-20
% specify your folder
folder = fullfile(matlabroot,'toolbox','audio','samples');
% Create an audio datastore that points to the specified folder.
ADS = audioDatastore(folder, IncludeSubfolders=true)
% While the audio datastore has unread files, read consecutive files
% from the datastore. Use progress to monitor the fraction of files read.
while hasdata(ADS)
data = read(ADS);
fprintf('Fraction of files read: %.2f\n',progress(ADS))
end
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Audio I/O and Waveform Generation 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!