how can i load multiple/all audio files(.wav) in matlab ? all files have different names.

조회 수: 4 (최근 30일)
i have a folder containing a number of audio files. i want to load them in a loop so that each audio signals can undergo some operations that i intend to perform.

채택된 답변

KSSV
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
Hongmiao Yann 2024년 8월 13일
Is the fourth row code:
file = audioFiles(i).name;
What do [file - audioFiles(i).name] mean?
Stephen23
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
jibrahim 2022년 10월 20일
I recommend using audioDatastore for such tasks:
% 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 CenterFile 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!

Translated by