KeithB wrote:KeithB wrote:Thanks xdebugx. Last question. I understand when your trying to reconstruct the frequency using half the value of numCrossing multiplied by the number of samples your buffer is per second. But how does 8000 fit into this.
For example if I was doing a zero crossings method on a tone that is only one second long and is passed directly to the for loop which calculates the numCrossing value as an array, to reconstruct the frequency would I haveUsing java Syntax Highlighting
frequency = (numSamples) * (numCrossing/2) ;Parsed in 0.030 seconds, using GeSHi 1.0.8.4
Thanks very much.
Silly me, I figured this out. Looking at code too long really does not make things easier.
I got the 8000 from:
bufferSize=AudioRecord.getMinBufferSize(8000,AudioFormat.CHANNEL_CONFIGURATION_MONO,
Your recording at 8khz so there should be 8000 samples per second. So:
frequency = (8000/buffersize) should give you the period of time for one buffer that we process.
frequency = (8000/buffersize) * (numCrossings/2); should give the period of time, times the number of crossings.
Is this wrong? Is counting the number of samples and multiplying by the number of crossings better?


.