ATTiny, Counting with interupts

OK, but I'm not clear what is the determining factor. Do you want to see how many pulses there are in 1 second or do you want to count a particular number of pulses and see how long that takes?

What is the purpose of all this? I've now seen your PM. I'm not going to deal with this privately but I won't make the PM public.

My strong advice would be to develop your project with a second Arduino. The reason I'm suggesting 2 Arduinos is that you can program one of them to produce a stream of outputs that mimics the real world device you are trying to use. That way you can have a repeatable test.

I think you need to spend a bit of time thinking about (and writing down) the exact specification of what you want to detect - all the cases that matter. You already have the fundamentals. You just need to build them into a complete project.

It seems to me you want to reject some scenarios - such as one beep only within X msecs. And you want some minimum number of beeps to trigger a warning. And the more beeps the merrier. At the same time I don't think you can afford to have a dormant period because the valid train of beeps might start in that period. (Correct me if this is nonsense).

I need to think more about it.

...R

Edit to add ... It will make your code much easier to understand if you move things out of loop() and into specific short functions. loop() should really have nothing but calls to the functions and, perhaps, a line to capture the latest value of millis(). ...R