[d, sam] = audioread("tablefan.wav",'native');
N = size(d);
t = (0:1:N-1)'.*1.0/sam;
plot(t, d); xlabel("Time"); ylabel("Audio signal near fan");
dk = fft(d);
dk = dk(1:floor(N/2));
#plot(real(dk));
xk = sam/N(1):sam/N(1):sam/2;
loglog(xk, abs(dk));
hold on;
pkg load signal;
[peaks idx]= findpeaks(abs(dk),"MinPeakHeight",1e7,"MinPeakDistance",200);
loglog(xk(idx), abs(dk(idx)), 'xr')
hold off;
disp(xk(idx))
[d, sam] = audioread("benchgrinder.wav","native");
N = size(d);
t = (0:1:N-1)'.*1.0/sam;
#plot(t, d); xlabel("Time"); ylabel("Audio signal near bench grinder");
dk = fft(d);
dk = dk(1:floor(N/2));
xk = sam/N(1):sam/N(1):sam/2;
loglog(xk, abs(dk));
hold on;
[peaks idx]= findpeaks(abs(dk),"MinPeakHeight",1e7,"MinPeakDistance",200);
loglog(xk(idx), abs(dk(idx)), 'xr')
xk(idx)