Comparing two small audio files (e.g., hand clap) Android
What you're interested in sounds like a generic version of a matched filter. I'm not going to be able to speak to the software aspect of how you implement the file handling and &quot;always-on&quot; listening ability of this problem, but from a signal processing perspective, that's what you want to look into. It's worth noting that your filter is unlikely to match any hand clapping or any ball bouncing based on the reference waveform, but the magnitude of the matched filter response should give you a pretty reliable measure of how close the input is. You can use more advanced techniques if you get a lot of false alarms, like requiring the filter response to be a certain SNR by taking constant ambient noise measurements and comparing the amplitude to those.
EDIT: I re-read your question and am convinced this is the correct approach, but I suggest against trying to find a file-level solution to this issue. What you want to do is open the &quot;reference&quot; file and time-reverse the audio data. Then as mic input comes in, you convolve it with the reversed reference waveform (this is matched filtering). A strong response (impulse) from that convolution output indicates a match. In terms of tools you don't even need a powerful audio library, just something that can get the audio in 1-D vector form and then a time-reverse and 1-D convolution (common operations in matrix libraries).