# find rotation rate from sound recording
# extract WAV from video with "mplayer -ao pcm video.avi"

# decimation factor
decim = 100;

[wav,samprate,bps] = wavread ("audiodump.wav");

# square, and drop anything but first channel
wav = wav(:,1) .** 2;

# decimate
wl = decimate(wav, decim);
lowrate = samprate / decim;

# autocorrelation up to one second
c = autocor(wl, lowrate);

# x axis for one second
t = 0:1/lowrate:1;

plot(t,c);
title("Autocorrelation of rotation noise");
xlabel("Time");
grid("on");

# print("-dpng", "foo.png");
