how can i load multiple/all audio files(.wav) in matlab ? all files have different names.
19 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
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.
0 Kommentare
Akzeptierte Antwort
KSSV
am 20 Okt. 2022
audioFiles = dir('*.wav') ;
N = length(audioFiles) ;
for i = 1:N
file - audioFiles(i).name ;
% do what you want
end
3 Kommentare
Hongmiao Yann
am 13 Aug. 2024
Is the fourth row code:
file = audioFiles(i).name;
What do [file - audioFiles(i).name] mean?
Stephen23
am 14 Aug. 2024
Bearbeitet: Stephen23
am 14 Aug. 2024
@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.
Weitere Antworten (1)
jibrahim
am 20 Okt. 2022
% 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
Siehe auch
Kategorien
Mehr zu Audio I/O and Waveform Generation finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!