I've been working with B4A for a few weeks now and wow am I impressed. I could go on and on about that but instead of gushing I'll ask a question.
In a post by stevel05 (here) the function AudioMaxAmplitude is demonstrated. I'm trying to use that to count the number of pulses that come in through the headphone/microphone jack on my DroidX. It works very well and I am indebted to stevel05 and the other posters in this most helpful forum.
However, no matter what I do there appears to be a limit to the number of pulses that can be differentiated in any given time period. The pulses consist of a 3kHz "chirp" with a duration of a little less than a millisecond each. At a low rate (say around 300 per minute and below) they are collected just fine but once the rate exceeds roughly 500 per minute the collected number never gets over indicating ~500 per minute. I think theoretically I should be able to distinguish at least a hundred or so per second or a few thousand in a minute.
I have used the function as shown in stevel05's demo, put it into a very tight loop, put it into it's own thread (thanks for the threading demo agrahm!), and several other variations on those. I can make it count fewer pulses but not more.
So the question is: is there a limit to how quickly AudioMaxAmplitude works or how frequently it can be called? Alternately, is there another method for achieving the same goal, that of counting pulses?
If you've made it this far thanks for reading! Sorry for being a n00b but we've all got to start somewhere...
Best Regards,
Paul
In a post by stevel05 (here) the function AudioMaxAmplitude is demonstrated. I'm trying to use that to count the number of pulses that come in through the headphone/microphone jack on my DroidX. It works very well and I am indebted to stevel05 and the other posters in this most helpful forum.
However, no matter what I do there appears to be a limit to the number of pulses that can be differentiated in any given time period. The pulses consist of a 3kHz "chirp" with a duration of a little less than a millisecond each. At a low rate (say around 300 per minute and below) they are collected just fine but once the rate exceeds roughly 500 per minute the collected number never gets over indicating ~500 per minute. I think theoretically I should be able to distinguish at least a hundred or so per second or a few thousand in a minute.
I have used the function as shown in stevel05's demo, put it into a very tight loop, put it into it's own thread (thanks for the threading demo agrahm!), and several other variations on those. I can make it count fewer pulses but not more.
So the question is: is there a limit to how quickly AudioMaxAmplitude works or how frequently it can be called? Alternately, is there another method for achieving the same goal, that of counting pulses?
If you've made it this far thanks for reading! Sorry for being a n00b but we've all got to start somewhere...
Best Regards,
Paul