2
$\begingroup$

I need to detect two sounds (913 Hz and 1370 Hz), knowing the time in which each starts and ends.

At this time, I am using a band pass filter (butter), and this is the result:

First image is the original signal, second is after a bpf at 913Hz (window=150 Hz)

Here is the first time this sound occurs:

First time the sound at 913 Hz occurs

The red line is where the sound is supposed to end (276 ms).

So how can I detect that the first time the tone occurs it starts at 0 ms and ends at 276 ms?

$\endgroup$
  • 2
    $\begingroup$ You need to define very carefully and precisely what you mean by start time and end time. Otherwise the answer could theoretically be never (an IIR bandpass filter rings for infinity). $\endgroup$ – hotpaw2 Feb 23 '16 at 18:19
  • $\begingroup$ @hotpaw2, in the middle of a recording I want to detect those two sounds, in this specific order and specific lengths. By the start and end, I mean when this tone occurs. Let's say, I want to know if someone pressed the key '7' on the phone for 276 milliseconds and the 9 key for 1 second. $\endgroup$ – Dayvid Oliveira Feb 23 '16 at 18:22
  • 1
    $\begingroup$ You've missed the point of what @hotpaw2 wrote. $\endgroup$ – Carl Witthoft Feb 23 '16 at 20:58
1
$\begingroup$

I would recommend reading about onset detection. It's about music signals but nevertheless a few ideas might be extracted from it.

From a more general point of view, what I would do is a frame-based analysis of the signal and define some kind of energy threshold/noise floor with which I could determine if there is activity or not.

$\endgroup$
0
$\begingroup$

A matched filter trained on the onset and release keying times for your particular keyboard (perhaps unified, or perhaps divided into the two frequency bands) might work. The length of the matched filter might depend on the S/N ratio and your desired statistical error rate.

$\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.