sorting data into excel file

2 vues (au cours des 30 derniers jours)
Omer Aroetty
Omer Aroetty le 21 Fév 2021
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 commentaires
Mathieu NOE
Mathieu NOE le 23 Fév 2021
hello
have you started to write a code so far ?
Omer Aroetty
Omer Aroetty le 23 Fév 2021
I have written a code that calculates all features i need on a single vocal signal. Now i want to understand how to organise the results in excel as i asked above

Connectez-vous pour commenter.

Réponses (1)

Pratyush Swain
Pratyush Swain le 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
numFiles = 1
% 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
Size of coefficients is as follows --> rows: 1551 and cols: 14
disp(resultsTable)
ID MFCC_SD_1 MFCC_SD_2 MFCC_SD_3 MFCC_SD_4 MFCC_SD_5 MFCC_SD_6 MFCC_SD_7 MFCC_SD_8 MFCC_SD_9 MFCC_SD_10 MFCC_SD_11 MFCC_SD_12 MFCC_SD_13 MFCC_SD_14 Jitter __ _________ _________ _________ _________ _________ _________ _________ _________ _________ __________ __________ __________ __________ __________ _______ 1 1.8194 3.3625 1.2825 0.6205 0.64335 0.41481 0.3109 0.31299 0.2583 0.24075 0.26204 0.20797 0.26111 0.20545 0.91808
% 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.

Produits


Version

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by