MFCC extraction for audio files in a folder
14 次查看(过去 30 天)
显示 更早的评论
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 个评论
采纳的回答
jibrahim
2020-12-9
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 个评论
Mary Jeethu A J
2021-9-17
编辑:Mary Jeethu A J
2021-9-17
Could you please share the code for extracting the mean of each column?
Thanking you in advance.
更多回答(1 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Speech Recognition 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!