Documente Academic
Documente Profesional
Documente Cultură
Initial Problem
Problems with variation
Sample length and emphasis Time domain issue: Starting and ending at the same time
Program Design
Using the frequency domain to compare Take an average of voice
Basic Recording
Create a for loop for recording 10 different samples of voice to be averaged
for i = 1:10 file = sprintf('%s%d.wav','g',i); input('You have 2 seconds to say your name. Press enter when ready to record--> '); y = wavrecord(88200,44100); sound(y,44100); wavwrite(y,44100,file); end
Basic Recording 2
Youre probably wondering what this line means:
y = wavrecord(88200,44100); This line basically setting the time of the recording. How do you get two seconds out of this? Well, you take the frequency of the recording (44100 hz) and divide it by 88200hz. Which gives you a half. Then you inverse the half due to the fact that HZ is just 1/second. In the end, youd have two seconds.
end
Verification
Verification process
input ('You will have 2 seconds to say your name. Press enter when ready') usertemp = wavrecord (88200,44100); sound (usertemp,44100); rec = input ('Are you happy with this recording? \nPress 1 to record again or just press enter to proceed--> '); while rec == 1 rec = 0; input ('You will have 2 seconds to say your name. Press enter when ready') usertemp = wavrecord (88200,44100); sound (usertemp,44100); rec = input ('Are you happy with this recording? \nPress 1 to record again or just press enter to proceed--> '); end
Test Crop
s = abs (usertemp); start = 1; last = 88200; for i = 1:88200 if s (i) >=.1 && i <=5000 start = 1; break end if s (i) >=.1 && i > 5000 start = i-5000; break end end for i = 1:88200 k = 88201-i; if s (k)>=.1 && k>=83200 last = 88200; break end if s (k)>= .1 && k <83200 last = k + 5000; break end end
FFT, Plot
user = usertemp (start:last); userftemp = fft (user); userftemp = userftemp.*conj (userftemp); userf = userftemp (1:600); userfn = userf/sqrt(sum (abs (userf).^2)); hold on; subplot (2,1,1); plot (userfn) title ('Normalized Frequency Spectra Of Recording') subplot (2,1,2); plot (tn); title ('Normalized Frequency Spectra of Average')
Testing
s = sqrt (sum (abs (userfn - tn).^2)); if s < 2*std name = strcat ('HELLO----',name,' !!!!'); name else name = strcat ('YOU ARE NOT---- ',name,' !!!!'); name end