MFCC extraction for audio files in a folder
8 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Camille Dingam
am 9 Dez. 2020
Bearbeitet: Mary Jeethu A J
am 17 Sep. 2021
Hello, below is the code i m working on to extract mfcc features for all audio files in a folder. I want each file with it mfccs features in the term of columns or row, meaning each audio file with mfcc features dimensions(as a vector). If i have 36 audios files in a folder, i want to store the mfcc features of each file in an excel or anywhere with 36 columns or rows which correspond to audio 36 audio files numbers, and their rows or columns which correspond to mfcc features of each audio files, the dimensions of each audio file mfcc features must be the same. I tried with the following code but in vain, i really need help to figure out the problem in my code. The code is:
clc
clear all
file = dir ('D:\FOR AUDIO PREPARATION\F03&FC03\VOWEL_e\F03--FC03\F03\*wav');
M= length (file)
% file = dir ('*.wav');
%
% M= length (file);
NFFT = 128;
for k = 1:10
%pitch extraction
[speech,Fs]= audioread(fullfile('D:\FOR AUDIO PREPARATION\F03&FC03\VOWEL_e\F03--FC03\F03\',file(k).name));
% [speech,Fs]= audioread(file(k).name);
a=(speech);
[coeffs,delta,deltaDelta,loc] = mfcc(speech,Fs);
win = hann(1024,"periodic");
S = stft(imf,"Window",win,"OverlapLength",512,"Centered",false);
coeffs = mfcc(S,Fs,"LogEnergy","Ignore");
data(:,k) = coeffs(:);
end
0 Kommentare
Akzeptierte Antwort
jibrahim
am 9 Dez. 2020
Hi Camille,
The size of the output of mfcc, coeffs, is L-by-M for mono audio signals, where L depends on the audio input length, and M is the number of coefficients you asked for (controlled by the NumCoeffs parameter-value pair - it is 13 by default).
If your audio signals are not all of the same length, then L will be different for each file, and you won't be able to put the coefficients in a matrix like you are doing.
You either have to make sure all your signals are of the same length, or you will have to store the MFCC coefficients in a cell array rather than a matrix. For example:
files = dir ('*.wav');
data = cell(1, length(files));
for k = 1:length(files)
[speech,Fs]= audioread(files(k).name);
coeffs = mfcc(speech,Fs,"LogEnergy","Ignore");
data{k} = coeffs;
end
2 Kommentare
Mary Jeethu A J
am 17 Sep. 2021
Bearbeitet: Mary Jeethu A J
am 17 Sep. 2021
Could you please share the code for extracting the mean of each column?
Thanking you in advance.
Weitere Antworten (1)
Siehe auch
Kategorien
Mehr zu Measurements and Spatial Audio 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!