On 10/16/07, Martin Ahnelöv <operagasten@gmail.com> wrote:

 

Are you sure? Shouldn't it be counter/2? AFAIK, the sine crosses zero
each other time.

I thought you could make zeroX only count postive zero crossings as well, that would make it a bit easier, though it you count all of them you can also count half-cycles which should give a lower rounding error. I can't explain the x4 issue either.

Another issue is this; 

if(sampcounter > samplerate)


I think that should be "greater then or equal to". This way we are counting over a period of "second + samp", I think?


Generally I think we are way better off using Uanae, that should result in a faster response, less influence from hiss and complicated wave-forms and there is no need to use a LPF and set it's cut-off in a way that requires assumptions about the signal. There will still be a trade between response-time and accuracy but it's a more efficient trade and there is no way around that anyway.


Kas.