0

I have an incoming sine test signal from a microphone. I know that I can find a peak amplitude just by scanning the vaweform samples and looking for max magnitude (taking into account that it may be also negative). I take chunks about 500ms.

The problem is that incoming signal might contain occasional short peaks because of noises. That is why I cannot measure the max magnitude - I might find the peak level of the noise.

Is there some stable algorithm which would allow me to calculate an major peak value of the waveform chunk but throw away some short noisy peaks which are not useful signal?

I do not need something super accurate, I just want to throw away most of the possible noise peaks.

JustAMartin
  • 13,165
  • 18
  • 99
  • 183

1 Answers1

1

First approach: For each (from some grid) of thresholds s > 0, count the number of data points exceeding s. This will give you a measure of the duration for which the sound was louder than s. Now define how short a noise must have been in order to be considered "noise".

You can refine this by not just counting, but heavier weighting of data points exceeding s more if you have observed many such data points in the not-to-near and not-to-far past, which allows you to distinguish very short peaks from longer periods of higher amplitude.

JohnB
  • 13,315
  • 4
  • 38
  • 65