how to handle huge volume of audio features
Show older comments
I have to find the cartesian product of audio features. I have selected MFCC, BARKSPECTRUM, PITCH as featues.
and I have 10 classes of 1000 samples in my audio database.
I thought MFCC and BARKSP and PITCH produces each with single line of N, M, Q size features but. these each are generating matrix of data with sizeof 970X14 for MFCC, 970X32 for barksp and 970X1 for pitch ... I thought these 970 rows are for 970 training audio samples . Its not so... and thses features size is changing ... please see my code and tell me how to handle this huge volume of audio data and i need to find the cartesian product of these features and I should get 1 row for 1 audio sample with each feature
clc
clear all
clear variables
close all
%------------------------------------
%Create an audioDatastore
db = fullfile('C:/DBs/AudioDB')
audiodb = audioDatastore(db,'IncludeSubfolders',true,'LabelSource','foldernames');
%------------------------------------
[sample, dsInfo] = read(audiodb);
reset(audiodb)
fs = dsInfo.SampleRate;
windowLength = round(0.03*fs);
overlapLength = round(0.025*fs);
%--------------------------------
allfeatures=[];
labels_allfeatures=[];
%------------------------------------
while hasdata(audiodb)
[audioIn,adsInfo] = read(audiodb);
%------MFCC FEATURES---------------
MFCC1 = mfcc(audioIn,fs,'Window',hamming(windowLength,'periodic'),'OverlapLength',overlapLength);
%--------------BARK FEATURES------------------------------
afe = audioFeatureExtractor('SampleRate',fs, ...
'Window',hamming(windowLength,'periodic'), ...
'OverlapLength',overlapLength, ...
'barkSpectrum',true);
%setExtractorParams(afe,"barkSpectrum","NumBands",64)
BSP1=extract(afe,audioIn);
%save barSp.mat barSp
%------PITCH FEATURES-----------------------------
P1 = pitch(audioIn,fs,'WindowLength',windowLength,'OverlapLength',overlapLength);
%save pit.mat pit
feat=[MFCC1,BSP1,P1];
%------------------------------------------------
voicedSpeech = isVoicedSpeech(audioIn,fs,windowLength,overlapLength);
feat(~voicedSpeech,:) = [];
label = repelem(adsInfo.Label,size(feat,1));
%-------------------------------------------------
allfeatures = [allfeatures;feat];
labels_allfeatures = [labels_allfeatures,label];
end %end of while
save allfeatures.mat allfeatures
save labels_allfeatures.mat labels_allfeatures
%---------------------------------
%%
%Supporting Functions
function voicedSpeech = isVoicedSpeech(x,fs,windowLength,overlapLength)
pwrThreshold = -40;
[segments,~] = buffer(x,windowLength,overlapLength,'nodelay');
pwr = pow2db(var(segments));
isSpeech = (pwr > pwrThreshold);
zcrThreshold = 1000;
zeroLoc = (x==0);
crossedZero = logical([0;diff(sign(x))]);
crossedZero(zeroLoc) = false;
[crossedZeroBuffered,~] = buffer(crossedZero,windowLength,overlapLength,'nodelay');
zcr = (sum(crossedZeroBuffered,1)*fs)/(2*windowLength);
isVoiced = (zcr < zcrThreshold);
voicedSpeech = isSpeech & isVoiced;
end
. plz help me.
Accepted Answer
More Answers (0)
Categories
Find more on Code Generation and Deployment in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!