Iterate speech frames through all the audio file in the folder
이전 댓글 표시
Hello, i have split audio file into frames and i want to iterate all the frames though all the audio file in the folder. After iterate, i want to apply feature like mfcc(calculate the mean) of all the audio file and put it in a matrix of rows and conlums(each row is mfcc mean for each file). Below is the code i m trying to make as what i need. Any help please.
clc;
clear all;
% Specify the folder where the files live.
myFolder = '/MATLAB Drive/AUDIO2/LONGhead/FC03_1head';
% Check to make sure that folder actually exists. Warn user if it doesn't.
if ~isfolder(myFolder)
errorMessage = sprintf('Error: The following folder does not exist:\n%s\nPlease specify a new folder.', myFolder);
uiwait(warndlg(errorMessage));
myFolder = uigetdir(); % Ask for a new one.
if myFolder == 0
% User clicked Cancel
return;
end
end
% Get a list of all files in the folder with the desired file name pattern.
filePattern = fullfile(myFolder, '**/*.wav'); % Change to whatever pattern you need.
theFiles = dir(filePattern);
AudioArray = cell(1, numel(theFiles));
i=1;
j=1;
o=1;
r=1;
u=1;
for k = 1 : numel(theFiles) % NUMEL is more direct than LENGTH
baseFileName = theFiles(k).name;
fullFileName = fullfile(theFiles(k).folder, baseFileName);
AudioArray{k} = audioread(fullFileName);
[speech, fs] = audioread(fullFileName);
% do framing
f_d = 0.03;
f_size = round(f_d * fs);
n = length(speech);
n_f = floor(n/f_size); %no. of frames
temp = 0;
for i = 1 : n_f
frames = speech(temp + 1 : temp + f_size);
%frames = X1(temp + 1 : temp + f_size);
temp = temp + f_size;
y=mfcc(frames, fs);
% z(i, :)=max(fwht(frames))
Z(i, j)=[mean(y)];
end
end
채택된 답변
추가 답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 Linear Prediction에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!