0
$\begingroup$

I have an audio signal and I'm interested to detect the very sharp peaks.

enter image description here

If I zoom, here is something that should NOT be detected (this is voice actually):

enter image description here NO GOOD

Here is something that should be detected:

enter image description here GOOD

Ideally, a CNN with some training would be the best solution but I'm too limited in terms of computation to run it.

So, I'm looking for an easy solution with a simple signal processing algorithm (filters and others things).

I have already developed a simple algorithm based on the maximum of a 10ms window and if I see that the maximum is low, then suddenly very high, and then low again, I have a detection.

But it's not outstanding. Any better idea? Is there any filter that can find me "sharp" peaks?

$\endgroup$
  • $\begingroup$ might not be so easy. you might need to run a pitch detector on this, not so much to estimate pitch, but to estimate how "pitchy" it is. (how periodic a signal is.) that can be used to differentiate between "voiced" and "unvoiced" sounds. $\endgroup$ – robert bristow-johnson Feb 23 at 3:06
  • $\begingroup$ i gotta post about pitch detection here. again the measure you're interested in is the maximum normalized autocorrelation that is not at a lag at or close to 0. $\endgroup$ – robert bristow-johnson Feb 23 at 3:09
  • $\begingroup$ It's interesting though it's a lot of maths. I'm not sure how to get the relevant "bits" from it. I would like to add a couple of comments. First, the first super sharp 'pulse' of those peaks I'm trying to detect are always around 1kHz. I tried a band-pass but voice is "strong" at 1kHz so it's not helping. Secondly, there is no fixed period between the targeted peaks. On my example, it seems that they are elapsed every 1.5s but it's just a coincidence. $\endgroup$ – gregoiregentil Feb 23 at 6:23
  • 1
    $\begingroup$ the relevant bit is to recognize a waveform (whether it's "peaky" or not) over just noisy crap (that has peaks in it), you need to measure how periodic that waveform is. pitch detection does that (in addition to measuring the period of the periodic waveform). so if you can measure the periodicity of the waveform, you have one metric that tells you where the vocal is and not confuse it with where the vocal is not. $\endgroup$ – robert bristow-johnson Feb 23 at 7:12
  • $\begingroup$ @gregoiregentil: Do all the "peaks" that you aim to detect belong to the same class of audio events, e.g., drum transients? $\endgroup$ – applesoup Feb 23 at 9:32
1
$\begingroup$

"Sharp peaks" in the time domain translates to high frequency content. Your simple algorithm of min and max values would be improved by first passing your data through a high pass filter - otherwise slow (low frequency) rumbles could degrade your detection methods.

To take your solution to the next level, you should use an "onset detection" algorithm. These are well studied. A recommended paper to start is:

A Tutorial on Onset Detection in Music Signals - Juan Pablo Bello et al, September 2005.

$\endgroup$
1
$\begingroup$

Judging only from one bad example, it is hard to give a good answer. If this is a representative example of your data, then I would see it more important to identify the repetition of the peaks, instead of the peaks itself. Two thoughts on that:

  • Use a peak detection algorithm. You already mentioned that you experimented with one, which certainly can be used and improved. However, detect multiple peaks in a longer window and neglect the signal if there are too many peaks (probably more that 3 is sufficient, judging from the data presented.)

  • Check the autocorrelation of the signal. Maybe you can come up with a model for the normal appearing data, and check for the differences in the bad data. I assume that you have a rapid decay in the normal data, but a longer decay in the bad data. Do you know the spacing of the peaks? It looks quite regular. You could also do a correlation with a comb-function of the right period, if the period is known well enough a priori.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.