Decoding a temporal input pattern

I have a device that outputs an analog temporal alarm pattern when activated to indicate the alarm type. I've figured out how to safely couple that output to an Arduino input pin, but I'm (n00b here) not certain how to decode it.

For one alarm type, the signal is on(500 milliseconds), off(500 msec), on(500 msec), off (500 msec), on(500 msec), off(1500 msec), then repeating. The official definition is 3 pulses followed by a pause, repeated, without an official definition of the length of pulses or the length of the pause (those are my observed timings).

For the other alarm type, the signal is on(100 msec), off(100 msec), on(100 msec), off(100 msec), on(100 msec), off(100 msec), on(100 msec), off(5000 msec). The official definition is 4 pulses followed by a pause, repeated, without an official definition of the length of pulses or the length of the pause (those are my observed timings).

How would one differentiate the 3-pulse signal from the 4-pulse signal in an Arduino sketch?

pulseIn is what I'd start with. Watch the return value (which is in microseconds, so divide by 1000 for milliseconds) and see whether the highs are around 500 ms or 100 ms.

What Arduino?
What is the nature of these sounds are you getting.
Can you plot them out using the serial monitor so you can see them.

Sound recognition is not an easy task and can involve complex programming and processing.

One way to start is to look at one of the FFT libraries and do a Fast Fourier Transform of the signals.
Better still is to get a copy of the (free) program called Audacity that runs on your computer, which will allow you to look both at the signal and the FFT and see if you can find any easy thing to spot in these alarm sounds.