Comparing two small audio files (e.g., hand clap) Android Dears,
I am new in signal processing and I am dealing with an Android application that should do some audio files (having the same &quot;small&quot; duration) comparison in real time.
My main focus is about comparing two small audio files (about 10 seconds each one) which are related to a hand clap for example (or other sounds related to one short event like ball falling).
In other terms, I should save a reference audio file (or a significant representation you may suggest) and then compare (in real time) a newly recorded audio file with the one already saved.
For instance, if my audio of reference is a hand clap so I decide that the 2 audios are similar if the second one includes a clap even if there are some noises or the 2 sounds intensity is not the same.
I already checked musicg lib for doing this kind of comparison however, I have to convert my recorded audio files to .wav which may add some slowness in my real time application.
I am wondering if there is another alternative that fits better small audio files (about 10 seconds) having the same duration ?
Thanks in advance for your suggestions and help.
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).