Effacer les filtres
Effacer les filtres

Info

Cette question est clôturée. Rouvrir pour modifier ou répondre.

Can I analyse more than one audio file in one code?

1 vue (au cours des 30 derniers jours)
Mike
Mike le 5 Fév 2015
Clôturé : MATLAB Answer Bot le 20 Août 2021
I have analysed one audio file, which is 1hour of recording, made a spectrogram and everything I wanted to do. I have 60 more files which are the following 60hours of recording which need analysing in the same graphs.
Is it possible to continuously loop through all of the files?
Here is the code:
[slab,S_R,bits] = wavread('E:\1.wav',[1 2]);
  1 commentaire
Stalin Samuel
Stalin Samuel le 5 Fév 2015
yes ...you can analyse more than one audio file in one code

Réponses (1)

Stalin Samuel
Stalin Samuel le 5 Fév 2015
dirName = 'your file directory'
dirData = dir(dirName); %# Get the data for the current directory
dirIndex = [dirData.isdir]; %# Find the index for directories
fileList = {dirData(~dirIndex).name}'; %'# Get a list of the files
if ~isempty(fileList)
fileList = cellfun(@(x) fullfile(dirName,x),... %# Prepend path to files
fileList,'UniformOutput',false);
end
subDirs = {dirData(dirIndex).name}; %# Get a list of the subdirectories
validIndex = ~ismember(subDirs,{'.','..'}); %# Find index of subdirectories
x = 0 %# that are not '.' or '..'
for iDir = find(validIndex)
%# Loop over valid subdirectories
x=x+1
nextDir = fullfile(dirName,subDirs{iDir}); %# Get the subdirectory path
fileList = [fileList; getAllFiles(nextDir)]; %# Recursively call getAllFiles
% pause(1)
end
nfil=size(fileList)
for m = 1:nfil
[y1, Fs1] = wavread(sprintf('%s',fileList{m,1}));
%%your code
end

Cette question est clôturée.

Community Treasure Hunt

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

Start Hunting!

Translated by