sorting data into excel file
3 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Hey,
as a part of constructing a calssifier a have built a algorythm which calculates featrues over vocal WAV samples,
a file is loaded, than framed and normalaized, than go through procsses ocer features as- SHIMMER , JITTER etc.
I want to arrange each resault from each vocal sample into a excel table by a loop.
for instance, if i use MFCC 16 , i would like the raw that explains 'X' vocal signal sample to have 16 colums ,each one will reperst a value of the standard deviation sice the result will be a matrix. for the JITTER result i would like a different colum a so on for each feature.
the loop would run through all the vocal signal samples (100 for a start) and organize each feature calcultion over each sample into a diffierent colum.
since i'm not so strong at MATLAB i would love some help figuring this out.
thanks!
2 Kommentare
Antworten (1)
Pratyush Swain
am 16 Mai 2024
Hi Omer,
In order to store feature extraction for audio files in a excel file , you can create to table to store the features and use "writetable" function in MATLAB to store the data in excel. Please refer to an example workflow as follows:
numFiles = 1 % Modify it as per your number of files
% Preallocate a table to hold the feature values, please note,
% I have used 17 columns - 1 for Index(ID), 14 for MFCC , 1 for Jitter
resultsTable = table('Size', [numFiles, 16], ...
'VariableTypes', repmat({'double'}, 1, 16), ...
'VariableNames', ['ID', strcat('MFCC_SD_', string(1:14)), 'Jitter']);
% Iterate over all your files
for i = 1:numFiles
% Read the WAV file
% Replace it with your file names,using a demo file in this case
[audioIn, fs] = audioread("Counting-16-44p1-mono-15secs.wav");
% Perform Preprocessing of audio(framing, normalization,etc)
% ---------------------------------------------
% Feature Extraction
[coeffs, ~] = mfcc(audioIn, fs); % mfcc function in MATLAB returns coefficients
[rows,cols] = size(coeffs);
fprintf("Size of coefficients is as follows --> rows: %d and cols: %d ",rows, cols)
mfccSD = std(coeffs); % Standard deviation across columns
% Modify/Replace with your jitter calculations
jitterValue = rand(1) ;
% Fill in the table
resultsTable.ID(i) = i;
resultsTable{i, 2:15} = mfccSD;
resultsTable.Jitter(i) = jitterValue;
end
disp(resultsTable)
% Export the table to an Excel file
writetable(resultsTable, 'VocalFeatures.xlsx');
You can modify the above example workflow as per your usecase/implementation. You can also modify table structure and add other columns for MFCC coefficients,shimmer,etc at the start of table declaration.
Also, please refer to following resources:
Hope this helps.
0 Kommentare
Siehe auch
Kategorien
Mehr zu Spreadsheets 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!