Make difference between different sound

HI,
I would like to detect sound with my nano BLE board.
My goal is to detect the difference between a hit on a metal and a wood.
I've a micro plugged on a ANA input and actually I'm testing fourier analyzer example .
On the example I've found they made it is real time . I just need to analyze when the hit is detect.
I use a KY-037 , I tought to store data in a rolling buffer and make the calculation when the detection is made. Like this I've data before and after the detection.
The detection works the rolling buffer too the problem is the analyse of the stored data

Is someone have an idea or a link to help me .
Thanks for your help

Distinguishing sounds is a much more difficult problem than most people realize, similar to voice recognition. These days most people would recommend machine learning algorithms.

In any case, it would be much easier to get something working on a PC before trying to implement it on a micro.

Hi,
I can't use powerfull system , no place no money .
I think about some tests to see all the harmonic in the sounds and select the most significant.
And after see if a FFT can detect the harmonic I found on the tests.

Would not a band pass filter designed for the frequency of your harmonic be easier to implement?
Paul

sounds like a task for machine learning

The suggestion was to develop your detection algorithm on a PC before trying to implement it on an Arduino class board.

The tools for interactively collecting signal data, visualizing/analyzing what you've collected, and prototyping signal analysis algorithms are simply better and one does not have to worry much about memory or processing horsepower constraints during initial development.

I do this sort of thing in Python or Octave unless you are more familiar with some other programming environment with signal processing and visualization features.

The KY-037 isn't a great choice for audio data capture unless the sound source is loud. Its primary application is detecting sound pulses, rather than capturing a complete waveform sample. I've had better success with the MAX8614 based boards.

I've done something very similar to this: listening to the sound of a wood utility pole when struck with a hammer, to see if it's possible to identify when internal decay is present.

I've got to agree with @MrMark; what you are trying to do is non-trivial. The very short duration of the impact sound makes analysis harder. Likewise, variations between individual sounds on the same material again makes it harder. You obviously need to identify some kind of signature which is a reliable differentiator between the two sounds.

It may be as simple as the presence or absence of energy in particular frequency bands. On the other hand, it might have to be some kind of power profile over frequency, and you must do some research to identify the shape of that profile. You also need to decide what to do with signals that are ambiguous - force them to the nearest metal/wood signature? Or declare them as "uncertain" so the operator must try again?

You might also find a difference in the duration of the sounds - wood and metal have different internal damping. But that will require you to normalise for the initial sound level of the strike (moving the microphone closer will make the sounds appear to last longer because it can hear them for longer above the background noise).

That is why @MrMark recommended developing the algorithm on a PC first, and then porting it to a microcontroller once you've got it buttoned down.

If there is a really big difference which is very obvious on the output of an FFT, then you might get lucky and not need to mess with a PC. But I doubt it. I hope you can prove me wrong! :grinning:

Use the computer you are on right now, to develop the method.