If anybody's interested, I still have my mostly-complete-and-working rewrite of wavread to implement buffered WAV file reading (along with other mucho bug fixes of course).
Well, I'd be interested if it was working.
I suppose I should just attach the histogram/sfm calculation here.
Nothing fancy, I assure you.
--- this is freeware, nothing is guaranteed at all---
clear all
close all
clc
fname='02.wav';
x=wavread(fname);
x=x';
len=length(x)
his(1:65536)=0;
low=32768;
high=32768;
windd=hann(2048)';
sfmmean=0;
nmeas=0;
for ii=1:len
for jj=1:2
t=x(jj,ii);
if ( t < -1)
t=-1
fflush(stdout);
end
if (t >65535/65536)
t=65535/65536
fflush(stdout);
end
t=round(t*32768+32769);
his(t)=his(t)+1;
if (t < low)
low=t;
end
if (t > high)
high=t;
end
end
if (mod(ii,1024)==0)
if (ii>1024)
for kk=1:2
w=x(1,ii-2047:ii);
w=w .* windd;
wt=fft(w);
wt= wt .* conj(wt);
wt=max(wt,.0000000001);
am=sum(wt)/2048;
gm= exp (sum(log(wt))/2048);
sfm=gm/am;
if ( am > .5)
nmeas=nmeas+1;
sfm=10*log10(sfm);
sfmmean=sfmmean+sfm;
end
end
end
if (mod(ii,1024*16)==0 )
ii/len
fflush(stdout);
end
end
end
tot=sum(his);
his=his/tot;
his=max(his, .000000000001);
xax=-32768:32767;
semilogy(xax,his);
axis([-40000 40000 1e-10 1e-1]);
nmeas=nmeas
if (nmeas >0)
sfmmean=sfmmean/nmeas
end
low=low-32769
high=high-32769
fname
---end of freeware---
Change fname as you will
Its slow. The time is spent not in the fft part, but in the very simple histogram part, too. No idea why. It's slower than a snail glued to a rock.