First off I should state that I'm not a mathematician, I'm a programmer (Python, Javascript). But I thought this was more of a mathematical question than a programming one, so I'm asking it here.
I want to write a program that accepts a simple "secret knock" input, in the form of a defined sequence of mouse clicks/key presses with pauses between them. Imagine the rhythm of "shave and a haircut, two bits" from Who Framed Roger Rabbit. If I accept that the speed of the "knock" input might vary, I imagine that to figure out the "correctness" of the knock, I need to make a relative comparison of the gaps between the clicks/keypresses.
If I record a knock as a sequence of integers representing the current time (in ms) for every click/keypress, what would be a suitable mathematical way to compare the similarity of two such sequences, e.g. my recorded "correct" answer vs another input attempting to reproduce the knock? I'm guessing some sort of normalising would be required so that, for example, a knock that's half the speed but the correct rhythm would still pass.
Any advice appreciated! Many thanks for reading, and if I can clarify any of the above, please let me know.