Borrar filtros
Borrar filtros

Info

La pregunta está cerrada. Vuélvala a abrir para editarla o responderla.

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

1 visualización (últimos 30 días)
Mike
Mike el 5 de Feb. de 2015
Cerrada: MATLAB Answer Bot el 20 de Ag. de 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 comentario
Stalin Samuel
Stalin Samuel el 5 de Feb. de 2015
yes ...you can analyse more than one audio file in one code

Respuestas (1)

Stalin Samuel
Stalin Samuel el 5 de Feb. de 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

La pregunta está cerrada.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by