Will this code work for training voice commands?

2 visualizaciones (últimos 30 días)
Sresht Iyer
Sresht Iyer el 29 de Jun. de 2016
Hey guys, I'm basically trying to write a code for a simple voice recognition program. My method is to extract the Zero Crossing Rate, Standard Deviation and Auto Correlation values for the signal for 10 trials and then find their average and store them somewhere. Then in the testing phase, I'll extract the same parameters for the spoken word and compare all three parameters and see if they fall within allowable tolerances. I have no experience in DSP, so I just want to implement the most basic form of voice recognition. The code for the training phase for the word 'forward' is given below.
if true
%common code
clc
clear all
Fs=8000;
hstd = dsp.StandardDeviation;
hstd.RunningStandardDeviation = true;
hzcd = dsp.ZeroCrossingDetector;
hac2 = dsp.Autocorrelator;
hac2.MaximumLagSource = 'Property';
hac2.MaximumLag = 10;
%common code ends here
%parameters for 'forward' command
std_deviation_fwd_sum = zeros(:,1);
unit32 ZCR_fwd_sum = 0;
auto_correlation_fwd_sum = zeros(:,1);
%parameters end here
%Training for 'forward' starts here
for i = 1:10
display('record data for forwards, you have 1 second, press enter to start');
input('');
x = audiorecorder(Fs,24,1);
record(x);
pause(1);
y = getaudiodata(x);
std_deviation_fwd= step(hstd,y);
ZCR_fwd= step(hzcd,y);
auto_correlation_fwd= step(hac2,y);
std_deviation_fwd_sum = std_deviation_fwd_sum + std_deviation_fwd;
ZCR_fwd_sum = ZCR_fwd_sum + ZCR_fwd;
auto_correlation_fwd_sum = auto_correlation_fwd_sum + auto_correlation_fwd;
end
ZCR_fwd = ZCR_fwd_sum/10;
auto_correlation_fwd = auto_correlation_fwd_sum/10;
std_deviation_fwd = std_deviation_fwd_sum/10;
%Training for 'forward' command ends here
end

Respuestas (0)

Categorías

Más información sobre AI for Signals en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by