nelsonlombardo

Testing audio processing with GNU Octave

Nov 3rd, 2019
637
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. while 1
  2.   fs = 16e3; # Sample frequency
  3.   x = record(1, fs); # Record one second from mic
  4.   subplot(2,1,1); # Draw in the first frame
  5.   plot(x);
  6.   axis([0 fs -1 1]);
  7.   drawnow();
  8.   n = 2**(fs/1e3);
  9.   y = abs(fft(x, n)); # Magnitude spectrum
  10.   y = fftshift(y);
  11.   f = [(-n/2):(n/2)-1] / n;
  12.   subplot(2,1,2); # Draw in the second frame
  13.   plot(f, y);
  14.   axis([-0.5 0.5 0 200]);
  15.   drawnow();
  16. endwhile
RAW Paste Data

Adblocker detected! Please consider disabling it...

We've detected AdBlock Plus or some other adblocking software preventing Pastebin.com from fully loading.

We don't have any obnoxious sound, or popup ads, we actively block these annoying types of ads!

Please add Pastebin.com to your ad blocker whitelist or disable your adblocking software.

×