# How to know when a sound in a given frequency starts and ends?

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:

Here is the first time this sound 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?

• 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). – hotpaw2 Feb 23 '16 at 18:19
• @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. – Dayvid Oliveira Feb 23 '16 at 18:22
• You've missed the point of what @hotpaw2 wrote. – Carl Witthoft Feb 23 '16 at 20:58