I am trying to do some audio processing on Android in real time.
What I got so far, is an app that records a sound during a predefined amount on time and save it on a WAV file which is then processed.
This works pretty good but, since I am just interested on recording impulse responses, I have thought that it might be pretty cool to make my app automatically detect when has an impulse occured and just retain the samples from 0,5 seg before of the impulse and until 1,5 sec after (2 sec in total).
This is how I am dealing with the byte array of the wav file so far:
double audioSample = (double) (array[i+1] << 8 | array[i] & 0xff)/ 32767.0;
This gives me values between [-1,1], so lets say that my idea would be about considering an impulse any sound above 0,3 more or less. I think that the solution would be about storing the samples in a buffer and checking its values in real time but I am not quite sure about how to implement it.
Do you guys know any sample code or something I can take a look at?