% Test Project Database(Matlab)
%Anurag Shivam Prasad
clc;
clear all;
close all;
r1 = audiorecorder(44100, 16,1);
disp('Start recording')
recordblocking(r1, 5);
disp('End of Recording.');
y1 = getaudiodata(r1)';
r2 = audiorecorder ;
disp('Start recording')
recordblocking(r2, 5);
disp('End of Recording.');
y2 = getaudiodata(r2)';
N = length(y1);
fn=linspace(-(N-1)/N/2,(N-1)/N/2,N);
fn = (fn.*(8000))/(2*pi);
y11 = 1/N*fft(y1);
y111 = real(fftshift(y11))
y22 = 1/N*fft(y2);
y222 = real(fftshift(y22))
v1 = y111/norm(y111)
v2 = y222/norm(y222)
v = zeros(1,length(v1));
v = zeros(2,length(fn));
v(1,:) = fn(1,:);
v(2,:) = v1(1,:);
a(1,:) = v(1,20000:40000); a(2,:) = v(2,20000:40000);
dt = 1/44000; I0 = round(0.1/dt); Iend = round(0.25/dt); x = y1(I0:Iend); c = cceps(x);
t = 0:dt:length(x)*dt-dt;
plot(t(15:75).*1e3,c(15:75)) xlabel('ms')
[~,I] = max(c(15:55)); fprintf('Complex cepstrum F0 estimate is %3.2f Hz.\n', 1/(t(I+15)))
Log in or sign up for Devpost to join the conversation.