In Morse code you get the timing during the attention signal, _ . _ . _, I started with Morse flags in 69 working on my 2nd Class badge. Always start with a start signal and send an end to sign off.

So pick up the timing from the sender. 3 longs and 2 shorts, take the shortest dah and the longest dit.

In Arduino time even the dits are going to be big numbers. You can divide the width of the longest dit by 4 or 5 and only read the input state that often since consistent dits will be maybe < 8 HIGH in a row at most and dahs will perhaps be > 12 depends on what the sender does and how many segments you divide the initial input.

Annnnd the spaces should likewise be checked to find the minimum LOW reads to qualify!

If your code does not block, it will be like 1000x faster than you need, hehehe.

If you’re making a trainer then there’s room for feedback and time-stamped logging.